Medical Imaging Interaction Toolkit  2018.4.99-9a29ffc6
Medical Imaging Interaction Toolkit
mitkDICOMTagBasedSorter.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 mitkDICOMTagBasedSorter_h
14 #define mitkDICOMTagBasedSorter_h
15 
16 #include "mitkDICOMDatasetSorter.h"
17 #include "mitkDICOMSortCriterion.h"
18 
19 namespace mitk
20 {
21 
41 {
42  public:
43 
49  {
50  public:
52  virtual std::string operator()(const std::string&) const = 0;
53  virtual TagValueProcessor* Clone() const = 0;
54  virtual ~TagValueProcessor() {}
55  };
56 
62  {
63  public:
64  CutDecimalPlaces(unsigned int precision);
65  CutDecimalPlaces(const CutDecimalPlaces& other);
66  unsigned int GetPrecision() const;
67  std::string operator()(const std::string&) const override;
68  TagValueProcessor* Clone() const override;
69  private:
70  unsigned int m_Precision;
71  };
72 
74 
75  itkNewMacro( DICOMTagBasedSorter );
76 
80  void AddDistinguishingTag( const DICOMTag&, TagValueProcessor* tagValueProcessor = nullptr );
81  DICOMTagList GetDistinguishingTags() const;
82  const TagValueProcessor* GetTagValueProcessorForDistinguishingTag(const DICOMTag&) const;
83 
87  void SetSortCriterion( DICOMSortCriterion::ConstPointer criterion );
88  DICOMSortCriterion::ConstPointer GetSortCriterion() const;
89 
93  DICOMTagList GetTagsOfInterest() override;
94 
114  void SetStrictSorting(bool strict);
115  bool GetStrictSorting() const;
116 
122  void SetExpectDistanceOne(bool strict);
123  bool GetExpectDistanceOne() const;
124 
125 
129  void Sort() override;
130 
134  void PrintConfiguration(std::ostream& os, const std::string& indent = "") const override;
135 
136  bool operator==(const DICOMDatasetSorter& other) const override;
137 
139  {
140  return m_DefaultStrictSorting;
141  }
142 
144  {
145  return m_DefaultExpectDistanceOne;
146  }
147 
148  protected:
149 
154  {
155  ParameterizedDatasetSort(DICOMSortCriterion::ConstPointer);
156  bool operator() (const mitk::DICOMDatasetAccess* left, const mitk::DICOMDatasetAccess* right);
157  DICOMSortCriterion::ConstPointer m_SortCriterion;
158  };
159 
160 
162  ~DICOMTagBasedSorter() override;
163 
165  DICOMTagBasedSorter& operator=(const DICOMTagBasedSorter& other);
166 
170  std::string BuildGroupID( DICOMDatasetAccess* dataset );
171 
172  typedef std::map<std::string, DICOMDatasetList> GroupIDToListType;
173 
179  GroupIDToListType SplitInputGroups();
180 
185  GroupIDToListType& SortGroups(GroupIDToListType& groups);
186 
188  typedef std::map<const DICOMTag, TagValueProcessor*> TagValueProcessorMap;
189  TagValueProcessorMap m_TagValueProcessor;
190 
191  DICOMSortCriterion::ConstPointer m_SortCriterion;
192 
195 
196  const static bool m_DefaultStrictSorting = false;
197  const static bool m_DefaultExpectDistanceOne = false;
198 };
199 
200 }
201 
202 #endif
The sorting/splitting building-block of DICOMITKSeriesGDCMReader.
std::map< const DICOMTag, TagValueProcessor * > TagValueProcessorMap
std::vector< DICOMTag > DICOMTagList
Definition: mitkDICOMTag.h:59
Representation of a DICOM tag.
Definition: mitkDICOMTag.h:32
#define MITKDICOMREADER_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
std::map< std::string, DICOMDatasetList > GroupIDToListType
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
Helper struct to feed into std::sort, configured via DICOMSortCriterion.
Interface to datasets that is presented to sorting classes such as DICOMDatasetSorter.
TagValueProcessorMap m_TagValueProcessor
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
DICOMSortCriterion::ConstPointer m_SortCriterion
Cuts a number after configured number of decimal places. An instance of this class can be used to avo...
Sort DICOM datasets based on configurable tags.
Processes tag values before they are compared. These classes could do some kind of normalization such...