Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkDICOMTagPath.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkDICOMTagPath_h
14 #define mitkDICOMTagPath_h
15 
16 #include <vector>
17 
18 #include <mitkDICOMTag.h>
19 
20 #include <MitkDICOMExports.h>
21 
22 
23 namespace mitk
24 {
41  {
42  public:
43  typedef int ItemSelectionIndex;
44 
47  {
49  enum class NodeType
50  {
51  Invalid = 0,
52  Element,
53  SequenceSelection,
54  AnySelection,
55  AnyElement,
56  };
57 
61 
64 
71  NodeInfo(const DICOMTag& tag, NodeType type = NodeType::Element, ItemSelectionIndex index = 0);
72 
78  bool Matches(const NodeInfo& right) const;
79 
85  bool operator == (const NodeInfo& right) const;
86  };
87 
88  typedef std::vector<NodeInfo> NodeInfoVectorType;
89  typedef NodeInfoVectorType::size_type PathIndexType;
90 
92  bool IsEmpty() const;
93 
95  bool IsExplicit() const;
96 
99 
102 
106  PathIndexType AddNode(const NodeInfo& newNode);
107 
113  const NodeInfo& GetNode(const PathIndexType& index) const;
114 
121 
126 
130  const NodeInfo& GetFirstNode() const;
131 
136 
140  const NodeInfo& GetLastNode() const;
141 
146  const NodeInfoVectorType& GetNodes() const;
147 
153  std::string ToStr() const;
154 
161  DICOMTagPath& FromStr(const std::string& pathStr);
162 
164  bool operator == (const DICOMTagPath& path) const;
165 
167  bool operator < (const DICOMTagPath& right) const;
168 
173  bool Equals(const DICOMTagPath& path) const;
174 
175  DICOMTagPath& operator = (const DICOMTagPath& path);
176 
180  DICOMTagPath operator + (const DICOMTagPath& right) const;
181 
185  DICOMTagPath operator + (const std::string& pathStr) const;
186 
190  DICOMTagPath& operator += (const DICOMTagPath& right);
191 
195  DICOMTagPath& operator += (const std::string& pathStr);
196 
202 
209  DICOMTagPath& AddElement(unsigned int group, unsigned int element);
210 
217  DICOMTagPath& AddAnySelection(unsigned int group, unsigned int element);
218 
226  DICOMTagPath& AddSelection(unsigned int group, unsigned int element, ItemSelectionIndex index);
227 
230 
233 
238  DICOMTagPath(const DICOMTag& tag);
239 
245  explicit DICOMTagPath(unsigned int group, unsigned int element);
246 
247  virtual ~DICOMTagPath();
248 
250  virtual void Reset();
251 
252  protected:
254 
255  static bool DICOMTagPathesMatch(const DICOMTagPath& left, const DICOMTagPath& right);
256  };
257 
259  typedef std::vector<DICOMTagPath> DICOMTagPathList;
260 
262  MITKDICOM_EXPORT std::ostream& operator<<(std::ostream& os, const DICOMTagPath& path);
263 
268  MITKDICOM_EXPORT DICOMTagPath operator + (const std::string& pathStr, const DICOMTagPath& right);
269 
276 
283 
290 
297 
302 
305  MITKDICOM_EXPORT DICOMTagPath PropertyNameToDICOMTagPath(const std::string& propertyName);
306 
309 
319  const DICOMTagPath& tagPath,
320  bool includeTagNumbers = false);
321 }
322 
323 #endif
#define MITKDICOM_EXPORT
Class used to identify (nested) attributes in a DICOM dataset.
std::vector< NodeInfo > NodeInfoVectorType
std::string ToStr() const
Serialize this path to a string representation.
DICOMTagPath(const DICOMTagPath &path)
Copy constructor.
NodeInfoVectorType::size_type PathIndexType
NodeInfo & GetNode(const PathIndexType &index)
DICOMTagPath()
Default constructor, creates an empty path.
PathIndexType AddNode(const NodeInfo &newNode)
DICOMTagPath(const DICOMTag &tag)
Construct a single-element path from a DICOMTag.
NodeInfo & GetLastNode()
bool Equals(const DICOMTagPath &path) const
DICOMTagPath & AddElement(unsigned int group, unsigned int element)
Append a specific element node to this path.
virtual void Reset()
Clear all nodes from this path, making it empty.
bool HasItemSelectionWildcardsOnly() const
NodeInfo & GetFirstNode()
NodeInfoVectorType m_NodeInfos
DICOMTagPath & AddAnySelection(unsigned int group, unsigned int element)
Append a wildcard selection node (AnySelection) to this path.
const NodeInfoVectorType & GetNodes() const
Get the complete vector of node infos in this path.
bool IsExplicit() const
DICOMTagPath & AddSelection(unsigned int group, unsigned int element, ItemSelectionIndex index)
Append a specific sequence selection node to this path.
const NodeInfo & GetNode(const PathIndexType &index) const
static bool DICOMTagPathesMatch(const DICOMTagPath &left, const DICOMTagPath &right)
bool IsEmpty() const
PathIndexType Size() const
DICOMTagPath(unsigned int group, unsigned int element)
Construct a single-element path from group and element numbers.
const NodeInfo & GetFirstNode() const
virtual ~DICOMTagPath()
DICOMTagPath & AddAnyElement()
Append a wildcard element node (AnyElement) to this path.
DICOMTagPath & FromStr(const std::string &pathStr)
Parse a string representation and set this path accordingly.
const NodeInfo & GetLastNode() const
Representation of a DICOM tag.
Definition: mitkDICOMTag.h:33
bool operator<(const StaticParameterMap::ValueType &a, const StaticParameterMap::ValueType &b)
Compares two value lists by their first element.
Find image slices visible on a given plane.
MITKDICOM_EXPORT std::string DICOMTagPathToPropertyName(const DICOMTagPath &tagPath)
MITKDICOM_EXPORT std::string DICOMTagPathToPersistenceNameTemplate(const DICOMTagPath &tagPath)
Convert a DICOMTagPath to a persistence name template string.
MITKDICOM_EXPORT std::string DICOMTagPathToDCMTKSearchPath(const DICOMTagPath &tagPath)
MITKDICOM_EXPORT DICOMTagPath PropertyNameToDICOMTagPath(const std::string &propertyName)
MITKCORE_EXPORT std::ostream & operator<<(std::ostream &o, DataNode::Pointer &dtn)
Stream output operator for DataNode smart pointers.
MITKDICOM_EXPORT DICOMTagPath operator+(const std::string &pathStr, const DICOMTagPath &right)
Concatenates a string with a DICOM tag path (reverse order).
MITKDICOM_EXPORT std::string DICOMTagPathToPersistenceKeyRegEx(const DICOMTagPath &tagPath)
Convert a DICOMTagPath to a regular expression for persistence key matching.
MITKDICOM_EXPORT std::string DICOMTagPathToPropertyRegEx(const DICOMTagPath &tagPath)
Convert a DICOMTagPath to a regular expression that matches the corresponding property name.
MITKDICOM_EXPORT std::string DICOMTagPathToPersistenceKeyTemplate(const DICOMTagPath &tagPath)
Convert a DICOMTagPath to a persistence key template string.
std::vector< DICOMTagPath > DICOMTagPathList
A list of DICOMTagPath instances.
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
MITKDICOM_EXPORT std::string DICOMTagPathToReadableName(const DICOMTagPath &tagPath, bool includeTagNumbers=false)
Describes a single node within a DICOMTagPath.
NodeType
Defines the type of a path node.
ItemSelectionIndex selection
The item selection index (for SequenceSelection nodes).
bool Matches(const NodeInfo &right) const
Check whether this node matches another node (respecting wildcards).
NodeInfo()
Default constructor, creates an Invalid node.
NodeType type
The type of this node.
DICOMTag tag
The DICOM tag this node refers to.
NodeInfo(const DICOMTag &tag, NodeType type=NodeType::Element, ItemSelectionIndex index=0)
Construct a node info with specified tag, type, and optional selection index.