Skip to Main Content Skip to Search
Home |   Australia  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Industries Academia Support User Community Company

 

Newsletters - MATLAB Digest

Accessing data in DICOM files

(Part 1 of 3)

by Jeff Mather

The DICOM (Digital Imaging and Communication in Medicine) format describes how to compose messages to send between imaging modalities (e.g., Computed Tomography (CT), Magnetic Resonance (MR), and ultrasound devices) and defines a set of operations for transmitting them across a network. These messages can also be written to files for offline storage on a picture archiving system, CD, or other type of storage device. DICOM-formatted messages combine images and metadata to create a rich description of a medical imaging procedure. This format is extremely detailed, with a specification that is more than 2,500 pages long.

MATLAB and the Image Processing Toolbox provide easy access to DICOM data. Accessing data in DICOM files becomes as easy as working with TIFF or JPEG images. This article presents examples of using DICOM and provides background information about the format.

Before DICOM: Chaos

DICOM has significantly improved communication between medical devices and lowered the cost and complexity of integrating hardware and software solutions. Before DICOM, each manufacturer used proprietary image formats and communications protocols to connect their hardware solutions with third-party products. Integrating medical hardware and software from different vendors meant translating from one vendor's protocols to another's. This process was chaotic and fraught with difficulty. A cottage industry developed to provide data translation services.

With the advent of DICOM as a formal standard in 1993, one protocol replaced many protocols and formats. DICOM is the common format, easing integration of solutions from different vendors. For example, it is possible to integrate a MR scanner from GE Medical Systems with a picture archive system (PACS) from Agfa and another vendor's film printer without using translation devices. Integration isn't limited to just hardware. Software such as MATLAB that supports DICOM can share images with all of these devices, provided that each of the hardware devices has implemented the necessary DICOM services.

A Simple First Example

In medical imaging, a patient is subject to an imaging study, which may contain multiple series of images. Each series is performed on a single modality such as an MR, CT, or X-ray device and can have multiple related images. Suppose that we have a study consisting of a series of 20 transverse MRI brain images and we want to read them into MATLAB. (These 20 images are stored in 20 DICOM files with names such as brain_017.dcm, which you can download from MATLAB Central at
www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=2762&objectType=FILE if you want to run the examples.) Let's suppose we know that each image is 256-by-256 and contains signed 16-bit data. We can read the series with the following code:

% Preallocate the 256-by-256-by-1-by-20 image array.
X = repmat(int16(0), [256 256 1 20]);

% Read the series of images.
for p=1:20
   filename = sprintf('brain_%03d.dcm', p);
   X(:,:,1,p) = dicomread(filename);
end

% Display the image stack.
montage(X,[])

After running this code, the MATLAB workspace contains a 4-D array with the image data, and a plot of the MR slices appears.

Click on image to see enlarged view.

You can use MATLAB and the Image Processing Toolbox to perform multiple tasks with this data. For example, MATLAB provides sophisticated volume visualization techniques to reconstruct a 3-D surface from these slices and then apply surface and lighting effects. The example in the Help section for the isocaps function shows this implemented. The imtransform and tformarray functions in the Image Processing Toolbox make it easy to extract slices in different orientations from the transverse data. For example, the "Extracting Slices from a 3-Dimensional MRI Data Set" demo shows how to extract saggital slices from a similar dataset. You can also use the morphology functions within the Image Processing Toolbox to perform operations such as image segmentation, feature extraction, and image statistics. Alternatively, you can write your own functions to perform volume estimation, shrinkwrapping, etc.

ArrowPart 2

Contact sales
E-mail this page
Print this page
Subscribe to newsletters