.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_input_output_plot_read_rtplan.py: ====================================== Read RTPLAN DICOM and list information ====================================== Given an RTPLAN DICOM file, list basic info for the beams in it. .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Beam name Number Gantry SSD (cm) Field 1 1 0.0 89.8 | .. code-block:: python # authors : Guillaume Lemaitre # license : MIT from __future__ import print_function import pydicom from pydicom.data import get_testdata_files print(__doc__) def list_beams(plan_dataset): """Summarizes the RTPLAN beam information in the dataset.""" lines = ["{name:^13s} {num:^8s} {gantry:^8s} {ssd:^11s}".format( name="Beam name", num="Number", gantry="Gantry", ssd="SSD (cm)")] for beam in plan_dataset.BeamSequence: cp0 = beam.ControlPointSequence[0] SSD = float(cp0.SourceToSurfaceDistance / 10) lines.append("{b.BeamName:^13s} {b.BeamNumber:8d} " "{gantry:8.1f} {ssd:8.1f}".format(b=beam, gantry=cp0.GantryAngle, ssd=SSD)) return "\n".join(lines) filename = get_testdata_files('rtplan.dcm')[0] dataset = pydicom.dcmread(filename) print(list_beams(dataset)) **Total running time of the script:** ( 0 minutes 0.004 seconds) .. _sphx_glr_download_auto_examples_input_output_plot_read_rtplan.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: plot_read_rtplan.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: plot_read_rtplan.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_