# gdcm::Scanner Class Reference

Scanner. More...

`#include <gdcmScanner.h>`

Collaboration diagram for gdcm::Scanner:
[legend]

List of all members.

## Classes
struct | ltstr
## Public Types
typedef MappingType::const_iterator | ConstIterator
typedef std::map< const char *, TagToValue, ltstr > | MappingType
typedef std::map< Tag, const char * > | TagToValue
typedef TagToValue::value_type | TagToValueValueType
typedef std::set< std::string > | ValuesType
## Public Member Functions
| Scanner ()
| ~Scanner ()
void | AddSkipTag (Tag const &t)
| Add a tag that will need to be skipped. Those are root level skip tags.
void | AddTag (Tag const &t)
| Add a tag that will need to be read. Those are root level skip tags.
ConstIterator | Begin () const
void | ClearSkipTags ()
void | ClearTags ()
ConstIterator | End () const
const char * | GetFilenameFromTagToValue (Tag const &t, const char *valueref) const
Directory::FilenamesType const & | GetFilenames () const
Directory::FilenamesType | GetKeys () const
TagToValue const & | GetMapping (const char *filename) const
| Get the std::map mapping filenames to value for file 'filename'.
TagToValue const & | GetMappingFromTagToValue (Tag const &t, const char *value) const
| See GetFilenameFromTagToValue(). This is simply GetFilenameFromTagToValue followed.
MappingType const & | GetMappings () const
| Mappings are the mapping from a particular tag to the map, mapping filename to value:
const char * | GetValue (const char *filename, Tag const &t) const
ValuesType | GetValues (Tag const &t) const
| Get all the values found (in lexicographic order) associated with Tag 't'.
ValuesType const & | GetValues () const
| Get all the values found (in lexicographic order).
bool | IsKey (const char *filename) const
void | Print (std::ostream &os) const
| Print result.
bool | Scan (Directory::FilenamesType const &filenames)
| Start the scan !
## Friends
std::ostream & | operator<< (std::ostream &_os, const Scanner &s)

## Detailed Description

Scanner.

Todo:
  This filter is dealing with both VRASCII and VRBINARY element, thanks to the help of gdcm::StringFilter

Warning:
  : IMPORTANT In case of file where tags are not ordered, the output will be garbage

Note:
  : implementation details. All values are stored in a std::set of std::string. Then the *address* of the cstring underlying the std::string is used in the std::map

Examples:

  SortImage.cxx, and VolumeSorter.cxx.

## Member Typedef Documentation

typedef MappingType::const_iterator gdcm::Scanner::ConstIterator

typedef std::map<const char *,TagToValue, ltstr> gdcm::Scanner::MappingType

typedef std::map<Tag, const char*> gdcm::Scanner::TagToValue

struct to map a filename to a value Implementation note: all std::map in this class will be using const char * and not std::string since we are pointing to existing std::string (hold in a std::vector) this avoid an extra copy of the byte array. Tag are used as Tag class since sizeof(tag) <= sizeof(pointer)

typedef TagToValue::value_type gdcm::Scanner::TagToValueValueType

typedef std::set< std::string > gdcm::Scanner::ValuesType

## Constructor & Destructor Documentation

gdcm::Scanner::Scanner | ( |  | ) | `[inline]`

gdcm::Scanner::~Scanner | ( |  | ) |

## Member Function Documentation

void gdcm::Scanner::AddSkipTag | ( | Tag const & | t | ) |

Add a tag that will need to be skipped. Those are root level skip tags.

void gdcm::Scanner::AddTag | ( | Tag const & | t | ) |

Add a tag that will need to be read. Those are root level skip tags.

Examples:
  SortImage.cxx, and VolumeSorter.cxx.

ConstIterator gdcm::Scanner::Begin | ( |  | ) | const`[inline]`

void gdcm::Scanner::ClearSkipTags | ( |  | ) |

void gdcm::Scanner::ClearTags | ( |  | ) |

ConstIterator gdcm::Scanner::End | ( |  | ) | const`[inline]`

const char* gdcm::Scanner::GetFilenameFromTagToValue | ( | Tag const & | t,
|  | const char * | valueref |
| ) |  |  | const

Will loop over all files and return the first file where value match the reference value 'valueref'

Directory::FilenamesType const& gdcm::Scanner::GetFilenames | ( |  | ) | const`[inline]`

Directory::FilenamesType gdcm::Scanner::GetKeys | ( |  | ) | const

Return the list of filename that are key in the internal map, which means those filename were properly parsed

Examples:
  VolumeSorter.cxx.

TagToValue const& gdcm::Scanner::GetMapping | ( | const char * | filename | ) | const

Get the std::map mapping filenames to value for file 'filename'.

TagToValue const& gdcm::Scanner::GetMappingFromTagToValue | ( | Tag const & | t,
|  | const char * | value |
| ) |  |  | const

See GetFilenameFromTagToValue(). This is simply GetFilenameFromTagToValue followed.

MappingType const& gdcm::Scanner::GetMappings | ( |  | ) | const`[inline]`

Mappings are the mapping from a particular tag to the map, mapping filename to value:

const char* gdcm::Scanner::GetValue | ( | const char * | filename,
|  | Tag const & | t |
| ) |  |  | const

Retrieve the value found for tag: t associated with file: filename This is meant for a single short call. If multiple calls (multiple tags) should be done, prefer the GetMapping function, and then reuse the TagToValue hash table.

Warning:
  Tag 't' should have been added via AddTag() prior to the Scan() call !

ValuesType gdcm::Scanner::GetValues | ( | Tag const & | t | ) | const

Get all the values found (in lexicographic order) associated with Tag 't'.

ValuesType const& gdcm::Scanner::GetValues | ( |  | ) | const`[inline]`

Get all the values found (in lexicographic order).

Examples:
  SortImage.cxx, and VolumeSorter.cxx.

bool gdcm::Scanner::IsKey | ( | const char * | filename | ) | const

Check if filename is a key in the Mapping table. returns true only of file can be found, which means the file was indeed a DICOM file that could be processed

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

Print result.

Referenced by gdcm::operator<<().

bool gdcm::Scanner::Scan | ( | Directory::FilenamesType const & | filenames | ) |

Start the scan !

Examples:
  SortImage.cxx, and VolumeSorter.cxx.

## Friends And Related Function Documentation

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

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

- gdcmScanner.h