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 <FMEThirdPartyWarningsDisable.h>
28 #include <map>
29 #include <string>
30 #include <vector>
31 #include <FMEThirdPartyWarningsRestore.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 
140  virtual bool setUpFilesToImport(ProgressLogger *progressLogger,
141  const std::string &frameSourcesDir,
142  const std::vector<std::string> &suppressedFilesAndSuffixes,
143  const std::vector<std::string> &explicitFileTypes,
144  const std::vector<std::string> &additionalFiles,
145  bool recursively,
146  bool decomposeMultiFrames,
147  float progressMinimum,
148  float progressMaximum,
149  DicomMessageCollector &dcmMsgCollector,
150  bool filterDecomposedFrames=false);
151 
152 protected:
153 
154  // Methods:
155 
166  DicomMessageCollector &dcmMsgCollector,
167  bool filterDecomposedFrames);
168 
193  virtual void _addFile(const std::string &fullFileNamePathToAdd,
194  const std::vector<std::string> &suppressedFilesAndSuffixes,
195  const std::vector<std::string> &explicitFileTypes,
196  bool decomposeMultiFrames,
197  bool checkForTiffDcm,
198  DicomMessageCollector &dcmMsgCollector,
199  bool filterDecomposedFrames);
200 
205 
209 
210  // Members:
213 
217 
220 
223 };
224 
225 }; // end namespace FileListTools.
226 
229 
230 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.
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, bool filterDecomposedFrames=false)
Searches all files in directory frameSourcesDirs which do not have suffixes as described in suppresse...
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.
FileAttributeMaps _groupedFileAttributeMaps
Contains references to entries in fileAttributeMap, but decomposed to different FileAttributeMap obje...
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, bool filterDecomposedFrames)
Tool function to check whether a file shall be imported or moved to non imported files.
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 ...
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...
bool _doMultiFrameDecomposition(FileAttribute &fileAttributes, DicomMessageCollector &dcmMsgCollector, bool filterDecomposedFrames)
Decomposes the multi-frame file given by fileAttributes and adds each frame as a single frame with _a...
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,...
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:185
INT64 MLint64
Include 64-bit integer support for Windows or Unix.
Definition: mlTypeDefs.h:412
Namespace containing a number of tools and classes to scan directories for files, assign attributes t...
FileListTools::FileList DirectDicomImportFileList
For backward compatibility: