Main Content


Extract ROI data from DICOM-RT structure set


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




contour = dicomContours(info) creates a dicomCountours object that stores ROI data from the structure set and ROI contour modules of 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 defines a ROI sequence. The table has these variables.

Column VariablesDescription
NumberIdentification number of the ROI, specified as a scalar integer. The number references the ROI number in the structure set ROI sequence.
NameName of the ROI, specified as a cell array of character vectors or string scalars. The name references the ROI name in the structure set ROI sequence.
ContourDataPoints defining a contour in the ROI, specified as a cell array. Each cell contains an N-by-3 matrix of the form (x, y, z). These coordinates define a contour in the patient based coordinate system. N is the number of points in a contour.

Geometric type of the contour, specified as a character vector or a cell array of character vectors. The value for geometric type can be any of the following:





ColorDisplay color of the ROI, specified 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 DICOM-RT structure set files by using 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 and 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}

See Also


Introduced in R2020a