MeVisLab Toolbox Reference
ml::FileListTools::FileList Class Reference

A tool class to manage a list of file/frame names/urls associated with attributes. More...

#include <mlFileListToolsFileList.h>

Public Types

enum  { CopyFullFunctionalGroupSequences = 1 }
 Flag bits used as binary composed word for get/setDicomImportsFlags. More...
 
typedef FileListFilterPluginBase::FileAttributeMap FileAttributeMap
 A map type assigning an attribute container to file paths. More...
 
typedef std::map< std::string, const FileAttribute * > FileAttributeMapReferenced
 A map type assigning references to attribute container to file paths. More...
 
typedef std::vector< FileAttributeMapReferencedFileAttributeMaps
 A vector of FileAttributeMapReferenced. More...
 

Public Member Functions

 FileList (const FileListFilterPluginBase *filterPlugin)
 Constructs an empty fileAttributeMap object and associate the filter plugin connected to the FileListTools if there is one (otherwise use nullptr). More...
 
 FileList (const FileList &fileList, size_t fileListIdx)
 Constructs a file list from the fileListIdx'th entry of the FileAttributeMaps of a file list. More...
 
virtual ~FileList ()
 Currently no destructor is needed, however, it should be virtual. More...
 
const FileListFilterPluginBasegetConstFilterPlugin () const
 If available this points to the filter plugin connected to the DirectDicomImport module, otherwise nullptr (constant version). More...
 
void reset ()
 Restore construction state. More...
 
FileAttributeMapgetFileAttributeMap ()
 Get the _fileAttributeMap as modifiable object. More...
 
const FileAttributeMapgetFileAttributeMap () const
 Get the _fileAttributeMap as constant object. More...
 
const FileAttributeMapsgetGroupedFileAttributeMaps () const
 Get the _groupedFileAttributeMaps as constant object. More...
 
FileAttributegetAttributesForFile (const std::string &fileName)
 Get the attributes associated to the file name (if necessary then the map entry is created). More...
 
const FileAttributegetAttributesForFile (const std::string &fileName) const
 Get the attributes associated to the file name with constant access; if no entry exists then nullptr is returned. More...
 
std::vector< std::string > getFileNameList (bool onlyPassed, MLuint32 fileTypeMaskMask, MLuint32 noFileTypeMaskMask) const
 Returns a vector of std::strings of all file names of the fileAttributeMap which obey the restrictions defined by the function arguments. More...
 
void setDicomImportFlags (MLint64 flags)
 Set dedicated flags influencing the import of DICOM files. For supported bits see CopyFullFunctionalGroupSequences. More...
 
MLint64 getDicomImportFlags () const
 Set dedicated flags influencing the import of DICOM files. More...
 
virtual bool setUpFilesToImport (ProgressLogger *progressLogger, const std::string &frameSourcesDir, const std::vector< std::string > &suppressedFilesAndSuffixes, const std::vector< std::string > &explicitFileTypes, const std::vector< std::string > &additionalFiles, bool recursively, bool decomposeMultiFrames, float progressMinimum, float progressMaximum, DicomMessageCollector &dcmMsgCollector)
 Searches all files in directory frameSourcesDirs which do not have suffixes as described in suppressedFilesAndSuffixes. More...
 

Protected Member Functions

bool _doMultiFrameDecomposition (FileAttribute &fileAttributes, DicomMessageCollector &dcmMsgCollector)
 Decomposes the multi-frame file given by fileAttributes and adds each frame as a single frame with _addFile. More...
 
virtual void _addFile (const std::string &fullFileNamePathToAdd, const std::vector< std::string > &suppressedFilesAndSuffixes, const std::vector< std::string > &explicitFileTypes, bool decomposeMultiFrames, bool checkForTiffDcm, DicomMessageCollector &dcmMsgCollector)
 Tool function to check whether a file shall be imported or moved to non imported files. More...
 
void _updateLabelConfigGroups ()
 Clears _groupedFileAttributeMaps, scans all entries of _fileAttributeMap and fills _groupedFileAttributeMaps with pointers to FileAttributeMap objects containing the same volumeLabel and importCfg strings. More...
 

Protected Attributes

MLDICOMCachedIOProxies _cacheProxies
 Member used to access DICOM trees and to hold a handle on the tags cache until the last cache instance is removed. More...
 
FileAttributeMap _fileAttributeMap
 The map storing the imported file names associated with filter attributes. More...
 
FileAttributeMaps _groupedFileAttributeMaps
 Contains references to entries in fileAttributeMap, but decomposed to different FileAttributeMap objects which have identical volumeLabel+importConfig attributes. More...
 
const FileListFilterPluginBase_filterPlugin
 If available this points to the filter plugin connected to the DirectDicomImport module, otherwise nullptr. More...
 
MLint64 _dicomImportFlags
 Flags interpreted by the DICOM loader. More...
 

Detailed Description

A tool class to manage a list of file/frame names/urls associated with attributes.

Definition at line 44 of file mlFileListToolsFileList.h.

