DICOM (.dcm, .dic)

Background & Context

    • MIME type: application/dicom
    • DICOM medical imaging format.
    • Commonly used in medical imaging equipment and picture archiving and communication systems.
    • DICOM is an acronym for Digital Imaging and Communications in Medicine.
    • Stores multiple raster images together with patient and device information.
    • Binary format.
    • Supports a variety of image encoding and data compression methods.
    • DICOM Version 3.0 was introduced in 1993.

Import & Export

  • Import["file.dcm"] imports a DICOM file, returning an Image object.
  • Import["file.dcm",elem] imports the specified element from a DICOM file.
  • The import format can be specified with Import["file","DICOM"] or Import["file",{"DICOM",elem,}].
  • Export["file.dcm",expr] exports graphics or any other expression as an image to a DICOM file.
  • When exporting Wolfram Language graphics or arbitrary expressions to DICOM, the resulting image has the same raster size as its displayed form.
  • Image objects are by default exported at their raster size.
  • Because DICOM is a raster image format, all fonts are rasterized on export.
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString support the DICOM format.

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • Data representation elements:
  • "ColorMap"color reduction palette created on Import
    "Data"array of values
    "Graphics"Graphics object representing an image
    "Image"raster graphics given as an Image object
    "ImageList"a list of images
  • Overlay elements:
  • "Overlays"an overlay image or a list of overlays
  • Import and Export by default use the "Image" element for the DICOM format.
  • Advanced Import elements:
  • "BitDepth"bits used to represent each color channel in the file
    "Channels"the number of color channels used in the file
    "ColorSpace"color encoding used in the file
    "ImageSize"raster dimensions
    "MetaInformation"metainformation stored in the file
    "RawMetaInformation"raw metainformation stored in the file
    "Summary"summary of the file

Options

  • Import and Export options:
  • "ImageTopOrientation"Toporientation of the image as stored in the file
    ImageSizeAutomaticoverall image size
  • Export option:
  • "Smoothing"0the DICOM smoothing parameter, given as a number in the range 0 to 1
  • Import option:
  • "ScalingWindow"Automaticscaling method to use for importing data (it is called "values of interest" in the DICOM spec)
  • "ScalingWindow" can take the following settings:
  • Automaticautomatic scaling
    Noneno scaling
    "MinMax"scale to min and max of data in all frames
    "MinMaxPerFrame"scale to min and max of each frame
    {center,w}scale to the range {center-w,center+w}
    <|"Center"center,"Width"w|>scale to the range {center-w,center+w}
    <|"Min"min,"Max"max|>scale to the range {min,max}
  • With "ScalingWindow"->Automatic, values are scaled using scaling values stored in the file. If no scaling specification is stored, values are scaled using the "MinMax" method.

Examples

open allclose all

Basic Examples  (3)

Import a DICOM file containing a gray-level image:

Summary of an image:

Export an image to DICOM:

Scope  (2)

Show all Import elements available in the file:

Import the image as a graphics:

Import Elements  (14)

Available Elements  (3)

List of available elements:

Import all elements as a list of rules:

Import some image options:

The "Options" element does not return all options that are present in the imported image:

Data Representation  (3)

"Data"  (1)

Import the image data:

Create an image from imported data:

"Graphics"  (1)

Import as a Graphics object:

"Image"  (1)

Import as an Image object:

This is the default import element for DICOM:

Metadata  (8)

"BitDepth"  (1)

Get the number of bits used for representing each color channel:

"Channels"  (1)

Get the number of image channels:

"ColorSpace"  (1)

Get the color encoding used on export:

Use ImageColorSpace to get the color space of an imported image:

"ImageSize"  (1)

Get the dimensions of the image stored in the file:

Using ImageDimensions on an imported image gives the same result:

"MetaInformation"  (1)

Read the metainformation from a DICOM file:

A dataset of metainformation:

"RawMetaInformation"  (2)

Unlike "MetaInformation", "RawMetaInformation" does not validate imported values against the DICOM Standard and does not perform any conversions to Wolfram Language expressions. Read the raw metainformation from a DICOM file:

A dataset of raw metainformation:

The "RawMetaInformation" element may return more tags than "MetaInformation":

"Summary"  (1)

Get the image summary:

Import Options  (6)

ImageSize  (1)

By default, images are imported in their full resolution:

Specify the raster size of the imported BMP image:

"ImageTopOrientation"  (1)

By default, images are imported with the top orientation:

Specify the side that is supposed to be on the top:

"ScalingWindow"  (4)

Import the image with default scaling:

Check the range of pixel values in the imported image:

Import the image without scaling:

Check the range of pixel values in the imported image:

Check the values of the window width and center stored in the file:

Import the image explicitly specifying the window width and center as stored in the file:

Import image scaling values between 500 and 600 to the full image data range:

Introduced in 2003
 (5.0)
 |
Updated in 2016
 (11.0)
2020
 (12.1)