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 = '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.

imshow(I,[])

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

See Also

|

Related Topics