Main Content


Extract ROI data from DICOM-RT structure set

Since R2020a


The dicomcontours object extracts and stores region of interest (ROI) data from the metadata in DICOM-RT structure set files. You can use the object functions to add, delete, display, modify, and create masks from this ROI data. For more information, see Object Functions.




contour = dicomContours(info) creates a dicomCountours object that stores ROI data from the structure set and ROI contour modules of the specified DICOM metadata info.

Input Arguments

expand all

DICOM metadata, specified as a structure array. The metadata must correspond to a valid RT structure set file. You can use the dicominfo function to read metadata from DICOM-RT structure set files.

Data Types: struct


expand all

This property is read-only.

ROI data, returned as an M-by-5 table, where M is the number of ROI sequences defined in the DICOM metadata. The entries in each row of the table define an ROI sequence. The table has these columns.

NumberIdentification number of the ROI, returned as a scalar integer. The number references the ROI number in the structure set ROI sequence.
NameName of the ROI, returned as a character vector. The name references the ROI name in the structure set ROI sequence.

Points defining the contours of the ROI, returned as a cell array. The number of cells corresponds to the number of axial slices defined in the ROI. Each cell contains an N-by-3 matrix with rows of the form [x y z] that specify coordinate data for one axial slice. N is the number of points in the contour. These coordinates define contours in the patient-based coordinate system.


Geometric type of the contour, returned as a character vector. The value for geometric type can be any of these options:






Display color of the ROI, returned as an RGB triplet [r g b] with values in the range [0, 255].

Data Types: table

Object Functions

addContourAdd ROI sequence to ROI data
convertToInfoWrite ROI data to DICOM metadata
createMaskCreate volumetric mask from dicomContours object
deleteContourDelete ROI sequence from ROI data
plotContourPlot ROI contour data in DICOM-RT structure set


collapse all

Read DICOM metadata from a DICOM-RT structure set file by using the dicominfo function.

info = dicominfo("rtstruct.dcm");

Extract 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.

contour = dicomContours(info);

Display the details of the dicomContours object.

contour = 
  dicomContours with properties:

    ROIs: [2x5 table]

Display the ROIs property of the dicomContours object. The ROIs property is a table that contains the extracted ROI data.

ans=2×5 table
    Number          Name           ContourData    GeometricType       Color    
    ______    _________________    ___________    _____________    ____________

      1       {'Body_Contour' }    {90x1 cell}     {90x1 cell}     {3x1 double}
      2       {'Tumor_Contour'}    {21x1 cell}     {21x1 cell}     {3x1 double}

Version History

Introduced in R2020a