extractSegmentationInfo
R2026bDescription
Examples
Download and unzip an MRI prostrate volume [1].
zipFile = matlab.internal.examples.downloadSupportFile("medical","ProstatexMRIData.zip"); filepath = fileparts(zipFile); unzip(zipFile,filepath)
Create a medical volume object for the MRI prostate volume.
filepathMRI = fullfile(filepath,"ProstatexMRIData","5.000000-t2tsetra-75680"); mriVol = medicalVolume(filepathMRI)
mriVol =
medicalVolume with properties:
Voxels: [384×384×19 int16]
VolumeGeometry: [1×1 medicalref3d]
SpatialUnits: "mm"
Orientation: "transverse"
VoxelSpacing: [0.5000 0.5000 4.5000]
NormalVector: [1.4081e-17 0.2419 0.9703]
NumCoronalSlices: 384
NumSagittalSlices: 384
NumTransverseSlices: 19
PlaneMapping: ["sagittal" "coronal" "transverse"]
DataDimensionMeaning: ["left" "posterior" "superior"]
Modality: "MR"
WindowCenters: [19×1 double]
WindowWidths: [19×1 double]
Unzip the prostrate segmentation volume attached to this example as a supporting file.
unzip("ProstateXSegData.zip",pwd)Create a medical volume object for the prostate segmentation volume.
filepathSEG = fullfile(pwd,"ProstateX-0004","10-18-2011-NA-MR prostaat kanker detectie WDSmc MCAPRODETW-45493", ... "300.000000-Segmentation-3.549","1-1.dcm"); segVol = medicalVolume(filepathSEG)
segVol =
medicalVolume with properties:
Voxels: [384×384×171 logical]
VolumeGeometry: [1×1 medicalref3d]
SpatialUnits: "mm"
Orientation: "transverse"
VoxelSpacing: [0.5000 0.5000 0.5000]
NormalVector: [2.6606e-17 0.2419 0.9703]
NumCoronalSlices: 384
NumSagittalSlices: 384
NumTransverseSlices: 171
PlaneMapping: ["sagittal" "coronal" "transverse"]
DataDimensionMeaning: ["left" "posterior" "superior"]
Modality: "SEG"
WindowCenters: []
WindowWidths: []
Extract segmentation information from the segmentation volume.
segInfo = extractSegmentationInfo(segVol)
segInfo = struct with fields:
SegmentNumber: 1
SegmentLabel: "Prostate"
SegmentDescription: "Prostate"
ColorCIELab: [43803 26565 37722]
AlgorithmType: "MANUAL"
SegmentationColor: [128 174 128]
SegmentationType: 'BINARY'
Observe that the voxel spacing for the MRI and segmentation volumes is different. Resample the segmentation volume to align with the MRI volume.
segVol = resample(segVol,mriVol.VolumeGeometry)
segVol =
medicalVolume with properties:
Voxels: [384×384×19 logical]
VolumeGeometry: [1×1 medicalref3d]
SpatialUnits: "mm"
Orientation: "transverse"
VoxelSpacing: [0.5000 0.5000 4.5000]
NormalVector: [1.4081e-17 0.2419 0.9703]
NumCoronalSlices: 384
NumSagittalSlices: 384
NumTransverseSlices: 19
PlaneMapping: ["sagittal" "coronal" "transverse"]
DataDimensionMeaning: ["left" "posterior" "superior"]
Modality: "SEG"
WindowCenters: []
WindowWidths: []
The segmentation data contains only one label. Create a label map for the segmentation.
labelMap = segVol.Voxels;
Visualize the label map overlaid on the MRI volume.
tf = oneSliceIntrinsicToWorldMapping(mriVol.VolumeGeometry,1); vol = volshow(mriVol.Voxels, ... Transformation=tf, ... DisplayRangeMode="data-range", ... OverlayData=labelMap, ... OverlayDisplayRangeMode="data-range", ... OverlayColormap=[1 0 0], ... OverlayAlpha=0.5);

References
[1] Meyer, A., Schindele, D., von Reibnitz, D., Rak, M., Schostak, M., & Hansen, C. (2020). PROSTATEx Zone Segmentations [Data set]. The Cancer Imaging Archive. https://doi.org/10.7937/TCIA.NBB4-4655.
Input Arguments
Medical volume imported from a DICOM-SEG file, specified as a medicalVolume object.
Output Arguments
Segmentation label information, returned as a structure with these fields.
| Field | Description |
|---|---|
SegmentNumber | Segment numbers, returned as an S-by-1 vector containing the numeric identifier of each of the S segments. |
SegmentLabel | Segment labels, returned as an S-by-1 vector of strings containing the label of each of the S segments. |
SegmentDescription (if available) | Segment descriptions, returned as an S-by-1 vector of strings containing a detailed description of each of the S segments. |
AlgorithmType (if available) | Type of algorithm, returned as an S-by-1 vector of
strings containing the algorithm type of each of the S
segments as "MANUAL", "AUTOMATIC", or
"SEMIAUTOMATIC". |
AlgorithmName (if available) | Algorithm name, returned as an S-by-1 vector of strings containing the algorithm name of each of the S segments. |
SegmentationType | Type of segmentation, returned as "BINARY" or
"FRACTIONAL". |
SegmentationFractionalType | Subtype of fractional segmentation, returned as
"PROBABILITY" or "OCCUPANCY". This
field exists only if the segmentation type is
"FRACTIONAL". |
MaximumFractionalValue | Maximum permissible fractional value in raw pixel data, returned as a
numeric scalar. This field exists only if the segmentation type is
"FRACTIONAL". |
ColorCIELab (if available) | LAB color triplets for visualization, returned as an S-by-3 array with each of the S rows representing the LAB color triplet of the corresponding segment. |
SegmentationColor (if available) | RGB color triplets for visualization, returned as an S-by-3 matrix in which each row represents the RGB color triplet of the corresponding segment. |
SegmentsOverlap (if available) | Indicates whether any pixel in the image is or might be in more than one
segment, returned as "YES", "NO", or
"UNDEFINED". |
Version History
Introduced in R2026b
See Also
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.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)