MeVisLab Toolbox Reference
mlFileListToolsFileList.h
Go to the documentation of this file.
1 // Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2 // **InsertLicense** code
3 //----------------------------------------------------------------------------------
5 
10 //----------------------------------------------------------------------------------
11 #pragma once
12 
13 #include "MLFileListToolsSystem.h"
14 
15 // For input filtering and file attributes.
18 
19 // Used for caching pointers to already loaded DICOM trees.
20 #include "mlDICOMCachedIOProxies.h"
21 
22 // Logging and updating class.
23 #include <mlProgressLogger.h>
24 
25 // ML includes
26 #include <mlTypeDefs.h>
27 #include <ThirdPartyWarningsDisable.h>
28 #include <map>
29 #include <string>
30 #include <vector>
31 #include <ThirdPartyWarningsRestore.h>
32 
33 // DCMTree tree prototypes.
34 #include "DCMTree_Lib.h"
35 
36 
37 ML_START_NAMESPACE
38 
39 namespace FileListTools {
40 
41 //----------------------------------------------------------------------------------
43 //----------------------------------------------------------------------------------
45 {
46 public:
47 
50 
52  typedef std::map< std::string, const FileAttribute* > FileAttributeMapReferenced;
53 
55  typedef std::vector< FileAttributeMapReferenced > FileAttributeMaps;
56 
57 
60  FileList(const FileListFilterPluginBase *filterPlugin);
61 
64  FileList(const FileList &fileList, size_t fileListIdx);
65 
67  virtual ~FileList(){};
68 
70  const FileListFilterPluginBase *getConstFilterPlugin() const { return _filterPlugin; }
71 
73  void reset() { _fileAttributeMap.clear(); _groupedFileAttributeMaps.clear(); }
74 
76  FileAttributeMap &getFileAttributeMap() { return _fileAttributeMap; }
77 
79  const FileAttributeMap &getFileAttributeMap() const { return _fileAttributeMap; }
80 
82  const FileAttributeMaps &getGroupedFileAttributeMaps() const { return _groupedFileAttributeMaps; }
83 
86  FileAttribute &getAttributesForFile(const std::string &fileName);
87 
90  const FileAttribute *getAttributesForFile(const std::string &fileName) const;
91 
100  std::vector<std::string> getFileNameList(bool onlyPassed, MLuint32 fileTypeMaskMask, MLuint32 noFileTypeMaskMask) const;
101 
103  enum {
104  CopyFullFunctionalGroupSequences = 1
105  };
106 
109 
112 
138  virtual bool setUpFilesToImport(ProgressLogger *progressLogger,
139  const std::string &frameSourcesDir,
140  const std::vector<std::string> &suppressedFilesAndSuffixes,
141  const std::vector<std::string> &explicitFileTypes,
142  const std::vector<std::string> &additionalFiles,
143  bool recursively,
144  bool decomposeMultiFrames,
145  float progressMinimum,
146  float progressMaximum,
147  DicomMessageCollector &dcmMsgCollector);
148 
149 protected:
150 
151  // Methods:
152 
161  DicomMessageCollector &dcmMsgCollector);
162 
184  // Always skip further handling below if a DCM/Tiff was detected.
186  virtual void _addFile(const std::string &fullFileNamePathToAdd,
187  const std::vector<std::string> &suppressedFilesAndSuffixes,
188  const std::vector<std::string> &explicitFileTypes,
189  bool decomposeMultiFrames,
190  bool checkForTiffDcm,
191  DicomMessageCollector &dcmMsgCollector);
192 
197 
201 
202  // Members:
205 
209 
212 
215 };
216 
217 }; // end namespace FileListTools.
218 
221 
222 ML_END_NAMESPACE
Project global and OS specific declarations.
#define MLFILE_LIST_TOOLS_EXPORT
DLL export macro definition.
An instance of this class creates singleton proxies for DICOMCachedIO cache classes such that all cac...
Class to collect messages and errors related to a given frame handle.
A base class for plugins which can be used by file list importers to filter and classify files.
std::map< std::string, FileListTools::FileAttribute > FileAttributeMap
A map type assigning an attribute container to file paths.
Attributes assigned to files in a FileList according to filter operations on the file names or DICOM ...
A tool class to manage a list of file/frame names/urls associated with attributes.
MLDICOMCachedIOProxies _cacheProxies
Member used to access DICOM trees and to hold a handle on the tags cache until the last cache instanc...
void setDicomImportFlags(MLint64 flags)
Set dedicated flags influencing the import of DICOM files. For supported bits see CopyFullFunctionalG...
FileAttributeMap _fileAttributeMap
The map storing the imported file names associated with filter attributes.
const FileAttributeMap & getFileAttributeMap() const
Get the _fileAttributeMap as constant object.
void _updateLabelConfigGroups()
Clears _groupedFileAttributeMaps, scans all entries of _fileAttributeMap and fills _groupedFileAttrib...
FileList(const FileListFilterPluginBase *filterPlugin)
Constructs an empty fileAttributeMap object and associate the filter plugin connected to the FileList...
void reset()
Restore construction state.
FileAttributeMap & getFileAttributeMap()
Get the _fileAttributeMap as modifiable object.
bool _doMultiFrameDecomposition(FileAttribute &fileAttributes, DicomMessageCollector &dcmMsgCollector)
Decomposes the multi-frame file given by fileAttributes and adds each frame as a single frame with _a...
FileAttributeMaps _groupedFileAttributeMaps
Contains references to entries in fileAttributeMap, but decomposed to different FileAttributeMap obje...
const FileAttribute * getAttributesForFile(const std::string &fileName) const
Get the attributes associated to the file name with constant access; if no entry exists then nullptr ...
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.
const FileAttributeMaps & getGroupedFileAttributeMaps() const
Get the _groupedFileAttributeMaps as constant object.
FileAttribute & getAttributesForFile(const std::string &fileName)
Get the attributes associated to the file name (if necessary then the map entry is created).
FileListFilterPluginBase::FileAttributeMap FileAttributeMap
A map type assigning an attribute container to file paths.
const FileListFilterPluginBase * _filterPlugin
If available this points to the filter plugin connected to the DirectDicomImport module,...
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 restriction...
virtual ~FileList()
Currently no destructor is needed, however, it should be virtual.
std::vector< FileAttributeMapReferenced > FileAttributeMaps
A vector of FileAttributeMapReferenced.
FileList(const FileList &fileList, size_t fileListIdx)
Constructs a file list from the fileListIdx'th entry of the FileAttributeMaps of a file list.
std::map< std::string, const FileAttribute * > FileAttributeMapReferenced
A map type assigning references to attribute container to file paths.
MLint64 getDicomImportFlags() const
Set dedicated flags influencing the import of DICOM files.
MLint64 _dicomImportFlags
Flags interpreted by the DICOM loader.
const FileListFilterPluginBase * getConstFilterPlugin() const
If available this points to the filter plugin connected to the DirectDicomImport module,...
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 suppresse...
Configurable logger and progress handler class which can be used as base class for logging,...
An instance of this class creates singleton proxies for DICOMCachedIO cache classes such that all cac...
A base class for plugins which can be used by file list importers to filter and classify files.
Attributes assigned to files in a FileList according to filter operations on the file names or DICOM ...
Configurable logger and progress handler class which can be used as base class for logging,...
unsigned int MLuint32
Definition: mlTypeDefs.h:191
INT64 MLint64
Include 64 bit integer support for Windows or Unix.
Definition: mlTypeDefs.h:500
Namespace containing a number of tools and classes to scan directories for files, assign attributes t...
FileListTools::FileList DirectDicomImportFileList
For backward compatibility: