Medical Imaging Interaction Toolkit  2018.4.99-87d68d9f
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 (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 
14 
15 #include <algorithm>
16 
20 {
21 }
22 
25 {
26 }
27 
30 :DICOMDatasetSorter(other)
31 {
32 }
33 
37 {
38  if (this != &other)
39  {
41  }
42  return *this;
43 }
44 
45 bool
47 ::operator==(const DICOMDatasetSorter& other) const
48 {
49  return dynamic_cast<const DICOMFilenameSorter*>(&other) != nullptr;
50 }
51 
55 {
56  return DICOMTagList();
57 }
58 
59 void
61 ::PrintConfiguration(std::ostream& os, const std::string& indent) const
62 {
63  os << indent << "Sort alphabetically based on filenames" << std::endl;
64 }
65 
66 bool
69 {
70  return left->GetFilenameIfAvailable().compare( right->GetFilenameIfAvailable() ) < 0 ;
71 }
72 
73 void
76 {
77  DICOMDatasetList output = GetInput(); // copy
78 
79  std::sort( output.begin(), output.end(), FilenameSort() );
80 
81  this->SetNumberOfOutputs(1);
82  this->SetOutput(0, output);
83 }
bool operator==(const DICOMDatasetSorter &other) const override
The sorting/splitting building-block of DICOMITKSeriesGDCMReader.
std::vector< DICOMTag > DICOMTagList
Definition: mitkDICOMTag.h:59
void PrintConfiguration(std::ostream &os, const std::string &indent="") const override
Print configuration details into stream.
void Sort() override
Sort input datasets into one or multiple outputs.
void SetNumberOfOutputs(unsigned int numberOfOutputs)
const DICOMDatasetList & GetInput() const
Input for sorting.
Interface to datasets that is presented to sorting classes such as DICOMDatasetSorter.
DICOMFilenameSorter & operator=(const DICOMFilenameSorter &other)
DICOMTagList GetTagsOfInterest() override
Return the tags of interest (to facilitate scanning)
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...
void SetOutput(unsigned int index, const DICOMDatasetList &output)
DICOMDatasetSorter & operator=(const DICOMDatasetSorter &other)
std::vector< DICOMDatasetAccess * > DICOMDatasetList