oneSliceIntrinsicToWorldMapping
Geometric transform between intrinsic and patient coordinates of medical image volume slice
Since R2022b
Description
computes the geometric transformation, tform
= oneSliceIntrinsicToWorldMapping(R
,slice
)tform
, between the intrinsic and
patient coordinate systems for one slice of the medical image volume defined by
R
. The output tform
maps the geometric
transformation for the specified slice slice
along the third
dimension.
Examples
Get Mapping Between Intrinsic and Patient Coordinate Systems for One Slice
Get the geometric transform between the intrinsic and patient coordinate systems for one slice 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;
Calculate the transformation that maps between the intrinsic and patient coordinate systems for the 20th slice along the third dimension of the volume. The oneSliceIntrinsicToWorldMapping
function returns an affinetform3d
object, tform
.
tform = oneSliceIntrinsicToWorldMapping(R,20)
tform = affinetform3d with properties: Dimensionality: 3 A: [4×4 double]
The A
property of the affinetform3d
object contains a 4-by-4 geometric transformation matrix.
tform.A
ans = 4×4
0 0.7285 0 -186.5000
0.7285 0 0 -186.5000
0 0 0.5307 -233.7500
0 0 0 1.0000
Input Arguments
R
— Spatial referencing information
medicalref3d
object
Spatial referencing information, specified as a medicalref3d
object. The volume specified by R
can be affine or
non-affine.
slice
— Slice index
positive integer in range [1, p]
Slice index, specified as a positive integer 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
tform
— Geometric transformation
affinetform3d
object
Geometric transformation, returned as an affinetform3d
object.
The A
property of tform
contains a 4-by-4
3-D transformation matrix that maps triplets of pixel indices in the order
(column, row, slice) to
(x, y, z) triplets of patient
coordinates in real-world units.
Version History
Introduced in R2022b
See Also
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
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)