DICOM property naming

From mitk.org
Jump to navigation Jump to search

Background/motivation

Until release 2016.03 MITK lacked a standardized handling of DICOM tags. This led to a number of issues:

  1. It was unclear which DICOM tags were read and how they were stored as properties
  2. Each module had their own way to find and handle DICOM information, making cross module information sharing difficult
  3. DICOM information was usually lost when writing to disk.
  4. There was no standard for access DICOM tag values slice or time point specific.

These Problems will be handled with Task T19799 "DICOM readers and IDicomTagsOfInterest service need extended "additional tag" support". The document offers information about how to name properties correctly and how to migrate code that uses deprecated property names.

Standardized naming

To generate conforming property names for DICOM information, you have two options. IMPORTANT: Please use one of the two following options, if you need a property name. That ensures that your names are always consistent and compliant.

  1. Simple, MITK Core based
In mitkPropertNameHelper.h you find the following Method to generate the property name given the group and element number of the DICOM tag.
<syntaxhighlight lang="cpp">std::string mitk::GeneratePropertyNameForDICOMTag(unsigned int group, unsigned int element)</syntaxhighlight>
  1. Advanced, MITK DICOMReader based
In the DICOMReader module, you have the class DICOMTagPath. This allows you to specify nested DICOM tags (e.g. elements of a set). For the conversion from and to DICOMTagPathes several functions are offered. E.g.:
<syntaxhighlight lang="cpp">std::string mitk::DICOMTagPathToPropertyName(const DICOMTagPath& tagPath)</syntaxhighlight>

Migration guide for properties of DICOM-Tags

All old DICOM property names (so all that are not conforming to the new schema) are deprecated and will be removed (meaning that the IO DICOM reader will not generate the properties any more). See the list for all already removed names. To find all locations in your code that are deprecated you can use the given old names as search term. You should ensure that for those cases your code checks for the new naming style. If you may work with NRRD images / mitk scenes that are stored before the change, it is advised to also have code for backwards compatibility. See example below. The code in MITK provides this backwards compatibility, so your old scenes will work there.

List of deprecated and already removed properties

Old names are also the search term to find deprecated code parts. “*” meaning wildcards, so everything with the given prefix. “Corresponding DICOMTags” are the group and element number you should use instead.

Old Name (Search string for your code) Corresponding DICOMTag
dicom.patient.* Depends on the concrete tag of this wild carded group. DICOMTag(0x####, 0x####) [1]
dicom.studiy.* Depends on the concrete tag of this wild carded group. DICOMTag(0x####, 0x####) [1]
dicom.series.* Depends on the concrete tag of this wild carded group. DICOMTag(0x####, 0x####) [1]
dicom.voilut.* Depends on the concrete tag of this wild carded group. DICOMTag(0x####, 0x####) [1]
dicom.PixelSpacing DICOMTag(0x0028, 0x0030)
dicom.ImagerPixelSpacing DICOMTag(0x0018, 0x1164)
dicom.RescaleIntercept DICOMTag(0x0028, 0x1052)
dicom.RescaleSlope DICOMTag(0x0028, 0x1053)
dicom.ManufacturerModelName DICOMTag(0x0008, 0x1090)
dicom.ManufacturerName DICOMTag(0x0008, 0x0070)
dicom.InstitutionName DICOMTag(0x0008, 0x0080)
dicom.StationName DICOMTag(0x0008, 0x1010)
dicom.DoseGridScaling DICOMTag(0x3004, 0x000e)

[1]: For the numbers, please see a list of the DICOM tags (e.g. http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/DICOM.html)  

Example for refined code

Old code snippet: <syntaxhighlight lang="cpp"> if ( dataPropertylist->GetStringProperty("dicom.study.StudyDescription",

                                         studyDescription ) )

{

 //Do something with the study description
 ...

} </syntaxhighlight>


New code snippet: <syntaxhighlight lang="cpp"> std::string studyDescription = “”;

// Remark: (0x0008,0x1030) is the DICOM code for study description. if (GetBackwardsCompatibleDICOMProperty(0x0008,0x1030, "dicom.study.StudyDescription", dataPropertylist, studyDescription)) {

 //Do something with the study description
 ...

} </syntaxhighlight>


Further information

Some further information can be found in the following bug squashing seminar slides:

  1. DICOM meta information and where to find/put them