MeVisLab Toolbox Reference
DCMTree Overview

The DCMTree library provides classes for accessing the DICOM tags associated with an image. Most definitions in this library are contained in the DCMTree and DCMTree_Utils namespaces.


Main DCMTree Classes

The most important classes in the DCMTree library are:

  • Tree: A Tree object represents a collection of all DICOM tags associated with an image, structured in a list. Since a DICOM sequence tag can itself contain complete lists of nested DICOM tags, the collection can be considered a tree.
  • Tag: A Tag object represents a data item in a Tree. A Tag has several properties and a list of Value objects.
  • TagId: A TagId is a pair of two integers identifying the DICOM group and element id's of a Tag object.
  • Value: A Value object represents the actual data stored in a Tag.
  • Dict: A Dict object contains a dictionary of all tag id's and their corresponding properties, as defined in the DICOM standard.
  • TagInfo: A TagInfo object represents the properties stored in the dictionary for a given tag id, or the properties of a Tag object.


Shared Ownership of DICOM Trees

Shared Pointers

In an environment such as MeVisLab, where many image objects may share the same set of DICOM data, it would be inefficient to associate each image with its own Tree object. Instead, a single Tree object is typically associated to multiple image objects, and there's no dedicated owner of the Tree. For dynamically created objects, this requires a reference counting and auto deletion mechanism. In the DCMTree library, this is realized using the boost shared pointer classes (shared_ptr<class>). See the boost documentation at http://www.boost.org/libs/smart_ptr/shared_ptr.htm to find out more about shared pointers.

Incremental Modification of Tree Objects

One consequence of the shared ownership of Tree objects is that often only const access to a Tree is possible, and that modification of the object is not allowed. In order to avoid the need to make a full new copy of the Tree object, the Tree class provides the option to store only the tags that have been added, deleted or modified, as well as a reference to a parent tree from which all remaining tags are inherited. Thus, instead of modifying a Tree object, a new Tree is created with the original Tree as its parent, and modified tags are added to this Tree. This process can be continued, resulting in a chain of Tree objects with a root tree and several incremental trees. The Tree member methods performing a lookup of tags offer a TagSelector argument, that allows to specify the search scope within such a chain.


Multi-Frame Objects

The DCMTree library provides an extension to the DICOM standard allowing to store DICOM tags of a whole collection of logically (spatially or temporally) related 2D frames in a single Tree object. Such structured multi-frame objects are accessed using the StructuredMF class.


Examples

  1. Reading a DICOM file and creating a DCMTree from it:
          DCMTree::IOParameterPtr ioParamPtr = DCMTree::IOParameter::create(std::string(filename), false);
          DCMTree::ReaderPtr      reader     = DCMTree::Reader::create(DCMTree::Dict::singleton());
          DCMTree::MessagePtr     messagePtr = reader->read(ioParamPtr);
          DCMTree::TreePtr        treePtr    = messagePtr->tags();