GDCM 3.2.1

gdcmSorter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13=========================================================================*/
14#ifndef GDCMSORTER_H
15#define GDCMSORTER_H
16
17#include "gdcmDirectory.h"
18#include "gdcmTag.h"
19
20#include <vector>
21#include <string>
22#include <map>
23#include <set>
24
25 namespace gdcm
26{
27 class DataSet;
28
39 class GDCM_EXPORT Sorter
40{
41 friend std::ostream& operator<<(std::ostream &_os, const Sorter &s);
42 public:
43 Sorter();
44 virtual ~Sorter();
45
47 virtual bool Sort(std::vector<std::string> const & filenames);
48
51 const std::vector<std::string> &GetFilenames() const { return Filenames; }
52
54 void Print(std::ostream &os) const;
55
57 bool AddSelect( Tag const &tag, const char *value );
58
62 void SetTagsToRead( std::set<Tag> const & tags );
63
65 typedef bool (*SortFunction)(DataSet const &, DataSet const &);
66 void SetSortFunction( SortFunction f );
67
68 virtual bool StableSort(std::vector<std::string> const & filenames);
69
70 protected:
71 std::vector<std::string> Filenames;
72 typedef std::map<Tag,std::string> SelectionMap;
73 std::map<Tag,std::string> Selection;
74 SortFunction SortFunc;
75 std::set<Tag> TagsToRead;
76};
77//-----------------------------------------------------------------------------
78 inline std::ostream& operator<<(std::ostream &os, const Sorter &s)
79{
80 s.Print( os );
81 return os;
82}
83
84
85} // end namespace gdcm
86
87#endif //GDCMSORTER_H
gdcm::DataSet
Class to represent a Data Set (which contains Data Elements)
Definition gdcmDataSet.h:56
gdcm::Sorter::SetSortFunction
void SetSortFunction(SortFunction f)
gdcm::Sorter::TagsToRead
std::set< Tag > TagsToRead
Definition gdcmSorter.h:75
gdcm::Sorter::Selection
std::map< Tag, std::string > Selection
Definition gdcmSorter.h:73
gdcm::Sorter::SetTagsToRead
void SetTagsToRead(std::set< Tag > const &tags)
gdcm::Sorter::SelectionMap
std::map< Tag, std::string > SelectionMap
Definition gdcmSorter.h:72
gdcm::Sorter::GetFilenames
const std::vector< std::string > & GetFilenames() const
Definition gdcmSorter.h:51
gdcm::Sorter::AddSelect
bool AddSelect(Tag const &tag, const char *value)
UNSUPPORTED FOR NOW.
gdcm::Sorter::SortFunc
SortFunction SortFunc
Definition gdcmSorter.h:74
gdcm::Sorter::Sorter
Sorter()
gdcm::Sorter::Sort
virtual bool Sort(std::vector< std::string > const &filenames)
Typically the output of Directory::GetFilenames()
gdcm::Sorter::Filenames
std::vector< std::string > Filenames
Definition gdcmSorter.h:71
gdcm::Sorter::~Sorter
virtual ~Sorter()
gdcm::Sorter::SortFunction
bool(* SortFunction)(DataSet const &, DataSet const &)
Set the sort function which compares one dataset to the other.
Definition gdcmSorter.h:65
gdcm::Sorter::Print
void Print(std::ostream &os) const
Print.
gdcm::Sorter::StableSort
virtual bool StableSort(std::vector< std::string > const &filenames)
gdcm::Sorter::operator<<
friend std::ostream & operator<<(std::ostream &_os, const Sorter &s)
Definition gdcmSorter.h:78
gdcm::Tag
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).
Definition gdcmTag.h:39
gdcmDirectory.h
gdcmTag.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21
gdcm::operator<<
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88