Member Typedef Documentation

◆ FileAttributeMap

A map type assigning an attribute container to file paths.

Definition at line 49 of file mlFileListToolsFileList.h.

◆ FileAttributeMapReferenced

A map type assigning references to attribute container to file paths.

Definition at line 52 of file mlFileListToolsFileList.h.

◆ FileAttributeMaps

A vector of FileAttributeMapReferenced.

Definition at line 55 of file mlFileListToolsFileList.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Flag bits used as binary composed word for get/setDicomImportsFlags.

Enumerator
CopyFullFunctionalGroupSequences 

Definition at line 103 of file mlFileListToolsFileList.h.

Constructor & Destructor Documentation

◆ FileList() [1/2]

ml::FileListTools::FileList::FileList ( const FileListFilterPluginBase filterPlugin)

Constructs an empty fileAttributeMap object and associate the filter plugin connected to the FileListTools if there is one (otherwise use nullptr).

◆ FileList() [2/2]

ml::FileListTools::FileList::FileList ( const FileList fileList,
size_t  fileListIdx 
)

Constructs a file list from the fileListIdx'th entry of the FileAttributeMaps of a file list.

If no such entry exists, the result list will be empty.

◆ ~FileList()

virtual ml::FileListTools::FileList::~FileList ( )
inlinevirtual

Currently no destructor is needed, however, it should be virtual.

Definition at line 67 of file mlFileListToolsFileList.h.

Member Function Documentation

◆ _addFile()

virtual void ml::FileListTools::FileList::_addFile ( const std::string &  fullFileNamePathToAdd,
const std::vector< std::string > &  suppressedFilesAndSuffixes,
const std::vector< std::string > &  explicitFileTypes,
bool  decomposeMultiFrames,
bool  checkForTiffDcm,
DicomMessageCollector dcmMsgCollector 
)
protectedvirtual

Tool function to check whether a file shall be imported or moved to non imported files.

If available it also calls filterPlugins connected to the FileListTools instance which could filter out certain files.

Parameters
fullFileNamePathToAddThe file name to be added either to to foundToBeImportedWithOther if it is not filtered.
suppressedFilesAndSuffixesArray of file suffixes including "." (such as ".tif", ".txt") describing the file types not to be parsed and included in the list of found frames. Strings not having a leading dot must match case insensitively.
explicitFileTypesArray of file suffixes including "." (such as ".pnm", ".jpg") describing the file types which shall be imported as additional non DICOM files.
decomposeMultiFramesIf false then multiframe files are loaded as single volumes, if true then these files are decomposed to single frames before importing them.
checkForTiffDcmAllow checking and handlĂ­ng of DCM/TIF-pairs, because they are considered as DICOM files but have to be imported with a non-DICOM importer typically. They get specific attributes to make handling easier. This check, however, can speed down some operations since searching the corresponding file pair can take long on some file system types.
dcmMsgCollectorCollects error, info and issue messages (typically related to a handle).

◆ _doMultiFrameDecomposition()

bool ml::FileListTools::FileList::_doMultiFrameDecomposition ( FileAttribute fileAttributes,
DicomMessageCollector dcmMsgCollector 
)
protected

Decomposes the multi-frame file given by fileAttributes and adds each frame as a single frame with _addFile.

Parameters
fileAttributesThe file (with import and filter attribute information) to be decomposed to a set of frames.
dcmMsgCollectorCollects error, info and issue messages (typically related to a handle).
Returns
true if at least one PerFrameFunctionalGroupsSequence tag was found which describes that the file should be a decomposable multiframe file; otherwise always false is returned.

◆ _updateLabelConfigGroups()

void ml::FileListTools::FileList::_updateLabelConfigGroups ( )
protected

Clears _groupedFileAttributeMaps, scans all entries of _fileAttributeMap and fills _groupedFileAttributeMaps with pointers to FileAttributeMap objects containing the same volumeLabel and importCfg strings.

◆ getAttributesForFile() [1/2]

FileAttribute& ml::FileListTools::FileList::getAttributesForFile ( const std::string &  fileName)

Get the attributes associated to the file name (if necessary then the map entry is created).

◆ getAttributesForFile() [2/2]

const FileAttribute* ml::FileListTools::FileList::getAttributesForFile ( const std::string &  fileName) const

Get the attributes associated to the file name with constant access; if no entry exists then nullptr is returned.

◆ getConstFilterPlugin()

const FileListFilterPluginBase* ml::FileListTools::FileList::getConstFilterPlugin ( ) const
inline

If available this points to the filter plugin connected to the DirectDicomImport module, otherwise nullptr (constant version).

Definition at line 70 of file mlFileListToolsFileList.h.

◆ getDicomImportFlags()

MLint64 ml::FileListTools::FileList::getDicomImportFlags ( ) const

Set dedicated flags influencing the import of DICOM files.

◆ getFileAttributeMap() [1/2]

FileAttributeMap& ml::FileListTools::FileList::getFileAttributeMap ( )
inline

