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.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)