How to edit RTplan dicom file?

Skip to first unread message


Apr 12, 2023, 9:53:53 AM4/12/23
to pydicom

I'm quite new to pydicom and would require some assistance. I am trying to edit an RTplan to change the Gantry angle at each control point but i do not know how to proceed with it. Can someone provide me some tips and assistance with regards to that? 

I wanted to read the gantry angle at each control point, however was given the error that 'IS' cannot be indexed/'DSfloat' cannot be indexed when trying to print gantry angle.

Thanks in advance for your help! :))

Darcy Mason

Apr 12, 2023, 10:07:08 AM4/12/23
to pydicom

Here is one way to read gantry angle, using a nested loop over beams and control points:

for beam in ds.BeamSequence:
   for cp in beam.ControlPointSequence:

It uses the `.get` method to return None if that control point does not have a GantryAngle data element.  If you know they exist, you could just use `cp.GantryAngle`.  For setting values, can just use `cp.GantryAngle = 90`, or whatever value.


Apr 12, 2023, 8:11:35 PM4/12/23
to pydicom
Ah I see! Alright! Thanks for helping, ill give it a try :)
Reply all
Reply to author
0 new messages