GDCM  2.2.6
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 
24 namespace gdcm
25 {
26 class DataSet;
27 
39 {
40  friend std::ostream& operator<<(std::ostream &_os, const Sorter &s);
41 public:
42  Sorter();
43  virtual ~Sorter();
44 
46  virtual bool Sort(std::vector<std::string> const & filenames);
47 
50  const std::vector<std::string> &GetFilenames() const { return Filenames; }
51 
53  void Print(std::ostream &os) const;
54 
56  bool AddSelect( Tag const &tag, const char *value );
57 
59  typedef bool (*SortFunction)(DataSet const &, DataSet const &);
60  void SetSortFunction( SortFunction f );
61 
62  virtual bool StableSort(std::vector<std::string> const & filenames);
63 
64 protected:
65  std::vector<std::string> Filenames;
66  typedef std::map<Tag,std::string> SelectionMap;
67  std::map<Tag,std::string> Selection;
68  SortFunction SortFunc;
69 };
70 //-----------------------------------------------------------------------------
71 inline std::ostream& operator<<(std::ostream &os, const Sorter &s)
72 {
73  s.Print( os );
74  return os;
75 }
76 
77 
78 } // end namespace gdcm
79 
80 #endif //GDCMSORTER_H
Class to represent a Data Set (which contains Data Elements) A Data Set represents an instance of a r...
Definition: gdcmDataSet.h:55
Sorter General class to do sorting using a custom function You simply need to provide a function of t...
Definition: gdcmSorter.h:38
SortFunction SortFunc
Definition: gdcmSorter.h:68
std::map< Tag, std::string > SelectionMap
Definition: gdcmSorter.h:66
const std::vector< std::string > & GetFilenames() const
Definition: gdcmSorter.h:50
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition: gdcmDirectory.h:92
void Print(std::ostream &os) const
Print.
std::map< Tag, std::string > Selection
Definition: gdcmSorter.h:67
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element). Basically an uint32_t which...
Definition: gdcmTag.h:38
std::vector< std::string > Filenames
Definition: gdcmSorter.h:65

Generated on Sat Dec 21 2013 05:56:17 for GDCM by doxygen 1.8.5
SourceForge.net Logo