Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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  itkNewMacro( DICOMTagBasedSorter )
75 
76 
79  void AddDistinguishingTag( const DICOMTag&, TagValueProcessor* tagValueProcessor = nullptr );
80  DICOMTagList GetDistinguishingTags() const;
81  const TagValueProcessor* GetTagValueProcessorForDistinguishingTag(const DICOMTag&) const;
82 
86  void SetSortCriterion( DICOMSortCriterion::ConstPointer criterion );
87  DICOMSortCriterion::ConstPointer GetSortCriterion() const;
88 
92  DICOMTagList GetTagsOfInterest() override;
93 
113  void SetStrictSorting(bool strict);
114  bool GetStrictSorting() const;
115 
121  void SetExpectDistanceOne(bool strict);
122  bool GetExpectDistanceOne() const;
123 
124 
128  void Sort() override;
129 
133  void PrintConfiguration(std::ostream& os, const std::string& indent = "") const override;
134 
135  bool operator==(const DICOMDatasetSorter& other) const override;
136 
138  {
139  return m_DefaultStrictSorting;
140  }
141 
143  {
144  return m_DefaultExpectDistanceOne;
145  }
146 
147  protected:
148 
153  {
154  ParameterizedDatasetSort(DICOMSortCriterion::ConstPointer);
155  bool operator() (const mitk::DICOMDatasetAccess* left, const mitk::DICOMDatasetAccess* right);
156  DICOMSortCriterion::ConstPointer m_SortCriterion;
157  };
158 
159 
161  ~DICOMTagBasedSorter() override;
162 
164  DICOMTagBasedSorter& operator=(const DICOMTagBasedSorter& other);
165 
169  std::string BuildGroupID( DICOMDatasetAccess* dataset );
170 
171  typedef std::map<std::string, DICOMDatasetList> GroupIDToListType;
172 
178  GroupIDToListType SplitInputGroups();
179 
184  GroupIDToListType& SortGroups(GroupIDToListType& groups);
185 
187  typedef std::map<const DICOMTag, TagValueProcessor*> TagValueProcessorMap;
188  TagValueProcessorMap m_TagValueProcessor;
189 
190  DICOMSortCriterion::ConstPointer m_SortCriterion;
191 
194 
195  const static bool m_DefaultStrictSorting = false;
196  const static bool m_DefaultExpectDistanceOne = false;
197 };
198 
199 }
200 
201 #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...
static mitk::PlanarFigure::Pointer Clone(mitk::PlanarFigure::Pointer original)