contains
Determine if affine image volume contains points specified in patient coordinate system
Since R2022b
Description
Examples
Determine if a chest CT volume, saved as a directory of DICOM files, contains a set of coordinates specified in the patient coordinate system. 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;
Specify the patient coordinates, in millimeters, of three sample points.
xyzWorld = [-100 -100 -200; 0 0 -100; 300 200 -80]
xyzWorld = 3×3
-100 -100 -200
0 0 -100
300 200 -80
Check whether the sample points are inside the image boundary. The values of tf indicate that the third point lies outside the image.
tf = contains(R,xyzWorld)
tf = 3×1 logical array
1
1
0
Input Arguments
Spatial referencing information, specified as a medicalref3d
object. R must specify an affine image volume. An image volume is
affine if these conditions are met:
All slices are parallel to each other.
The spacing between slices in each dimension is uniform.
The upper-left voxels of all slices are collinear.
No two slices are coincident, meaning no two slices are located at the same position in space.
Patient coordinates of points to query, specified as an n-by-3 numeric matrix, where n is the number of points. The patient coordinates are in real-world units defined by the patient coordinate system.
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
Output Arguments
Image volume contains the specified points, returned as an
n-element logical vector, where n is the number of
points. A value of 1 (true) indicates that the
corresponding xyzWorld point exists in the image volume, and a
value of 0 (false) indicates that it does
not.
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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- 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)