Medical Imaging Interaction Toolkit  2025.12.02
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 {
35  {
36  public:
37  typedef int ItemSelectionIndex;
38 
40  {
41  enum class NodeType
42  {
43  Invalid = 0, //*< Node is non existent or invalid.
44  Element, //*< Selects an specific element given the node name.
45  SequenceSelection, //*< Selects an specific item in a sequence of items and has a item selector ("[n]").
46  AnySelection, //*< Selects all items of a specific element ("[*]").
47  AnyElement, //*< Selects any element/item. Node name is wildcarded ("*"); item selection as well implictily.
48  };
49 
53 
55  NodeInfo(const DICOMTag& tag, NodeType type = NodeType::Element, ItemSelectionIndex index = 0);
56  bool Matches(const NodeInfo& right) const;
57 
58  bool operator == (const NodeInfo& right) const;
59  };
60 
61  typedef std::vector<NodeInfo> NodeInfoVectorType;
62  typedef NodeInfoVectorType::size_type PathIndexType;
63 
65  bool IsEmpty() const;
66 
68  bool IsExplicit() const;
69 
72 
75 
79  PathIndexType AddNode(const NodeInfo& newNode);
80 
86  const NodeInfo& GetNode(const PathIndexType& index) const;
87 
93  NodeInfo& GetNode(const PathIndexType& index);
94 
99 
103  const NodeInfo& GetFirstNode() const;
104 
109 
113  const NodeInfo& GetLastNode() const;
114 
115  const NodeInfoVectorType& GetNodes() const;
116 
117  std::string ToStr() const;
118 
119  DICOMTagPath& FromStr(const std::string& pathStr);
120 
122  bool operator == (const DICOMTagPath& path) const;
123 
125  bool operator < (const DICOMTagPath& right) const;
126 
131  bool Equals(const DICOMTagPath& path) const;
132 
133  DICOMTagPath& operator = (const DICOMTagPath& path);
134 
138  DICOMTagPath operator + (const DICOMTagPath& right) const;
139 
143  DICOMTagPath operator + (const std::string& pathStr) const;
144 
148  DICOMTagPath& operator += (const DICOMTagPath& right);
149 
153  DICOMTagPath& operator += (const std::string& pathStr);
154 
156  DICOMTagPath& AddElement(unsigned int group, unsigned int element);
157  DICOMTagPath& AddAnySelection(unsigned int group, unsigned int element);
158  DICOMTagPath& AddSelection(unsigned int group, unsigned int element, ItemSelectionIndex index);
159 
162  DICOMTagPath(const DICOMTag& tag);
163  explicit DICOMTagPath(unsigned int group, unsigned int element);
164 
165  virtual ~DICOMTagPath();
166 
167  virtual void Reset();
168 
169  protected:
171 
172  static bool DICOMTagPathesMatch(const DICOMTagPath& left, const DICOMTagPath& right);
173  };
174 
175  typedef std::vector<DICOMTagPath> DICOMTagPathList;
176 
177  MITKDICOM_EXPORT std::ostream& operator<<(std::ostream& os, const DICOMTagPath& path);
178 
183  MITKDICOM_EXPORT DICOMTagPath operator + (const std::string& pathStr, const DICOMTagPath& right);
184 
189 
194 
197  MITKDICOM_EXPORT DICOMTagPath PropertyNameToDICOMTagPath(const std::string& propertyName);
198 
201 
211  const DICOMTagPath& tagPath,
212  bool includeTagNumbers = false);
213 }
214 
215 #endif
#define MITKDICOM_EXPORT
Class is used to identify (nested) attributes in a DICOM dataset. In contrast to the class DICOMTag,...
std::vector< NodeInfo > NodeInfoVectorType
std::string ToStr() const
DICOMTagPath(const DICOMTagPath &path)
NodeInfoVectorType::size_type PathIndexType
NodeInfo & GetNode(const PathIndexType &index)
PathIndexType AddNode(const NodeInfo &newNode)
DICOMTagPath(const DICOMTag &tag)
NodeInfo & GetLastNode()
bool Equals(const DICOMTagPath &path) const
DICOMTagPath & AddElement(unsigned int group, unsigned int element)
virtual void Reset()
bool HasItemSelectionWildcardsOnly() const
NodeInfo & GetFirstNode()
NodeInfoVectorType m_NodeInfos
DICOMTagPath & AddAnySelection(unsigned int group, unsigned int element)
const NodeInfoVectorType & GetNodes() const
bool IsExplicit() const
DICOMTagPath & AddSelection(unsigned int group, unsigned int element, ItemSelectionIndex index)
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)
const NodeInfo & GetFirstNode() const
virtual ~DICOMTagPath()
DICOMTagPath & AddAnyElement()
DICOMTagPath & FromStr(const std::string &pathStr)
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 var lists and returns true if the first list's first item is lower than the second one's...
Find image slices visible on a given plane.
MITKDICOM_EXPORT std::string DICOMTagPathToPropertyName(const DICOMTagPath &tagPath)
MITKDICOM_EXPORT std::string DICOMTagPathToPersistenceNameTemplate(const DICOMTagPath &tagPath)
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)
MITKDICOM_EXPORT DICOMTagPath operator+(const std::string &pathStr, const DICOMTagPath &right)
MITKDICOM_EXPORT std::string DICOMTagPathToPersistenceKeyRegEx(const DICOMTagPath &tagPath)
MITKDICOM_EXPORT std::string DICOMTagPathToPropertyRegEx(const DICOMTagPath &tagPath)
MITKDICOM_EXPORT std::string DICOMTagPathToPersistenceKeyTemplate(const DICOMTagPath &tagPath)
std::vector< DICOMTagPath > DICOMTagPathList
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
MITKDICOM_EXPORT std::string DICOMTagPathToReadableName(const DICOMTagPath &tagPath, bool includeTagNumbers=false)
ItemSelectionIndex selection
bool Matches(const NodeInfo &right) const
NodeInfo(const DICOMTag &tag, NodeType type=NodeType::Element, ItemSelectionIndex index=0)