Medical Imaging Interaction Toolkit  2016.11.0
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,
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 mitkDICOMTagBasedSorter_h
18 #define mitkDICOMTagBasedSorter_h
19 
20 #include "mitkDICOMDatasetSorter.h"
21 #include "mitkDICOMSortCriterion.h"
22 
23 namespace mitk
24 {
25 
45 {
46  public:
47 
53  {
54  public:
56  virtual std::string operator()(const std::string&) const = 0;
57  virtual TagValueProcessor* Clone() const = 0;
58  virtual ~TagValueProcessor() {}
59  };
60 
66  {
67  public:
68  CutDecimalPlaces(unsigned int precision);
69  CutDecimalPlaces(const CutDecimalPlaces& other);
70  unsigned int GetPrecision() const;
71  virtual std::string operator()(const std::string&) const override;
72  virtual TagValueProcessor* Clone() const override;
73  private:
74  unsigned int m_Precision;
75  };
76 
78  itkNewMacro( DICOMTagBasedSorter )
79 
83  void AddDistinguishingTag( const DICOMTag&, TagValueProcessor* tagValueProcessor = nullptr );
84  DICOMTagList GetDistinguishingTags() const;
85  const TagValueProcessor* GetTagValueProcessorForDistinguishingTag(const DICOMTag&) const;
86 
90  void SetSortCriterion( DICOMSortCriterion::ConstPointer criterion );
91  DICOMSortCriterion::ConstPointer GetSortCriterion() const;
92 
96  virtual DICOMTagList GetTagsOfInterest() override;
97 
117  void SetStrictSorting(bool strict);
118  bool GetStrictSorting() const;
119 
125  void SetExpectDistanceOne(bool strict);
126  bool GetExpectDistanceOne() const;
127 
128 
132  virtual void Sort() override;
133 
137  virtual void PrintConfiguration(std::ostream& os, const std::string& indent = "") const override;
138 
139  virtual bool operator==(const DICOMDatasetSorter& other) const override;
140 
141  protected:
142 
147  {
148  ParameterizedDatasetSort(DICOMSortCriterion::ConstPointer);
149  bool operator() (const mitk::DICOMDatasetAccess* left, const mitk::DICOMDatasetAccess* right);
151  };
152 
153 
155  virtual ~DICOMTagBasedSorter();
156 
158  DICOMTagBasedSorter& operator=(const DICOMTagBasedSorter& other);
159 
163  std::string BuildGroupID( DICOMDatasetAccess* dataset );
164 
165  typedef std::map<std::string, DICOMDatasetList> GroupIDToListType;
166 
172  GroupIDToListType SplitInputGroups();
173 
178  GroupIDToListType& SortGroups(GroupIDToListType& groups);
179 
181  typedef std::map<const DICOMTag, TagValueProcessor*> TagValueProcessorMap;
182  TagValueProcessorMap m_TagValueProcessor;
183 
185 
188 };
189 
190 }
191 
192 #endif
Pointer Clone() const
The sorting/splitting building-block of DICOMITKSeriesGDCMReader.
std::map< const DICOMTag, TagValueProcessor * > TagValueProcessorMap
std::vector< DICOMTag > DICOMTagList
Definition: mitkDICOMTag.h:64
Representation of a DICOM tag.
Definition: mitkDICOMTag.h:37
#define MITKDICOMREADER_EXPORT
STL namespace.
DataCollection - Class to facilitate loading/accessing structured data.
std::map< std::string, DICOMDatasetList > GroupIDToListType
itk::SmartPointer< const Self > ConstPointer
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:44
DICOMSortCriterion::ConstPointer m_SortCriterion
Cuts a number after configured number of decimal places. An instance of this class can be used to avo...
A tag based sorting criterion for use in DICOMTagBasedSorter.
Sort DICOM datasets based on configurable tags.
Processes tag values before they are compared. These classes could do some kind of normalization such...