Construct volume from directory of DICOM images
[V,spatial,dim] = dicomreadVolume(source)
[V,spatial,dim] = dicomreadVolume(sourcetable)
[V,spatial,dim] = dicomreadVolume(sourcetable,rowname)
Name of a folder containing DICOM files
String array of filenames comprising the volume
Cell array of character vectors containing filenames
spatial is a structure describing the location, resolution,
and orientation of slices in the volume.
dim specifies which
real-world dimension (X = 1, Y = 2, Z = 3) has the largest amount of offset from the
dicomreadVolume is useful when working with DICOM volumes
because it reads the volumetric image data from each DICOM files, identifies the
correct ordering of the images, and constructs 4-D volume from the data.
Read volume data from a sample folder of DICOM files.
[V,s,d] = dicomreadVolume(fullfile(matlabroot,'toolbox/images/imdata/dog'));
source— Volume data folder or files
Volume data folder or files, specified as a string scalar, string array, character vector, or cell array of character vectors.
sourcetable— Collection of DICOM file metadata
Collection of DICOM file metadata, specified as a table returned by
rowname— Name of table row to load
Name of table row to load, specified as a string scalar or character
vector. The row is one of the rows in the multirow table returned by
V— 4-D DICOM volume
4-D DICOM volume, returned as a numeric array.
The dimensions of
samples is the number of color channels per voxel.
For example, grayscale volumes have one sample, and RGB volumes have three
samples. Use the
squeeze function to remove any singleton
dimensions, such as when samples is 1.
spatial— Location, resolution, and orientation
Location, resolution, and orientation of slices in the volume, specified as a structure with the following fields. For more information, see part 3 of the DICOM standard, section C.7.6.2.
|(x,y,z) triplet of the first pixel in each slice, measured in millimeters from the origin of the scanner’s coordinate system|
|Distance between neighboring rows and columns within each slice, in millimeters|
|Pair of direction cosine triplets of the rows and columns for each slice of the image|
dim— Dimension with largest offset from the previous slice
Dimension with largest offset from the previous slice, returned as a numeric scalar 1, 2, or 3, where X = 1, Y = 2, and Z = 3.