Main Content

Create Image Datastore Containing DICOM Images

This example shows how to create an image datastore from a collection of DICOM files containing 2-D images.

Specify the location of a directory containing 2-D DICOM image files.

dicomDir = fullfile(matlabroot,'toolbox/images/imdata/dog');

Create an imageDatastore, specifying the read function as a handle to the dicomread function.

dicomds = imageDatastore(dicomDir, ...
   'FileExtensions','.dcm','ReadFcn',@(x) dicomread(x));

Read and display the first image in the datastore.

I = read(dicomds);

Display the image. The image has signed 16-bit data, so scale the display range to the pixel values in the image.


Figure contains an axes. The axes contains an object of type image.

See Also


Related Topics