GDCM: gdcm::Scanner Class Reference

GDCM 3.2.11

Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
gdcm::Scanner Class Reference

Scanner. More...

`#include <gdcmScanner.h>`

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

## 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 () override
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 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 override
| Print result.
void | PrintTable (std::ostream &os) const
bool | Scan (Directory::FilenamesType const &filenames)
| Start the scan !
Public Member Functions inherited from gdcm::Subject
| Subject ()
| ~Subject () override
unsigned long | AddObserver (const Event &event, Command *)
unsigned long | AddObserver (const Event &event, Command *) const
Command * | GetCommand (unsigned long tag)
bool | HasObserver (const Event &event) const
void | InvokeEvent (const Event &)
void | InvokeEvent (const Event &) const
void | RemoveAllObservers ()
void | RemoveObserver (unsigned long tag)
Public Member Functions inherited from gdcm::Object
| Object ()
| Object (const Object &)
| Special requirement for copy/cstor, assignment operator.
virtual | ~Object ()
void | operator= (const Object &)

## Static Public Member Functions
static SmartPointer< Scanner > | New ()
| for wrapped language: instantiate a reference counted object

## Protected Member Functions
void | ProcessPublicTag (StringFilter &sf, const char *filename)
Protected Member Functions inherited from gdcm::Object
void | Register ()
void | UnRegister ()

## 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 minimum 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 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, SortImage.cxx, and VolumeSorter.cxx.

## Member Typedef Documentation

## ◆ ConstIterator

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

## ◆ MappingType

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

## ◆ TagToValue

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)

## ◆ TagToValueValueType

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

## ◆ ValuesType

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

Examples
  DiscriminateVolume.cxx, SortImage.cxx, and VolumeSorter.cxx.

## Constructor & Destructor Documentation

## ◆ Scanner()

gdcm::Scanner::Scanner | ( |  | ) |
| inline

Referenced by New(), and operator<<.

## ◆ ~Scanner()

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

## Member Function Documentation

## ◆ AddPrivateTag()

void gdcm::Scanner::AddPrivateTag | ( | PrivateTag const & | t | ) |

## ◆ AddSkipTag()

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

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

## ◆ AddTag()

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

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

Examples
  DiscriminateVolume.cxx, DumpToSQLITE3.cxx, SortImage.cxx, and VolumeSorter.cxx.

## ◆ Begin()

ConstIterator gdcm::Scanner::Begin | ( |  | ) | const
| inline

## ◆ ClearSkipTags()

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

## ◆ ClearTags()

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

## ◆ End()

ConstIterator gdcm::Scanner::End | ( |  | ) | const
| inline

## ◆ GetAllFilenamesFromTagToValue()

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'

## ◆ GetFilenameFromTagToValue()

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'

## ◆ GetFilenames()

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

## ◆ GetKeys()

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.

## ◆ GetMapping()

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

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

Examples
  DumpToSQLITE3.cxx.

## ◆ GetMappingFromTagToValue()

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

See GetFilenameFromTagToValue(). This is simply GetFilenameFromTagToValue followed.

## ◆ GetMappings()

MappingType const & gdcm::Scanner::GetMappings | ( |  | ) | const
| inline

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

## ◆ GetOrderedValues()

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)

## ◆ GetValue()

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 !

## ◆ GetValues() [1/2]

ValuesType const & gdcm::Scanner::GetValues | ( |  | ) | const
| inline

Get all the values found (in lexicographic order).

Examples
  SortImage.cxx, and VolumeSorter.cxx.

## ◆ GetValues() [2/2]

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

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

## ◆ IsKey()

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.

## ◆ New()

SmartPointer< Scanner > gdcm::Scanner::New | ( |  | ) |
| inlinestatic

for wrapped language: instantiate a reference counted object

References Scanner().

## ◆ Print()

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

Print result.

Reimplemented from gdcm::Object.

Referenced by operator<<.

## ◆ PrintTable()

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

## ◆ ProcessPublicTag()

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

## ◆ Scan()

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

Start the scan !

Examples
  DiscriminateVolume.cxx, DumpToSQLITE3.cxx, SortImage.cxx, and VolumeSorter.cxx.

## Friends And Related Symbol Documentation

## ◆ operator<<

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

References Scanner(), operator<<, and Print().

Referenced by operator<<.

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

- gdcmScanner.h