# gdcm::Scanner Class Reference

Scanner This filter is meant for quickly browsing a FileSet (a set of files on disk). Special consideration are taken so as to read the mimimum amount of information in each file in order to retrieve the user specified set of DICOM Attribute. More...

`#include <gdcmScanner.h>`

Inheritance diagram for gdcm::Scanner:
[legend]
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 | AddPrivateTag (PrivateTag const &t)
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
Directory::FilenamesType | GetAllFilenamesFromTagToValue (Tag const &t, const char *valueref) 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:
Directory::FilenamesType | GetOrderedValues (Tag const &t) const
const char * | GetValue (const char *filename, Tag const &t) const
ValuesType const & | GetValues () const
| Get all the values found (in lexicographic order)
ValuesType | GetValues (Tag const &t) const
| Get all the values found (in lexicographic order) associated with Tag 't'.
bool | IsKey (const char *filename) const
void | Print (std::ostream &os) const
| Print result.
bool | Scan (Directory::FilenamesType const &filenames)
| Start the scan !

## Static Public Member Functions

static SmartPointer< Scanner > | New ()
| for wrapped language: instanciate a reference counted object

## Protected Member Functions

void | ProcessPublicTag (StringFilter &sf, const char *filename)

## Friends

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

## Detailed Description

Scanner This filter is meant for quickly browsing a FileSet (a set of files on disk). Special consideration are taken so as to read the mimimum amount of information in each file in order to retrieve the user specified set of DICOM Attribute.

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 (illegal as per DICOM specification), the output will be missing information

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.

This class implement the Subject/Observer pattern trigger the following events:

- ProgressEvent
- StartEvent
- EndEvent

Examples:

  DiscriminateVolume.cxx, DumpToSQLITE3.cxx, SimpleScanner.cxx, 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::AddPrivateTag | ( | PrivateTag const & | t | ) |

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:
  DiscriminateVolume.cxx, DumpToSQLITE3.cxx, SimpleScanner.cxx, 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]`

Directory::FilenamesType gdcm::Scanner::GetAllFilenamesFromTagToValue | ( | Tag const & | t,
|  | const char * | valueref
| ) |  | const

Will loop over all files and return a vector of std::strings of filenames where value match the reference value 'valueref'

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'.

Examples:
  DumpToSQLITE3.cxx, and SimpleScanner.cxx.

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:

Directory::FilenamesType gdcm::Scanner::GetOrderedValues | ( | Tag const & | t | ) | const

Get all the values found (in a vector) associated with Tag 't' This function is identical to GetValues, but is accessible from the wrapped layer (python, C#, java)

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 const& gdcm::Scanner::GetValues | ( |  | ) | const`[inline]`

Get all the values found (in lexicographic order)

Examples:
  SortImage.cxx, and VolumeSorter.cxx.

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

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

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

Examples:
  DumpToSQLITE3.cxx, and SimpleScanner.cxx.

static SmartPointer<Scanner> gdcm::Scanner::New | ( |  | ) | `[inline, static]`

for wrapped language: instanciate a reference counted object

void gdcm::Scanner::Print | ( | std::ostream & | os | ) | const`[virtual]`

Print result.

Reimplemented from gdcm::Object.

Referenced by gdcm::operator<<().

void gdcm::Scanner::ProcessPublicTag | ( | StringFilter & | sf,
|  | const char * | filename
| ) |  | `[protected]`

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

Start the scan !

Examples:
  DiscriminateVolume.cxx, DumpToSQLITE3.cxx, SimpleScanner.cxx, 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