Medical Imaging Interaction Toolkit  2016.11.0
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,
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 #include "mitkDICOMSortCriterion.h"
18 
21 :itk::LightObject()
22 ,m_SecondaryCriterion(secondaryCriterion)
23 {
24 }
25 
28 {
29 }
30 
33 :itk::LightObject()
34 ,m_SecondaryCriterion(other.m_SecondaryCriterion)
35 {
36 }
37 
41 {
42  if (this != &other)
43  {
44  m_SecondaryCriterion = other.m_SecondaryCriterion;
45  }
46  return *this;
47 }
48 
52 {
53  return m_SecondaryCriterion.GetPointer();
54 }
55 
59 {
60  DICOMTagList allTags;
61 
62  // iterate all secondary criteria, return all tags
63  const DICOMSortCriterion* criterionToCheck = this;
64  while (criterionToCheck)
65  {
66  DICOMTagList newElements = criterionToCheck->GetTagsOfInterest();
67  allTags.insert( allTags.end(), newElements.begin(), newElements.end() ); // append
68  criterionToCheck = criterionToCheck->m_SecondaryCriterion.GetPointer();
69  }
70 
71  return allTags;
72 }
73 
74 bool
77 {
78  if (m_SecondaryCriterion.IsNotNull())
79  {
80  return m_SecondaryCriterion->IsLeftBeforeRight(left, right);
81  }
82  else
83  {
84  return (void*)left < (void*)right;
85  }
86 }
DICOMSortCriterion::ConstPointer GetSecondaryCriterion() const
The fallback criterion.
itk::SmartPointer< Self > Pointer
std::vector< DICOMTag > DICOMTagList
Definition: mitkDICOMTag.h:64
DICOMSortCriterion::Pointer m_SecondaryCriterion
DICOMSortCriterion & operator=(const DICOMSortCriterion &other)
itk::SmartPointer< const Self > ConstPointer
Interface to datasets that is presented to sorting classes such as DICOMDatasetSorter.
DICOMSortCriterion(DICOMSortCriterion::Pointer secondaryCriterion)
DICOMTagList GetAllTagsOfInterest() const
Tags used for comparison (includes seconary criteria).
A tag based sorting criterion for use in DICOMTagBasedSorter.
virtual DICOMTagList GetTagsOfInterest() const =0
Tags used for comparison.
bool NextLevelIsLeftBeforeRight(const mitk::DICOMDatasetAccess *left, const mitk::DICOMDatasetAccess *right) const