sliceCorners
Description
extracts the xyz-coordinates of the four corner voxels for one slice of
an image volume.xyzCorners
= sliceCorners(R
,slice
)
Examples
Extract Corner Coordinates for One Slice of Medical Spatial Referencing Object
Extract the corner coordinates for one slice of the medical spatial referencing object of a chest CT volume, saved as a directory of DICOM files. The volume is part of a data set containing three CT volumes. The size of the entire data set is approximately 81 MB. Download the data set from the MathWorks® website, then unzip the folder.
zipFile = matlab.internal.examples.downloadSupportFile("medical","MedicalVolumeDICOMData.zip"); filepath = fileparts(zipFile); unzip(zipFile,filepath)
Specify the directory of the DICOM files for the first CT volume in the data set.
dataFolder = fullfile(filepath,"MedicalVolumeDICOMData","LungCT01");
Create a medical volume object that contains the image and spatial metadata for the CT volume.
medVol = medicalVolume(dataFolder);
The VolumeGeometry
property of the medical volume object contains a medicalref3d
object that specifies the spatial referencing for the volume. Extract the medicalref3d
object for the chest CT.
R = medVol.VolumeGeometry;
Extract the xyz-coordinates, in millimeters, of the corner voxels for the first slice along the third dimension of the volume.
xyzCorners = sliceCorners(R,1)
xyzCorners = 4×3
-186.5000 -186.5000 -281.2500
-186.5000 185.7717 -281.2500
185.7717 185.7717 -281.2500
185.7717 -186.5000 -281.2500
Input Arguments
R
— Spatial referencing information
medicalref3d
object
Spatial referencing information, specified as a medicalref3d
object.
slice
— Slice index
positive integer scalar in range [1, p]
Slice index, specified as a positive integer scalar in the range [1, p], where p is the number of slices in the image volume along the third dimension.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Output Arguments
xyzCorners
— Coordinates of four corner voxels in patient coordinate system
4-by-3 matrix
Coordinates of the four corner voxels in the patient coordinate system, returned as a 4-by-3 numeric matrix. Each row contains xyz-coordinates for one corner of the slice, returned in clockwise order:
Pixel in the first row and first column of the data array.
Pixel in the first row and last column of the data array.
Pixel in the last row and last column of the data array.
Pixel in the last row and first column of the data array.
Version History
Introduced in R2022b
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.
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)