Main Content

addContour

Add ROI sequence to ROI data

Since R2020a

Description

example

contourOut = addContour(contourIn,number,name,contourData,geometry) adds a user-defined region of interest (ROI) sequence to the ROIs property of the dicomContours object contourIn. You can use the convertToInfo function to export the new ROI data to the structure set and ROI contour modules of the DICOM metadata.

example

contourOut = addContour(___,color) specifies the color for the contour data added to the input dicomContours object, in addition to all input arguments from the previous syntax.

Examples

collapse all

Add an ROI sequence to the ROI data extracted from the structure set and ROI contour modules of the DICOM metadata.

Read DICOM metadata from a DICOM-RT structure set file.

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.

contourIn = dicomContours(info);

Display the ROIs property of the dicomContours object.

contourIn.ROIs
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}

Load another set of ROI contour data into the workspace. The contour data contains the 3-D coordinates of the contours in the ROI.

load("contours")

To create an ROI sequence that contain the new ROI contour data, specify these attributes of the ROI sequence:

  • ROI number

  • User-defined name for the ROI

  • Geometric type of the contours

  • Color of the ROI

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

number = 3;
name = "Organ";
geometricType = "Closed_planar";

Specify the color of the ROI. If you do not specify a color, the default value for color in the ROIs property is set to [].

color = [0; 127; 127];

Add the new ROI sequence to the ROIs property of dicomContours object. The output is also a dicomContours object containing the new ROI sequence as well as the original sequences.

contourOut = addContour(contourIn,number,name,contours,geometricType,color)
contourOut = 
  dicomContours with properties:

    ROIs: [3x5 table]

Display the details of the new dicomContours object by viewing its ROIs property. You can use the convertToInfo function to export the modified ROI data as DICOM metadata.

contourOut.ROIs
ans=3×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}
      3       {'Organ'        }    {21x1 cell}     {21x1 cell}     {3x1 double}

Input Arguments

collapse all

Input ROI data, specified as a dicomContours object.

ROI number, specified as an integer scalar. The ROI number references the user-defined identification number for the ROI.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

User-defined name for the ROI, specified as a character vector or string scalar.

Data Types: char | string

3-D coordinates of contours in the ROI, specified as a cell array of N-by-3 matrices. Each row is of the form [x y z], and defines a contour in the patient-based coordinate system.

Data Types: cell

Geometric type of the contour, specified as one of these values.

  • "Point"

  • "Open_Planar"

  • "Open_nonplanar"

  • "Closed_planar"

Data Types: char | string

Display color for the ROI, specified as an RGB triplet whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range [0, 255].

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Output Arguments

collapse all

Output ROI data, returned as a dicomContours object. The ROIs property of the output object contains both the input ROI and the user-defined ROI sequence.

Version History

Introduced in R2020a