Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkDICOMTagPath_h
18 #define mitkDICOMTagPath_h
19 
20 #include <vector>
21 
22 #include <mitkDICOMTag.h>
23 
24 #include <MitkDICOMReaderExports.h>
25 
26 
27 namespace mitk
28 {
39  {
40  public:
41  typedef int ItemSelectionIndex;
42 
44  {
45  enum class NodeType
46  {
47  Invalid = 0, //*< Node is non existant or invalid.
48  Element, //*< Selects an specific element given the node name.
49  SequenceSelection, //*< Selects an specific item in a sequence of items and has a item selector ("[n]").
50  AnySelection, //*< Selects all items of a specific element ("[*]").
51  AnyElement, //*< Selects any element/item. Node name is wildcarded ("*"); item selection as well implictily.
52  };
53 
56  ItemSelectionIndex selection;
57 
58  NodeInfo();
59  NodeInfo(const DICOMTag& tag, NodeType type = NodeType::Element, ItemSelectionIndex index = 0);
60  bool Matches(const NodeInfo& right) const;
61 
62  bool operator == (const NodeInfo& right) const;
63  };
64 
65  typedef std::vector<NodeInfo> NodeInfoVectorType;
66  typedef NodeInfoVectorType::size_type PathIndexType;
67 
69  bool IsEmpty() const;
70 
72  bool IsExplicit() const;
73 
75  bool HasItemSelectionWildcardsOnly() const;
76 
78  PathIndexType Size() const;
79 
83  PathIndexType AddNode(const NodeInfo& newNode);
84 
90  const NodeInfo& GetNode(const PathIndexType& index) const;
91 
97  NodeInfo& GetNode(const PathIndexType& index);
98 
102  NodeInfo& GetFirstNode();
103 
107  const NodeInfo& GetFirstNode() const;
108 
112  NodeInfo& GetLastNode();
113 
117  const NodeInfo& GetLastNode() const;
118 
119  const NodeInfoVectorType& GetNodes() const;
120 
121  std::string ToStr() const;
122 
123  DICOMTagPath& FromStr(const std::string& pathStr);
124 
126  bool operator == (const DICOMTagPath& path) const;
127 
129  bool operator < (const DICOMTagPath& right) const;
130 
135  bool Equals(const DICOMTagPath& path) const;
136 
137  DICOMTagPath& operator = (const DICOMTagPath& path);
138 
139  DICOMTagPath& AddAnyElement();
140  DICOMTagPath& AddElement(unsigned int group, unsigned int element);
141  DICOMTagPath& AddAnySelection(unsigned int group, unsigned int element);
142  DICOMTagPath& AddSelection(unsigned int group, unsigned int element, ItemSelectionIndex index);
143 
144  DICOMTagPath();
145  DICOMTagPath(const DICOMTagPath& path);
146  DICOMTagPath(const DICOMTag& tag);
147  explicit DICOMTagPath(unsigned int group, unsigned int element);
148 
149  ~DICOMTagPath();
150 
151  virtual void Reset();
152 
153  protected:
154  NodeInfoVectorType m_NodeInfos;
155 
156  static bool DICOMTagPathesMatch(const DICOMTagPath& left, const DICOMTagPath& right);
157  };
158 
159  typedef std::vector<DICOMTagPath> DICOMTagPathList;
160 
161  MITKDICOMREADER_EXPORT std::ostream& operator<<(std::ostream& os, const DICOMTagPath& path);
162 
167 
172 
175  MITKDICOMREADER_EXPORT DICOMTagPath PropertyNameToDICOMTagPath(const std::string& propertyName);
178 }
179 
180 #endif
Class is used to identify (nested) attributes in a DICOM dataset. In contrast to the class DICOMTag...
MITKCORE_EXPORT std::ostream & operator<<(std::ostream &o, DataNode::Pointer &dtn)
NodeInfoVectorType m_NodeInfos
MITKDICOMREADER_EXPORT std::string DICOMTagPathToPersistenceKeyRegEx(const DICOMTagPath &tagPath)
Representation of a DICOM tag.
Definition: mitkDICOMTag.h:37
#define MITKDICOMREADER_EXPORT
std::vector< NodeInfo > NodeInfoVectorType
DataCollection - Class to facilitate loading/accessing structured data.
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
MITKDICOMREADER_EXPORT std::string DICOMTagPathToPersistenceNameTemplate(const DICOMTagPath &tagPath)
MITKDICOMREADER_EXPORT std::string DICOMTagPathToPropertyName(const DICOMTagPath &tagPath)
NodeInfoVectorType::size_type PathIndexType
#define AddNode(name)
MITKDICOMREADER_EXPORT std::string DICOMTagPathToPersistenceKeyTemplate(const DICOMTagPath &tagPath)
std::vector< DICOMTagPath > DICOMTagPathList
MITKDICOMREADER_EXPORT std::string DICOMTagPathToPropertyRegEx(const DICOMTagPath &tagPath)
ItemSelectionIndex selection
MITKDICOMREADER_EXPORT std::string DICOMTagPathToDCMTKSearchPath(const DICOMTagPath &tagPath)
MITKDICOMREADER_EXPORT DICOMTagPath PropertyNameToDICOMTagPath(const std::string &propertyName)