Add an ROI contour sequence to existing ROI data, and then export the new ROI data to the DICOM-RT structure set format.
Read the DICOM metadata from a DICOM-RT structure set file.
Extract the ROI data from the structure set and ROI contour modules of the DICOM metadata. The output is a dicomContours object that stores the extracted ROI data.
Display the ROIs property of the dicomContours object.
ans=4×5 table
Number Name ContourData GeometricType Color
______ ___________ ___________ _____________ ____________
1 {'TV' } {13×1 cell} {13×1 cell} {3×1 double}
2 {'Cochlea'} { 5×1 cell} { 5×1 cell} {3×1 double}
3 {'Vol2016'} {12×1 cell} {12×1 cell} {3×1 double}
4 {'*Skull' } {79×1 cell} {79×1 cell} {3×1 double}
Load another ROI contour into the workspace. The contour data contains the 3-D coordinates of the contours in the ROI.
To create an ROI sequence that contain the new ROI contour data, specify these attributes of the ROI sequence:
Assign a unique ROI number for the ROI sequence. The ROI name can be any user-defined name. Because all points in the new ROI contour data are coplanar, and the last point is connected to the first point, specify the geometric type as "Closed_planar".
Add the new ROI sequence to the ROIs property of the dicomContours object. The output is also a dicomContours object containing the new ROI sequence as well as the original ones.
ans=5×5 table
Number Name ContourData GeometricType Color
______ ___________ ___________ _____________ ____________
1 {'TV' } {13×1 cell} {13×1 cell} {3×1 double}
2 {'Cochlea'} { 5×1 cell} { 5×1 cell} {3×1 double}
3 {'Vol2016'} {12×1 cell} {12×1 cell} {3×1 double}
4 {'*Skull' } {79×1 cell} {79×1 cell} {3×1 double}
5 {'Organ' } {21×1 cell} {21×1 cell} {0×0 double}
Export the modified ROI data as DICOM metadata.
Write the metadata to a DICOM-RT structure set file by using the dicomwrite function. If the DICOM image associated with the ROI contour data is not available, specify the first input argument value in the dicomwrite function as an empty array. Set the CreateMode parameter to "copy" to copy the metadata to a new DICOM-RT structure set file, rtfile.dcm. Setting the create mode to "copy" copies the metadata directly without verifying the metadata attributes.