<< Back to the main page

Extending DICOM tags dictionary

DICOM tags are identified by (group, element) key. QDCM maintains a dictionary that maps tag keys to tag names and information on tag data types. This dictionary is used when parsing DICOM data.

QDCM dictionary is stored in XML format and is linked with dcmcore module. This dictionary contains only known non-private tags. There are several ways the dictionary can be extended to handle unknown and private tags:

  1. Modifying XML file located at qdcm-code/code/dcmcore/resources/dict/dicom.xml
  2. Adding missing entries in runtime
  3. Adding missing entries by loading an additional XML file in runtime
The first option is not recommended as it will affect QDCM code base.

Extending dictionary by adding tag descriptions manually

Dictionary can be extended by adding tag descriptions for unknown tags:

// Get QDCM dictionary instance
DcmDictionary *dictPtr = DcmDictionary::getInstancePtr();

// Describe private tag
DcmTagDescription privateTag("MyPrivateTag",            // tag name
                             DcmTagKey(0x2345, 0x6789), // tag key
                             DcmVr::DS,                 // tag type
                             1,                         // minimal multiplicity
                             DcmMultiplicity_Unknown    // maximal multiplicity
// Populate the dictionary    
Having this done, the private tag (2345, 6789) will be recognised and one can write for instance:
DcmDataset dataset;

double value = dataset["MyPrivateTag"].toDouble();

Extending by loading external XML file

If there are many tags to be described, a better idea might be to have a separate XML file that describes those tags:

<?xml version="1.0" encoding="UTF-8"?>
    <tag key="2345,6789" vr="DS" vm="1-n">MyPrivateTag</tag>
You can further load you XML file to extend the dictionary:
DcmDictionary *dictPtr = DcmDictionary::getInstancePtr();

QDCM dictionary object is a singleton, meaning that there is only once instance if the dictionary exist in the application. If you change the dictionary it will affect all QDCM classes used through all your application.

©2012 by Arthur Benilov

Project Web Hosted by