Main Content

Read Image Data from DICOM Files

To read image data from a DICOM file, use the dicomread function. The dicomread function reads files that comply with the DICOM specification but can also read certain common noncomplying files.

When using dicomread, you can specify the file name as an argument, as in the following example. The example reads the sample DICOM file that is included with the toolbox.

I = dicomread("CT-MONO2-16-ankle.dcm");

You can also use the metadata structure returned by dicominfo to specify the file you want to read, as in the following example.

info = dicominfo("CT-MONO2-16-ankle.dcm");
I = dicomread(info);

View DICOM Images

To view the image data imported from a DICOM file, use one of the toolbox image display functions imshow or imtool. Note, however, that because the image data in this DICOM file is signed 16-bit data, you must use the autoscaling syntax with either display function to make the image viewable.

imshow(I,DisplayRange=[])

The DisplayRange name-value argument of imshow scales the display range of a 16-bit image such that the minimum pixel value appears black and the maximum pixel value appears white.

See Also

Apps

Functions

Related Topics