Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::DICOMTagPath Class Reference

Class used to identify (nested) attributes in a DICOM dataset. More...

#include <mitkDICOMTagPath.h>

Collaboration diagram for mitk::DICOMTagPath:

Classes

struct  NodeInfo
 Describes a single node within a DICOMTagPath. More...
 

Public Types

typedef int ItemSelectionIndex
 
typedef std::vector< NodeInfo > NodeInfoVectorType
 
typedef NodeInfoVectorType::size_type PathIndexType
 

Public Member Functions

bool IsEmpty () const
 
bool IsExplicit () const
 
bool HasItemSelectionWildcardsOnly () const
 
PathIndexType Size () const
 
PathIndexType AddNode (const NodeInfo &newNode)
 
const NodeInfo & GetNode (const PathIndexType &index) const
 
NodeInfo & GetNode (const PathIndexType &index)
 
NodeInfo & GetFirstNode ()
 
const NodeInfo & GetFirstNode () const
 
NodeInfo & GetLastNode ()
 
const NodeInfo & GetLastNode () const
 
const NodeInfoVectorType & GetNodes () const
 Get the complete vector of node infos in this path. More...
 
std::string ToStr () const
 Serialize this path to a string representation. More...
 
DICOMTagPath & FromStr (const std::string &pathStr)
 Parse a string representation and set this path accordingly. More...
 
bool operator== (const DICOMTagPath &path) const
 
bool operator< (const DICOMTagPath &right) const
 
bool Equals (const DICOMTagPath &path) const
 
DICOMTagPath & operator= (const DICOMTagPath &path)
 
DICOMTagPath operator+ (const DICOMTagPath &right) const
 
DICOMTagPath operator+ (const std::string &pathStr) const
 
DICOMTagPath & operator+= (const DICOMTagPath &right)
 
DICOMTagPath & operator+= (const std::string &pathStr)
 
DICOMTagPath & AddAnyElement ()
 Append a wildcard element node (AnyElement) to this path. More...
 
DICOMTagPath & AddElement (unsigned int group, unsigned int element)
 Append a specific element node to this path. More...
 
DICOMTagPath & AddAnySelection (unsigned int group, unsigned int element)
 Append a wildcard selection node (AnySelection) to this path. More...
 
DICOMTagPath & AddSelection (unsigned int group, unsigned int element, ItemSelectionIndex index)
 Append a specific sequence selection node to this path. More...
 
 DICOMTagPath ()
 Default constructor, creates an empty path. More...
 
 DICOMTagPath (const DICOMTagPath &path)
 Copy constructor. More...
 
 DICOMTagPath (const DICOMTag &tag)
 Construct a single-element path from a DICOMTag. More...
 
 DICOMTagPath (unsigned int group, unsigned int element)
 Construct a single-element path from group and element numbers. More...
 
virtual ~DICOMTagPath ()
 
virtual void Reset ()
 Clear all nodes from this path, making it empty. More...
 

Static Protected Member Functions

static bool DICOMTagPathesMatch (const DICOMTagPath &left, const DICOMTagPath &right)
 

Protected Attributes

NodeInfoVectorType m_NodeInfos
 

Detailed Description

Class used to identify (nested) attributes in a DICOM dataset.

In contrast to the class DICOMTag, which only specifies one specific tag, the tag path can identify nested attributes (like items in a DICOM sequence). In addition you may also specify wildcards for the selection index or complete elements of the path.

Note
If you want to keep the DICOMTagPath compatible to the DCMTK search path format, you may not use element wild cards (i.e. IsExplicit() or HasItemSelectionWildcardsOnly() must return true).
See also
DICOMTag, DICOMTagPathToPropertyName, PropertyNameToDICOMTagPath

Definition at line 40 of file mitkDICOMTagPath.h.

Member Typedef Documentation

◆ ItemSelectionIndex

Definition at line 43 of file mitkDICOMTagPath.h.

◆ NodeInfoVectorType

Definition at line 88 of file mitkDICOMTagPath.h.

◆ PathIndexType

typedef NodeInfoVectorType::size_type mitk::DICOMTagPath::PathIndexType

Definition at line 89 of file mitkDICOMTagPath.h.

Constructor & Destructor Documentation

