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:
qdcm-code/code/dcmcore/resources/dict/dicom.xml
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 dictPtr->addTagDescription(privateTag);Having this done, the private tag (2345, 6789) will be recognised and one can write for instance:
DcmDataset dataset; double value = dataset["MyPrivateTag"].toDouble();
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"?> <dictionary> <tag key="2345,6789" vr="DS" vm="1-n">MyPrivateTag</tag> </dictionary>You can further load you XML file to extend the dictionary:
DcmDictionary *dictPtr = DcmDictionary::getInstancePtr(); dictPtr->populateFromXML("mydict.xml");
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.