Get the _fileAttributeMap as modifiable object.

Definition at line 76 of file mlFileListToolsFileList.h.

◆ getFileAttributeMap() [2/2]

const FileAttributeMap& ml::FileListTools::FileList::getFileAttributeMap ( ) const
inline

Get the _fileAttributeMap as constant object.

Definition at line 79 of file mlFileListToolsFileList.h.

◆ getFileNameList()

std::vector<std::string> ml::FileListTools::FileList::getFileNameList ( bool  onlyPassed,
MLuint32  fileTypeMaskMask,
MLuint32  noFileTypeMaskMask 
) const

Returns a vector of std::strings of all file names of the fileAttributeMap which obey the restrictions defined by the function arguments.

It is required that the files have been set up before (e.g. with setUpFilesToImport).

Parameters
onlyPassedIf true the only files with a true pass flag are returned.
fileTypeMaskMaskOnly files are returned where the fileTypeMask ANDed with fileTypeMaskMaskThese is non 0.
noFileTypeMaskMaskOnly files which do NOT have bits set noFileTypeMaskMask are returned.

◆ getGroupedFileAttributeMaps()

const FileAttributeMaps& ml::FileListTools::FileList::getGroupedFileAttributeMaps ( ) const
inline

Get the _groupedFileAttributeMaps as constant object.

Definition at line 82 of file mlFileListToolsFileList.h.

◆ reset()

void ml::FileListTools::FileList::reset ( void  )
inline

Restore construction state.

Definition at line 73 of file mlFileListToolsFileList.h.

◆ setDicomImportFlags()

void ml::FileListTools::FileList::setDicomImportFlags ( MLint64  flags)

Set dedicated flags influencing the import of DICOM files. For supported bits see CopyFullFunctionalGroupSequences.

◆ setUpFilesToImport()

virtual bool ml::FileListTools::FileList::setUpFilesToImport ( ProgressLogger progressLogger,
const std::string &  frameSourcesDir,
const std::vector< std::string > &  suppressedFilesAndSuffixes,
const std::vector< std::string > &  explicitFileTypes,
const std::vector< std::string > &  additionalFiles,
bool  recursively,
bool  decomposeMultiFrames,
float  progressMinimum,
float  progressMaximum,
DicomMessageCollector dcmMsgCollector 
)
virtual

Searches all files in directory frameSourcesDirs which do not have suffixes as described in suppressedFilesAndSuffixes.

Parameters
progressLoggerUsed for message output and progress updates, allowed to be nullptr.
frameSourcesDirThe directory to be scanned for files which do not have suffixes as described in suppressedFilesAndSuffixes.
suppressedFilesAndSuffixesArray of file suffixes including "." (such as ".tif", ".txt") describing the file types not to be parsed and included in the list of found frames. Strings not having a leading dot must match case insensitively.
explicitFileTypesArray of file suffixes including "." (such as ".pnm", ".jpg") describing the file types which shall be imported as additional non DICOM files if they were refused by this imported due to the suppressedFilesAndSuffixes list. That means files matching suppressedFilesAndSuffixes and explicitFileTypes are added to foundExplicits.
additionalFilesExplicitly specified files to be imported.
recursivelyIf true (the default) then directories are recursively parsed; if not only the current directory is scanned.
decomposeMultiFramesIf false (the default) then multiframe files are loaded as single volumes, if true then these files are decomposed to single frames before importing them.
progressMinimumStart percentage for progress counting.
progressMaximumEnd percentage for progress counting.
dcmMsgCollectorCollects error, info and issue messages (typically related to a handle).
Returns
true on interruption and false otherwise.

Member Data Documentation

◆ _cacheProxies

MLDICOMCachedIOProxies ml::FileListTools::FileList::_cacheProxies
protected

Member used to access DICOM trees and to hold a handle on the tags cache until the last cache instance is removed.


Definition at line 200 of file mlFileListToolsFileList.h.

◆ _dicomImportFlags

MLint64 ml::FileListTools::FileList::_dicomImportFlags
protected

Flags interpreted by the DICOM loader.

Definition at line 214 of file mlFileListToolsFileList.h.

◆ _fileAttributeMap

FileAttributeMap ml::FileListTools::FileList::_fileAttributeMap
protected

The map storing the imported file names associated with filter attributes.

Definition at line 204 of file mlFileListToolsFileList.h.

◆ _filterPlugin

const FileListFilterPluginBase* ml::FileListTools::FileList::_filterPlugin
protected

If available this points to the filter plugin connected to the DirectDicomImport module, otherwise nullptr.

Definition at line 211 of file mlFileListToolsFileList.h.

◆ _groupedFileAttributeMaps

FileAttributeMaps ml::FileListTools::FileList::_groupedFileAttributeMaps
protected

Contains references to entries in fileAttributeMap, but decomposed to different FileAttributeMap objects which have identical volumeLabel+importConfig attributes.

Definition at line 208 of file mlFileListToolsFileList.h.


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