addContour
Syntax
Description
adds a user-defined region of interest (ROI) sequence to the contourOut
= addContour(contourIn
,number
,name
,contourData
,geometry
)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.
specifies the color for the contour data added to the input contourOut
= addContour(___,color
)dicomContours
object, in addition to all input arguments from the previous syntax.
Examples
Add ROI Sequence to ROI Data
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-VS-SEG-001.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=4×5 table
Number Name ContourData GeometricType Color
______ ___________ ___________ _____________ ____________
1 {'TV' } {13x1 cell} {13x1 cell} {3x1 double}
2 {'Cochlea'} { 5x1 cell} { 5x1 cell} {3x1 double}
3 {'Vol2016'} {12x1 cell} {12x1 cell} {3x1 double}
4 {'*Skull' } {79x1 cell} {79x1 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 = 5; 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: [5x5 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=5×5 table
Number Name ContourData GeometricType Color
______ ___________ ___________ _____________ ____________
1 {'TV' } {13x1 cell} {13x1 cell} {3x1 double}
2 {'Cochlea'} { 5x1 cell} { 5x1 cell} {3x1 double}
3 {'Vol2016'} {12x1 cell} {12x1 cell} {3x1 double}
4 {'*Skull' } {79x1 cell} {79x1 cell} {3x1 double}
5 {'Organ' } {21x1 cell} {21x1 cell} {3x1 double}
Input Arguments
contourIn
— Input ROI data
dicomContours
object
Input ROI data, specified as a dicomContours
object.
number
— ROI number
integer scalar
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
name
— User-defined name for ROI
character vector | string scalar
User-defined name for the ROI, specified as a character vector or string scalar.
Data Types: char
| string
contourData
— 3-D coordinates of contours in ROI
cell array of N-by-3 matrices
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
geometry
— Geometric type of the contour
"Point"
| "Open_planar"
| "Open_nonplanar"
| "Closed_planar"
Geometric type of the contour, specified as one of these values.
"Point"
"Open_Planar"
"Open_nonplanar"
"Closed_planar"
Data Types: char
| string
color
— Display color for ROI
RGB triplet
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
contourOut
— Output ROI data
dicomContours
object
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.
Extended Capabilities
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Version History
Introduced in R2020aR2024b: Support for thread-based environments
addContour
now supports thread-based
environments.
See Also
Objects
Functions
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)