DICOM to bitmap conversion

Last revised by Candace Makeda Moore on 6 Mar 2020

DICOM to bitmap conversion describes the process of converting medical images stored within DICOM file format to raw pixel data. Computer vision techniques for processing image data usually work on raw pixel values and therefore this conversion is required before further processing may take place.

Image storage

Image data within DICOM storage standard files may be encoded in several different formats including JPEG, JPEG 2000, lossless JPEG, and run length encoded. However, knowledge of this underlying storage format is not necessary for loading the pixel data into a machine learning application where data will be typically stored as an array of floating point values or integers.  Floating point values are often used in conjunction with hardware and libraries purpose-built for machine learning. Software utilizing CUDA Nvidia's technology for programming its graphic processor units, or hardware such as Google's Tensor Processing Unit (TPU) are the examples of the later. Bitmaps made up by integer arrays are more common in programming libraries designed for general-purpose image processing, such as Imagemagic, GD, and many others.

Practical points

Many programming libraries are available to perform the task of converting DICOM to bitmaps including the open source dcmtk and gdcm. It is therefore not necessary to reinvent the wheel when designing processes involving DICOM to raw pixel data conversion. Library implementations are recommended wherever possible as they will be well documented and tested, and, therefore, far more reliable.

There is a difference between the BMP file format, and the concept of a bitmap. BMP format has provisions for auxiliary data, such as "magic number" identifying the file format, width and height of the image, image color profile necessary for adjusting color display, beside the raw color information. Bitmaps are a more general concept which map bit values to values of interest such as colors or shades of grey.

ADVERTISEMENT: Supporters see fewer/no ads