creating DICOM RT structure after using contour in Matlab
6 views (last 30 days)
Show older comments
Hi everyone!
I need to change (with a matlab code) the boundaries of a tumor structure, imported in DICOM format which should be in the same format after manipulation.
After modifying the structure, I have a 3D matrix containing densities. I used the matlab function "contour" to find the contours at each plane and then I saved the information in the info struct (the dICOM header). Finally, I used dicomwrite to create a DICOM image out of the modified info struct.
When I try to open my DICOM in work stations, I receive the error: "non-closed contours are not supported" and "Misalignments are taking place!". When I plot the contours in MATLAB there are no visible openings, but in some planes there are two or more different islands of the structure (see the figure below). I wonder if that can be the problem, considering that the contour points are saved in DICOM format in the order x1;y1;z1;x2;y2;z2;… .
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/164490/image.jpeg)
I would be grateful if anyone can help me with some ideas about what the problem is and how I can solve it. Here is some relevant parts of the code:
a = dicomread('RTSS.dcm'); %RTSS is the structure set file
info = dicominfo('RTSS.dcm'); %dicom header
… %implement the changes on the tumor
for i=1:slices
[c,h]=contour(Infiltrated(:,:,i),1);
contourData=[];
field=['Item_',int2str(i)];
for j=1:size(c,2)
contourData=[contourData; c(1,j); c(2,j); i];
%points are given x;y;z;x;y;z…
end
end info.ROIContourSequence.Item_3.ContourSequence.(field).ContourData=contourData;
…
dicomwrite(a,'ZoneA.dcm',info, 'CreateMode', 'copy')
0 Comments
Answers (0)
See Also
Categories
Find more on DICOM Format in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!