◆ DICOMTagPath() [1/4]

mitk::DICOMTagPath::DICOMTagPath ( )

Default constructor, creates an empty path.

◆ DICOMTagPath() [2/4]

mitk::DICOMTagPath::DICOMTagPath ( const DICOMTagPath &  path)

Copy constructor.

◆ DICOMTagPath() [3/4]

mitk::DICOMTagPath::DICOMTagPath ( const DICOMTag &  tag)

Construct a single-element path from a DICOMTag.

Parameters
[in]tagThe DICOM tag to use as the single path node.

◆ DICOMTagPath() [4/4]

mitk::DICOMTagPath::DICOMTagPath ( unsigned int  group,
unsigned int  element 
)
explicit

Construct a single-element path from group and element numbers.

Parameters
[in]groupThe DICOM tag group number.
[in]elementThe DICOM tag element number.

◆ ~DICOMTagPath()

virtual mitk::DICOMTagPath::~DICOMTagPath ( )
virtual

Member Function Documentation

◆ AddAnyElement()

DICOMTagPath& mitk::DICOMTagPath::AddAnyElement ( )

Append a wildcard element node (AnyElement) to this path.

Returns
Reference to this path.

◆ AddAnySelection()

DICOMTagPath& mitk::DICOMTagPath::AddAnySelection ( unsigned int  group,
unsigned int  element 
)

Append a wildcard selection node (AnySelection) to this path.

Parameters
[in]groupThe DICOM tag group number.
[in]elementThe DICOM tag element number.
Returns
Reference to this path.

◆ AddElement()

DICOMTagPath& mitk::DICOMTagPath::AddElement ( unsigned int  group,
unsigned int  element 
)

Append a specific element node to this path.

Parameters
[in]groupThe DICOM tag group number.
[in]elementThe DICOM tag element number.
Returns
Reference to this path.

◆ AddNode()

PathIndexType mitk::DICOMTagPath::AddNode ( const NodeInfo &  newNode)

Adds a new node to the end of the path.

Parameters
[in]newNodeReference to the node that should be added.
Returns
Returns the index of the newly added node.

◆ AddSelection()

DICOMTagPath& mitk::DICOMTagPath::AddSelection ( unsigned int  group,
unsigned int  element,
ItemSelectionIndex  index 
)

Append a specific sequence selection node to this path.

Parameters
[in]groupThe DICOM tag group number.
[in]elementThe DICOM tag element number.
[in]indexThe item selection index within the sequence.
Returns
Reference to this path.

◆ DICOMTagPathesMatch()

static bool mitk::DICOMTagPath::DICOMTagPathesMatch ( const DICOMTagPath &  left,
const DICOMTagPath &  right 
)
staticprotected

◆ Equals()

bool mitk::DICOMTagPath::Equals ( const DICOMTagPath &  path) const

Checks if to DICOMTagPathes are specify the same node. Hence all wildcards will be processed.
E.G.: "item1/child1/grandChild2" == ".//item1//grandChild2" is true.

Remarks
If you want to check if two paths are "truly" equal and not only equal in terms of pointing to the same node, use the member function Equals()

◆ FromStr()

DICOMTagPath& mitk::DICOMTagPath::FromStr ( const std::string &  pathStr)

Parse a string representation and set this path accordingly.

Parameters
[in]pathStrThe string to parse.
Returns
Reference to this path after parsing.
See also
ToStr

◆ GetFirstNode() [1/2]

NodeInfo& mitk::DICOMTagPath::GetFirstNode ( )

Function returns the node info of the first path node within the DICOMTagPath.

Precondition
DICOMTagPath must not be empty.
Returns
Info of the first path node. If the path is empty, an InvalidPathNode exception will be thrown.

◆ GetFirstNode() [2/2]

const NodeInfo& mitk::DICOMTagPath::GetFirstNode ( ) const

Function returns the node info of the first path node within the DICOMTagPath.

Precondition
DICOMTagPath must not be empty.
Returns
Info of the first path node. If the path is empty, an InvalidPathNode exception will be thrown.

◆ GetLastNode() [1/2]

NodeInfo& mitk::DICOMTagPath::GetLastNode ( )

Function returns the node info of the last path node within the DICOMTagPath.

