Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkDICOMFilenameSorter.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 
18 
19 #include <algorithm>
20 
24 {
25 }
26 
29 {
30 }
31 
34 :DICOMDatasetSorter(other)
35 {
36 }
37 
41 {
42  if (this != &other)
43  {
45  }
46  return *this;
47 }
48 
49 bool
51 ::operator==(const DICOMDatasetSorter& other) const
52 {
53  return dynamic_cast<const DICOMFilenameSorter*>(&other) != nullptr;
54 }
55 
59 {
60  return DICOMTagList();
61 }
62 
63 void
65 ::PrintConfiguration(std::ostream& os, const std::string& indent) const
66 {
67  os << indent << "Sort alphabetically based on filenames" << std::endl;
68 }
69 
70 bool
73 {
74  return left->GetFilenameIfAvailable().compare( right->GetFilenameIfAvailable() ) < 0 ;
75 }
76 
77 void
80 {
81  DICOMDatasetList output = GetInput(); // copy
82 
83  std::sort( output.begin(), output.end(), FilenameSort() );
84 
85  this->SetNumberOfOutputs(1);
86  this->SetOutput(0, output);
87 }
virtual bool operator==(const DICOMDatasetSorter &other) const override
The sorting/splitting building-block of DICOMITKSeriesGDCMReader.
std::vector< DICOMTag > DICOMTagList
Definition: mitkDICOMTag.h:64
virtual void PrintConfiguration(std::ostream &os, const std::string &indent="") const override
Print configuration details into stream.
virtual void Sort() override
Sort input datasets into one or multiple outputs.
Interface to datasets that is presented to sorting classes such as DICOMDatasetSorter.
DICOMFilenameSorter & operator=(const DICOMFilenameSorter &other)
virtual DICOMTagList GetTagsOfInterest() override
sort files based on filename (last resort).
bool operator()(const mitk::DICOMDatasetAccess *left, const mitk::DICOMDatasetAccess *right)
virtual std::string GetFilenameIfAvailable() const =0
Return a filename if possible. If DICOM is not read from file but from somewhere else (network...
DICOMDatasetSorter & operator=(const DICOMDatasetSorter &other)
std::vector< DICOMDatasetAccess * > DICOMDatasetList