# gdcm::Sorter Class Reference

Sorter General class to do sorting using a custom function You simply need to provide a function of type: Sorter::SortFunction. More...

`#include <gdcmSorter.h>`

Inheritance diagram for gdcm::Sorter:
[legend]
Collaboration diagram for gdcm::Sorter:
[legend]

List of all members.

## Public Types

typedef bool(* | SortFunction )(DataSet const &, DataSet const &)
| Set the sort function which compares one dataset to the other.

## Public Member Functions

| Sorter ()
virtual | ~Sorter ()
bool | AddSelect (Tag const &tag, const char *value)
| UNSUPPORTED FOR NOW.
const std::vector< std::string > & | GetFilenames () const
void | Print (std::ostream &os) const
| Print.
void | SetSortFunction (SortFunction f)
virtual bool | Sort (std::vector< std::string > const &filenames)
| Typically the output of gdcm::Directory::GetFilenames()
virtual bool | StableSort (std::vector< std::string > const &filenames)

## Protected Types

typedef std::map< Tag, std::string > | SelectionMap

## Protected Attributes

std::vector< std::string > | Filenames
std::map< Tag, std::string > | Selection
SortFunction | SortFunc

## Friends

std::ostream & | operator<< (std::ostream &_os, const Sorter &s)

## Detailed Description

Sorter General class to do sorting using a custom function You simply need to provide a function of type: Sorter::SortFunction.

Warning:
  implementation details. For now there is no cache mechanism. Which means that everytime you call Sort, all files specified as input paramater are *read*

See also:
  Scanner

Examples:

  SortImage.cxx, and VolumeSorter.cxx.

## Member Typedef Documentation

typedef std::map<Tag,std::string> gdcm::Sorter::SelectionMap`[protected]`

typedef bool(* gdcm::Sorter::SortFunction)(DataSet const &, DataSet const &)

Set the sort function which compares one dataset to the other.

## Constructor & Destructor Documentation

gdcm::Sorter::Sorter | ( |  | ) |

virtual gdcm::Sorter::~Sorter | ( |  | ) | `[virtual]`

## Member Function Documentation

bool gdcm::Sorter::AddSelect | ( | Tag const & | tag,
|  | const char * | value
| ) |  |

UNSUPPORTED FOR NOW.

const std::vector<std::string>& gdcm::Sorter::GetFilenames | ( |  | ) | const`[inline]`

Return the list of filenames as sorted by the specific algorithm used. Empty by default (before Sort() is called)

Examples:
  gdcmorthoplanes.cxx, reslicesphere.cxx, SortImage.cxx, and VolumeSorter.cxx.

void gdcm::Sorter::Print | ( | std::ostream & | os | ) | const

Print.

Examples:
  gdcmorthoplanes.cxx, SortImage.cxx, and VolumeSorter.cxx.

Referenced by gdcm::operator<<().

void gdcm::Sorter::SetSortFunction | ( | SortFunction | f | ) |

Examples:
  SortImage.cxx, and VolumeSorter.cxx.

virtual bool gdcm::Sorter::Sort | ( | std::vector< std::string > const & | filenames | ) | `[virtual]`

Typically the output of gdcm::Directory::GetFilenames()

Reimplemented in gdcm::IPPSorter.

Examples:
  SortImage.cxx.

virtual bool gdcm::Sorter::StableSort | ( | std::vector< std::string > const & | filenames | ) | `[virtual]`

Examples:
  SortImage.cxx, and VolumeSorter.cxx.

## Friends And Related Function Documentation

std::ostream& operator<< | ( | std::ostream & | _os,
|  | const Sorter & | s
| ) |  | `[friend]`

## Member Data Documentation

std::vector<std::string> gdcm::Sorter::Filenames`[protected]`

std::map<Tag,std::string> gdcm::Sorter::Selection`[protected]`

SortFunction gdcm::Sorter::SortFunc`[protected]`

The documentation for this class was generated from the following file:

- gdcmSorter.h