gdcmSorter.h
Go to the documentation of this file.
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef GDCMSORTER_H
#define GDCMSORTER_H
#include "gdcmDirectory.h"
#include "gdcmTag.h"
#include <vector>
#include <string>
#include <map>
#include <set>
namespace gdcm
{
class DataSet;
class GDCM_EXPORT Sorter
{
friend std::ostream& operator<<(std::ostream &_os, const Sorter &s);
public:
Sorter();
virtual ~Sorter();
virtual bool Sort(std::vector<std::string> const & filenames);
const std::vector<std::string> &GetFilenames() const { return Filenames; }
void Print(std::ostream &os) const;
bool AddSelect( Tag const &tag, const char *value );
void SetTagsToRead( std::set<Tag> const & tags );
typedef bool (*SortFunction)(DataSet const &, DataSet const &);
void SetSortFunction( SortFunction f );
virtual bool StableSort(std::vector<std::string> const & filenames);
protected:
std::vector<std::string> Filenames;
typedef std::map<Tag,std::string> SelectionMap;
std::map<Tag,std::string> Selection;
SortFunction SortFunc;
std::set<Tag> TagsToRead;
};
//-----------------------------------------------------------------------------
inline std::ostream& operator<<(std::ostream &os, const Sorter &s)
{
s.Print( os );
return os;
}
} // end namespace gdcm
#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