Main Content

DICOM Support in Image Processing Toolbox

Digital Imaging and Communications in Medicine (DICOM) is a highly standardized imaging format used to store and transmit medical imaging files across devices and networks. The DICOM format combines image data with metadata that describes the patient, the imaging procedure, and the spatial referencing information. The structure, storage, and transmission of DICOM files is governed by the DICOM standard, available on the official DICOM website. The standard defines separate Information Object Definitions (IODs) for modalities and applications such as computed tomography (CT), magnetic resonance imaging (MRI), and radiotherapy (RT).

Representative DICOM file showing image data and subset of metadata attributes

MATLAB® provides support for reading and writing DICOM files, as well as working with DICOM image data and metadata. You can extract and process image data using toolbox functions, and you can search and update the metadata attributes. MATLAB is compatible with most DICOM IODs, and can write new DICOM files for certain IODs that fully conform to the DICOM standard. Medical Imaging Toolbox™ provides additional tools for advanced processing of DICOM files. To get started, see Import and Spatial Referencing (Medical Imaging Toolbox).

Note

MATLAB supports working with DICOM files. There is no support for working with DICOM network capabilities in Image Processing Toolbox™. Use the Medical Imaging Toolbox to work with DICOM network capabilities.

Read and Display DICOM Image Data

Explore directories with multiple DICOM series using the DICOM Browser app or dicomCollection function. Read 2-D image data from a DICOM series by using the dicomread function or 3-D image data by using the dicomreadVolume function. For more information, see Read Image Data from DICOM Files. You can view imported DICOM images using toolbox display functions such as imshow and volshow.

You can process the image data you read from DICOM files using operations such as image filtering, registration, segmentation, and labeling. For an example that shows how to segment and calculate region properties in medical image data, see Segment Lungs from 3-D Chest Scan.

Work with DICOM Metadata

Import DICOM metadata using the dicominfo function, which creates a MATLAB structure specifying the name and value of each metadata attribute in the file. For more information, see Read Metadata from DICOM Files.

List all attributes of a metadata structure in the Command Window by using the dicomdisp function, or search for specific attributes by name using the dicomfind function. Update specific attribute values using the dicomupdate function, or remove all personally identifying information from a DICOM metadata structure using the dicomanon function. For an example that shows how to anonymize a DICOM file, see Remove Confidential Information from DICOM File.

When processing DICOM files, MATLAB uses a data dictionary file that defines standard DICOM metadata attributes. You can view or update the current data dictionary file using the dicomdict function, or search the data dictionary for specific attributes using the dicomlookup function.

Write New DICOM Files

Write images and metadata to new DICOM files using the dicomwrite function. The toolbox writes the computed tomography, magnetic resonance, and secondary capture (a modality-independent object definition) IODs with validation, which ensures that the new file contains all metadata attributes required by the DICOM standard. For detailed information, see Write Image Data to DICOM Files and Create New DICOM Series.

Work with DICOM-RT Contour Data

The DICOM-RT Structure Set is an IOD specific to radiotherapy applications. The DICOM-RT metadata includes contour data for ROIs, such as tumors and organs, used in radiation treatment planning. You can extract ROI contour data to create a dicomContours object.

Plot contours, add or delete contours, and create a new DICOM-RT metadata structure using the plotContour, addContour, deleteContour, and convertToInfo functions. For an example, see Add and Modify ROIs of DICOM-RT Contour Data.

Use the createMask object function to convert contour data into a binary mask, such as to view ROIs overlaid on image data or to label image pixels. For an example, see Create and Display 3-D Mask of DICOM-RT Contour Data.

Prepare DICOM Files for Deep Learning Workflows

You can use medical image data to train deep learning networks to perform tasks such as image denoising, segmentation, and registration. You can use imageDatastore or pixelLabelDatastore (Computer Vision Toolbox) objects that contain DICOM files to train a deep learning network. For details, see Create Image Datastore Containing DICOM Images and Create Image Datastore Containing Single and Multi-File DICOM Series. For more information about how to use image datastores to train deep learning networks, see Preprocess Images for Deep Learning.

These examples show applications of deep learning in medical image analysis.

Tips

  • Use the dicomFile (Medical Imaging Toolbox), medicalVolume (Medical Imaging Toolbox), and medicalImage (Medical Imaging Toolbox) objects and their related functions for advanced processing of DICOM files.

See Also

Apps

Functions

Objects

Related Topics