How to write edited DICOMRT header info to file

3 views (last 30 days)
Hi,
I'm attempting to edit dwell position coordinates of a DICOMRT file of a brachytherapy plan.
I am using dicominfo to read in the metadata containing the plan information, then attempting to use dicomwrite to save a new dicom file with the edited dwell positions.
I can't seem however to get dicomwrite to work properly. I tested by just creating a copy of the original dicom file and it works fine, but when attempting to save the edited file it is either not saving all the relevant information or throwing up an error.
An example of what I'm attempting to do is below
%Read in DICOM metadata for RTPlan file
info = dicominfo('filename');
%Edit X coordinate of first dwell position in catheter 1 to be 0.5 cm
info.ApplicationSetupSequence.Item_1.ChannelSequence.Item_1.BrachyControlPointSequence.Item_1.ControlPoint3DPosition(1) = 0.5
%Now write to file
%This option works fine but just copies the original file
dicomwrite([],'newfilename', 'CreateMode', 'Copy')
%This gives an error
dicomwrite([],'newfilename', info, 'CreateMode', 'Copy')
%This gives an error
dicomwrite([],'newfilename', info)
%This doesn't write back any of the plan information to the new file
dicomwrite([],'newfilename')
Any information on how I can implement this would be greatly appreciated.
  5 Comments
Ridwan Alam
Ridwan Alam on 18 Dec 2019
I don’t think there’s a problem with this current version of assignment. But, there might be another way of setting values to the info struct. With the earlier assignment, I was also suspecting the same. And that is why I asked for the info.mat. Anyway, glad that you figured it out.
Walter Roberson
Walter Roberson on 18 Dec 2019
info.ApplicationSetupSequence.Item_1.ChannelSequence.Item_1.BrachyControlPointSequence.Item_1.ControlPoint3DPosition(1) = info.ApplicationSetupSequence.Item_1.ChannelSequence.Item_1.BrachyControlPointSequence.Item_1.ControlPoint3DPosition(1) - 0.5
I wonder if that is potentially creating negative values, and if so if that would be a problem? More generally, perhaps it is generating a value outside the permitted range ?

Sign in to comment.

Answers (0)

Products


Release

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!