Into the DICOM World - Part 1

This is the first post in a series of four presenting the DICOM standard. We’ll cover the basic understandind of DICOM, starting with the DICOM data encoding. The next posts will focus on the DICOM Object, the DICOM Image representation and DICOM Communication Model.

Introduction

DICOM stands for Digital Imaging and Communications in Medicine and is the international standard to transmit, store, retrieve, print, process, and display medical imaging information. It’s the standard behing radiology equipment, networking servers and the Picture Archiving and Communication System (PACS).

You can think about it in this way: You have different entities (image-acquisition devices, PACS, workstations, etc.) playing different roles in the Healthcare world and DICOM is the standard that allows these entities to exchange information, i.e., interoperability.

alt text

The History

In the beginning of the 80’s, it was almost impossible for anyone other than manufacturers of CT and MRI devices to read and decode the images produced by the device. In 1983 the American College of Radiology and the National Electrical Manufacturers Association worked together and estabilished a standards committee to meets the combined needs of radiologists, physicists and equipment vendors. Then, in 1985 the first version of DICOM was released with name ACR-NEMA 300. The second version of the ACR-NEMA 300 came out in 1988 and gained increased acceptance among vendors. Only in 1993 the third version came out and was finally named as DICOM. The name changed because the Cardiologists entered in the game too and a name which contains only radiologists (ACR) would not make the cardiologists happy. There was a war a that time. The DICOM 3.0 from 1993 had 9 parts of the standard and the current version, which is still 3.0, incorporated 10 new parts and 210 supplements.

DICOM Data Types: VRs

Each DICOM element has a Value Representation (VR), i.e., the type of values that one can assign to it. Think about it as the same variable declaration that you do in a programming language: you say the name and the type of the variable. DICOM defines 27 basic data types and any data that you intend to encode in DICOM must use one of these 27 data types. You can see all of them here.

For example, following our analogy with programming languages, let’s say you would like to represent the number of rows of a medical image in C:

unsigned short rows = 800;

And the same data in DICOM:

Tag (0028,0010) = 800;

(0028,0010) is the DICOM tag for the image rows.

I’m not going to enter in the details here of each and every VR. For this you can always refer to the PS3.5 of the DICOM standard mentioned above. However, there are general rules that apply for all VRs that you should be aware of:

Ok, now you know that VR is the basic foundation that define all the available data type available in DICOM. What is missing now? If you pay attention, the VR is only defining the data type, but we need a way to define data elements and it should be consistent among different DICOM vendors. Then comes the DICOM Dictionary.

DICOM Data Dictionary

The DICOM Data Dictionary is in its essence a big table that specifies all data elements alongside with their properties. See for example a DICOM dictionary example available in the awesome book Digital Imaging and Communications in Medicine (DICOM): A Practical Introduction and Survival Guide: alt text From this table, you probably already noted that each element belongs to a group. Therefore, a pair (group, element) uniquely identifies an element in DICOM and it’s known as a DICOM Tag. Other properties are the name, keyword, VR, VM and RET. While DICOM applications refer to each data element by its group and element, name is a more human-readable description of the data element. The keyword is a one-word text that provide a full description of the data element. Think about it as a represenation more close to property names in standards like XML or HTTP. VR is the Value Represenation discussed in the previous section. VM is the quantity of values that you can store in this data element. For example, if you have a VM of 1 you can only store one data of that specificy VR. On the other hand, a VM of 1-n would allow one or more values of the specific VR. One important thing to note here is to understand how DICOM store multiple values into a single element? For binary data, DICOM uses the legth of the single-value VR and just apply an offset to read the next element:

alt text

For text data, there are no fixed legth. In this case, DICOM uses backslash (\) as a delimiter. The data element (0010,1000), for example, Other Patient IDs, has VR LO (Long Sting) and multiplicity 1-n. In this case you could represent a patient who has, let’s say, three patient IDs (123, 456 and 789) in this way: “123\456\789”.

Last, but not least, the RET in the dicom dictonary defines a data element as RETIRED. As an analogy, they are like the deprecated objects and/or methods in a programming language.

Another type of DICOM Dictonary is the Private DICOM Dictionary. As you can see in the previous section, the public DICOM Dictionary is composed of more than 2000 data elements. While this looks impressive, allowing you to encode almost every information you need, sometimes you need to define custom attributes that only you, as a manufacturer, know. DICOM is prepared for it and reserves all odd groups for private data elements. For the sake of example, you could define (0009, 1010) as Patient’s Education Level. Then, if you need that a specific consumer understand this data, you need to distribute this private dictionary so the consumer can understand each tag that you define.

DICOM Data Encoding

We now have the entire foundation to encode an object in DICOM. And this is very simple: A DICOM object is just a set of DICOM data elements together. Each data element, as described before, is mainly describe by a tag. See for example a real DICOM object read by the Free DICOM Medical Image Viewer Horos: alt text

The picture is easy for a human to read it, i.e., you just need to go in every data element and read the value. However, we need to encode it properly, so digital systems can store, read and transmit all of this DICOM information properly. Part PS3.5 of the DICOM standard defines two encoding types: implicit VR and explicit VR. The difference between them is that the former doesn’t have specific bytes to define the type of the VR while the later reserves two bytes to encode the VR. Another important point is that explicit VR is important for encoding nonstandard (proprietary) VRs that you can’t find in the standard DICOM dictionary.

Implicit VR:

Group Number Element Number Value Length Value
2 bytes 2 bytes 4 bytes X X (must be even)


Explicit VR:

Group Number Element Number VR Value Length Value
2 bytes 2 bytes 2 bytes 2 bytes X X (must be even)


Let’s see an example starting with the Implicit VR. Let’s say that we are trying to encode the data element SeriesDescription from the picture whose value is “Chest pa”. The encoding would be:

Byte # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Decimal 8 0 62 16 8 0 0 0 C h e s t   p a
Binary 08 00 3E 10 08 00 00 00 43 68 65 73 74 20 70 61


Note that the default Endian type for DICOM is Little Endian, so for multi-byte numbers like Group Number, Element Number and Value Length, the lowest (rightmost) byte comes first and the highest byte is the next. Also, note that, as discussed earlier, DICOM always guarantee that the VR length is even, i.e., the number X will always be even. In case of text value, a space will be added and in case of binary value a NULL byte termiantor will be added.

Did you realize now how easy is for DICOM to parse it? In the above example, it reads the first two bytes and it knows that it’s the Group Number. Next two bytes and it’s the Element Number. In the sequence, it reads 4 bytes (call it X) that tells the Value Length of the actual content. Last, but not least, it reads X bytes to retrieve the actual Value.

The same encoding with the explicit VR would be:

Byte # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Decimal 8 0 62 16 L O 8 0 C h e s t   p a
Binary 08 00 3E 10 4C 4F 08 00 43 68 65 73 74 20 70 61


You can see that for explicit encondig the 4 bytes of the VR field is divided in two fields of two bytes each, containing explicitely the VR type.

Conclusion

In this first post, we covered the basics of DICOM and learned how to describe the basic data elements in DICOM. The next post will talk about the DICOM objects.