Precondition
DICOMTagPath must not be empty.
Returns
Info of the first path node. If the path is empty, an InvalidPathNode exception will be thrown.

◆ GetLastNode() [2/2]

const NodeInfo& mitk::DICOMTagPath::GetLastNode ( ) const

Function returns the node info of the last path node within the DICOMTagPath.

Precondition
DICOMTagPath must not be empty.
Returns
Info of the first path node. If the path is empty, an InvalidPathNode exception will be thrown.

◆ GetNode() [1/2]

NodeInfo& mitk::DICOMTagPath::GetNode ( const PathIndexType &  index)

Function returns the node info of a path node specified by the index within the DICOMTagPath.

Precondition
Passed index must not be out of bound.
Parameters
[in]indexIndex of the node whose info should be retrieved.
Returns
Info of the specified path node. If the index is out of bound an InvalidPathNode exception will be thrown.

◆ GetNode() [2/2]

const NodeInfo& mitk::DICOMTagPath::GetNode ( const PathIndexType &  index) const

Function returns the node info of a path node specified by the index within the DICOMTagPath.

Precondition
Passed index must not be out of bound.
Parameters
[in]indexIndex of the node whose info should be retrieved.
Returns
Info of the specified path node. If the index is out of bound an InvalidPathNode exception will be thrown.

◆ GetNodes()

const NodeInfoVectorType& mitk::DICOMTagPath::GetNodes ( ) const

Get the complete vector of node infos in this path.

Returns
Const reference to the internal node info vector.

◆ HasItemSelectionWildcardsOnly()

bool mitk::DICOMTagPath::HasItemSelectionWildcardsOnly ( ) const

Returns if the path has any nodes with item selection wild cards ([*]).

◆ IsEmpty()

bool mitk::DICOMTagPath::IsEmpty ( ) const

Returns if the DICOMTagPath is empty.

◆ IsExplicit()

bool mitk::DICOMTagPath::IsExplicit ( ) const

Returns if the path is explicit (has no wildcards).

◆ operator+() [1/2]

DICOMTagPath mitk::DICOMTagPath::operator+ ( const DICOMTagPath &  right) const

Concatenates two DICOM tag paths.

Parameters
[in]rightThe path to append to this path.
Returns
A new DICOMTagPath containing all nodes from both paths.

◆ operator+() [2/2]

DICOMTagPath mitk::DICOMTagPath::operator+ ( const std::string &  pathStr) const

Concatenates two DICOM tag paths.

Parameters
[in]pathStrThe path to append to this path.
Returns
A new DICOMTagPath containing all nodes from both paths.

◆ operator+=() [1/2]

DICOMTagPath& mitk::DICOMTagPath::operator+= ( const DICOMTagPath &  right)

Appends another path to this path.

Parameters
[in]rightThe path to append.
Returns
Reference to this path.

◆ operator+=() [2/2]

DICOMTagPath& mitk::DICOMTagPath::operator+= ( const std::string &  pathStr)

Appends a string representation of a path to this path.

Parameters
[in]pathStrString representation of a path to append.
Returns
Reference to this path.

◆ operator<()

bool mitk::DICOMTagPath::operator< ( const DICOMTagPath &  right) const

Operation equals like comparing the ToStr() results with operator <.

◆ operator=()

DICOMTagPath& mitk::DICOMTagPath::operator= ( const DICOMTagPath &  path)

◆ operator==()

bool mitk::DICOMTagPath::operator== ( const DICOMTagPath &  path) const

Compares two DICOMTagPaths for real equality. So its a string compare of their string conversion

◆ Reset()

virtual void mitk::DICOMTagPath::Reset ( )
virtual

Clear all nodes from this path, making it empty.

◆ Size()

PathIndexType mitk::DICOMTagPath::Size ( ) const

Number of path nodes the DICOMTagPath contains.

◆ ToStr()

std::string mitk::DICOMTagPath::ToStr ( ) const

Serialize this path to a string representation.

Returns
A string representation of this DICOMTagPath.
See also
FromStr

Member Data Documentation

◆ m_NodeInfos

NodeInfoVectorType mitk::DICOMTagPath::m_NodeInfos
protected

Definition at line 253 of file mitkDICOMTagPath.h.


The documentation for this class was generated from the following file: