This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Construct volume from directory of DICOM images


[V,spatial,dim] = dicomreadVolume(source)
[V,spatial,dim] = dicomreadVolume(sourcetable)
[V,spatial,dim] = dicomreadVolume(sourcetable,rowname)



[V,spatial,dim] = dicomreadVolume(source) loads the 4-D DICOM volume V from source, which can be one of the following:

  • 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 previous slice.

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.

[V,spatial,dim] = dicomreadVolume(sourcetable) loads the volume from the sourcetable, which is a table returned by dicomCollection. The sourcetable argument must contain only one row.

[V,spatial,dim] = dicomreadVolume(sourcetable,rowname) loads the volume with the specified rowname from the multirow table sourcetable returned by dicomCollection. Use this syntax when sourcetable contains multiple rows.


collapse all

Read volume data from the sample folder of DICOM files.

[V,s,d] = dicomreadVolume(fullfile(matlabroot,'toolbox/images/imdata/dogMRI'));

Input Arguments

collapse all

Volume data folder or files, specified as a string scalar, string array, character vector, or cell array of character vectors.

Data Types: char | string | cell

Collection of DICOM file metadata, specified as a table returned by dicomCollection.

Data Types: table

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 dicomCollection.

Data Types: char | string

Output Arguments

collapse all

4-D DICOM volume, returned as a numeric array.

The dimensions of V are [rows,columns,samples,slices] where 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.

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.

Spatial Structure

PatientPositions(x,y,z) triplet of the first pixel in each slice, measured in millimeters from the origin of the scanner’s coordinate system
PixelSpacings Distance between neighboring rows and columns within each slice, in millimeters
PatientOrientations Pair of direction cosine triplets of the rows and columns for each slice of the image

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.

Introduced in R2017b

Was this topic helpful?