At IDRsolutions we have been working on a variety of cool features to enhance our JDeli Java Image Library. One of these features gives our customers the ability to decode DICOM files. I will admit that I had never heard of this particular format before we started working with it, so I thought I would create this article to enlighten others as to what the format is, how it works and why it is used.
What it DICOM?
DICOM stands for Digital Imaging and Communications in Medicine and is a worldwide standard that defines how to store, exchange and transmit medical images. Image devices including X-rays, Ultrasound, Microscopy, MRI and CT utilize this standard. The standard (originally named ACR/NEMA 300) was first created back in 1985 when medical practitioners wanted to decode images in order to dose-plan for radiation therapy. The standard was not perfect from the get go. It took a couple of big revisions before it became a widely accepted practice in 1993 (which is also the year the standard was renamed DICOM).
Over the years there have been a few different offshoots of the DICOM standard that were implemented in other areas e.g. DICOS (Digital Imaging and Communication in Security) which is used for image sharing in airport security.
The DICOM format
DICOM is a slightly unique format as it does not only store the image pixel data (as a special attricbute) but also data sets which are made up of attributes. These data sets contain critical information that must be kept within the file to ensure they are never separated from each other. For example a CT scan could also contain a data set that represents a patient and the attributes that describe that patient e.g. name, age, weight etc. There are over 2000 different attributes that could be added to the file and they are all defined in the DICOM data dictionary. These attributes are in a sense similar to how JPEG files can have embedded tags to describe the image.
DICOM files are not limited to one dimensional images. They can represent 3 or 4 dimensional images if the attribute storing the pixel data has multiple frames, allowing the storage of cine loops or other multi-frame data.
The pixel data can be compressed using a variety of standards including: JPEG, Lossless JPEG and JPEG 2000. Currently we have created some simple functions into the JDeli Image Library that will decode both JPEG and JPEG 2000 DICOM files and are currently working towards adding Lossless JPEG decoding to this list. Using the JDeli Java Image Library you can get the images from the DICOM file in two simple lines of code:
DicomDecoder decoder = new DicomDecoder(); BufferedImage image = decoder.read(dicomByteData);
The DICOM Standard
DICOM does not only define the image and data sets but also the transport layer protocol and other services. The whole standard is made up of 20 related but independent sections. For example the the Data Dictionary that I mentioned in the previous section is one of these sections. Other sections define a fair few other services that machines can implement to carry out useful tasks. For example there are sections defining:
- – Managing imaging procedure worklists
- – Printing images to digital media like DVDs
- – Reporting procedure status like completion of an imaging acquisition
- – Confirming successful archiving of images
- – Encrypting datasets
- – Removing patient identifying information from datasets
- – Organising layouts of images for review
- – Saving image manipulations and annotations
The standard has various advantages including:
- – Single network transactions will transfer both image and patient details
- – Enhanced patient safety (images and data kept together)
- – Consistent standard across multiple devices means better compatibility
- – Store rich acquisition and imaging protocol data
- – There has been a study carried out that has shown that one disadvantage of the DICOM standard relates to data entry. If optional fields are added to the file but not filled in correctly then that could cause image objects to be incomplete and cause issues elsewhere.
So there you have it – the DICOM standard.