GDCM 3.0.24
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
25namespace gdcm
26{
27class DataSet;
28
40{
41 friend std::ostream& operator<<(std::ostream &_os, const Sorter &s);
42public:
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
70protected:
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//-----------------------------------------------------------------------------
78inline 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
Class to represent a Data Set (which contains Data Elements)
Definition gdcmDataSet.h:56
Sorter.
Definition gdcmSorter.h:40
void SetSortFunction(SortFunction f)
std::set< Tag > TagsToRead
Definition gdcmSorter.h:75
std::map< Tag, std::string > Selection
Definition gdcmSorter.h:73
void SetTagsToRead(std::set< Tag > const &tags)
std::map< Tag, std::string > SelectionMap
Definition gdcmSorter.h:72
const std::vector< std::string > & GetFilenames() const
Definition gdcmSorter.h:51
bool AddSelect(Tag const &tag, const char *value)
UNSUPPORTED FOR NOW.
SortFunction SortFunc
Definition gdcmSorter.h:74
virtual bool Sort(std::vector< std::string > const &filenames)
Typically the output of Directory::GetFilenames()
std::vector< std::string > Filenames
Definition gdcmSorter.h:71
virtual ~Sorter()
void Print(std::ostream &os) const
Print.
virtual bool StableSort(std::vector< std::string > const &filenames)
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).
Definition gdcmTag.h:39
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88