Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkDICOMSortCriterion.cpp
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 #include "mitkDICOMSortCriterion.h"
14 
16 ::DICOMSortCriterion(DICOMSortCriterion::Pointer secondaryCriterion)
17 :itk::LightObject()
18 ,m_SecondaryCriterion(secondaryCriterion)
19 {
20 }
21 
24 {
25 }
26 
29 :itk::LightObject()
31 {
32 }
33 
37 {
38  if (this != &other)
39  {
41  }
42  return *this;
43 }
44 
45 mitk::DICOMSortCriterion::ConstPointer
48 {
49  return m_SecondaryCriterion.GetPointer();
50 }
51 
55 {
56  DICOMTagList allTags;
57 
58  // iterate all secondary criteria, return all tags
59  const DICOMSortCriterion* criterionToCheck = this;
60  while (criterionToCheck)
61  {
62  DICOMTagList newElements = criterionToCheck->GetTagsOfInterest();
63  allTags.insert( allTags.end(), newElements.begin(), newElements.end() ); // append
64  criterionToCheck = criterionToCheck->m_SecondaryCriterion.GetPointer();
65  }
66 
67  return allTags;
68 }
69 
70 bool
73 {
74  if (m_SecondaryCriterion.IsNotNull())
75  {
76  return m_SecondaryCriterion->IsLeftBeforeRight(left, right);
77  }
78  else
79  {
80  return (void*)left < (void*)right;
81  }
82 }
std::vector< DICOMTag > DICOMTagList
Definition: mitkDICOMTag.h:59
DICOMTagList GetAllTagsOfInterest() const
Tags used for comparison (includes seconary criteria).
DICOMSortCriterion::Pointer m_SecondaryCriterion
DICOMSortCriterion & operator=(const DICOMSortCriterion &other)
Interface to datasets that is presented to sorting classes such as DICOMDatasetSorter.
DICOMSortCriterion(DICOMSortCriterion::Pointer secondaryCriterion)
bool NextLevelIsLeftBeforeRight(const mitk::DICOMDatasetAccess *left, const mitk::DICOMDatasetAccess *right) const
A tag based sorting criterion for use in DICOMTagBasedSorter.
virtual DICOMTagList GetTagsOfInterest() const =0
Tags used for comparison.
DICOMSortCriterion::ConstPointer GetSecondaryCriterion() const
The fallback criterion.