MeVisLab Toolbox Reference
mlDirectDicomImport.h
Go to the documentation of this file.
1 // Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2 // **InsertLicense** code
3 //----------------------------------------------------------------------------------
5 
12 
13 //----------------------------------------------------------------------------------
14 #pragma once
15 
16 // Local includes
18 
19 // ML includes
20 #include <mlModuleIncludes.h>
21 #include <mlTimeCounter.h>
22 
23 // Module to convert MultiFileVolumes to ML images, to scan for min/max and to save.
25 
26 // Container for MultiFileVolumeList to be connected to base outputs.
28 
29 // FilListFilter functionality to file file sets before importing them.
30 #include "mlFileListFilterPlugin.h"
31 
32 // DICOM tree prototypes.
33 #include <DCMTree_Lib.h>
34 
35 // References DICOM caches to prevent their removal during life time of this.
36 #include "mlDICOMCachedIOProxies.h"
37 
38 // AddOn for DicomTagDumps.
40 
41 // Configurable message collector class(es).
43 
44 // Forward to internally or friend used class.
45 class MLDirectDicomImportWrapper;
46 class VolumeBuilderGeneric;
47 class VolumeBuilderFromDICOMs;
48 
49 ML_START_NAMESPACE
50 
51 // Forwards to internally or only incompletely used classes.
52 class DirectDicomImportDPLImporter;
53 class DirectDicomImportImporterBase;
54 class DirectDicomImportOtherImporter;
55 class MultiFileVolume;
56 class MultiFileVolumeListView;
57 class ProgressLogger;
58 namespace FileListTools {
59  class FileList;
60 }
61 
62 //----------------------------------------------------------------------------------
65 //----------------------------------------------------------------------------------
67 {
68 public:
69 
72 
74  ~DirectDicomImport() override;
75 
78 
80  bool isStopImportingPressed() const;
81 
84  static bool isStopImportingPressedCB(void *ddiOpPtr);
85 
87  void updateConsole(bool force=true);
88 
90  static void updateProgressIndicatorCB(void *userData,
91  const std::string &info,
92  float state);
93 
95  void updateProgressIndicator(const std::string &info,
96  float state);
98 
99 protected:
101  friend class ::MLDirectDicomImportWrapper;
103  friend class ::VolumeBuilderGeneric;
104  friend class ::VolumeBuilderFromDICOMs;
105 
108 
111 
114 
116  void handleNotification(Field *field) override;
117 
119  void activateAttachments() override;
120 
124  virtual DicomConfigurableMessageFilterBaseRefCountedPtr _getMessageCollector();
125 
126  // ----------------------------------------------------------
129  // ----------------------------------------------------------
130 
132  virtual void calculateOutputImageProperties(int outIndex,
133  PagedImage* outImg) override;
134 
140  virtual void calculateOutputSubImage(SubImage *outSubImg,
141  int outIndex,
142  SubImage *inSubImgs) override;
143 
145 
146 private:
147 
148  // ----------------------------------------------------------
150  // ----------------------------------------------------------
152 
154  void _import();
155 
161  void _populateFileList(const std::string &srcDirPath,
162  const std::vector<std::string> &additionalFiles,
163  FileListTools::FileList &fileList);
164 
169  void _importLabeledFileList(size_t fListIdx,
170  size_t numFLists,
171  const FileListTools::FileList& fileList);
172 
176  bool _importDirectoriesAndFiles(std::vector<std::string> srcDirPaths,
177  std::vector<std::string> singleAdditionalFiles,
178  bool interrupted);
179 
186  void _importDicomAndNonDicomFromFileList(const FileListTools::FileList &fileList,
187  size_t numVolumesBeforeDicomImports,
188  bool& interrupted,
189  size_t& numDCMImports,
190  size_t& numNonDCMImports);
191 
196  void _logPlannedImportFromFileList(const std::vector<std::string>& srcDirPaths,
197  const std::vector<std::string>& singleAdditionalFiles,
198  const std::string& srcDirPath);
199 
204  void _logImportFinishState(bool interrupted,
205  size_t numDCMImports,
206  size_t numNonDCMImports);
207 
208 
212  DCMTree::Const_TreePtr _getSelectedDCMTree(bool checkImgProps=false);
213 
215  bool _isCachingEnabledAndHasPath() const;
216 
222  bool _verifyAndOrCreateResultCacheDirectory() const;
223 
225  void _updateTreeCacheSizeInformation();
227  void _updateTagCacheSizeInformation();
229  void _clearCaches();
230 
232  void _logDICOMCacheInfos(ProgressLogger &logger, bool forceLog=false);
233 
236  bool _flushAndCheckDICOMCacheOverflow(ProgressLogger &logger);
237 
240  bool _flushAndCheckDICOMTagCacheOverflow(ProgressLogger &logger);
241 
244  bool _flushAndCheckDICOMTreeCacheOverflow(ProgressLogger &logger);
245 
247 
248  // ----------------------------------------------------------
250  // ----------------------------------------------------------
252 
256  MultiFileVolume *_updateImageOutputToSelectedIndex();
257 
259  void _appendDirectDicomImportFields();
260 
262  void _updateInfoFields(bool updateTagDump);
263 
265  void _showCurrentIssue();
267 
268 
269  // ----------------------------------------------------------
271  // ----------------------------------------------------------
273 
276  TimeCounter _updateCounter;
277 
279  MultiFileVolumeListRefCountedPtr _outVolumes;
280 
282  MultiFileVolumeListImageOutput _currentDDIOutput;
283 
285  MultiFileVolumeListView *_volumeListView;
286 
288  DirectDicomImportDPLImporter *_dplImporter;
289 
291  DirectDicomImportOtherImporter *_otherImporter;
292 
294  MLDICOMCachedIOProxies _cacheProxies;
296 
297  // ----------------------------------------------------------
300  // ----------------------------------------------------------
301 
304  BaseField *_outputAccessConnectorFld;
305 
308  BaseField *_inputFilterPluginFld;
309 
312  BaseField *_inputMessageFilterPluginFld;
313 
315  StringField *_fullSrcDirPathFld;
316 
318  StringField *_fullUserSrcDirPathsFld;
319 
321  StringField *_fullTargetPathFld;
322 
324  StringField *_cachePathFld;
325 
329  BoolField *_useRelativeCachePathsFld;
330 
333  BoolField *_writeSingleVolumeCacheFilesFld;
334 
336  BoolField *_cachePathAutoCreateFld;
337 
339  StringField *_cacheFileNameFld;
340 
342  StringField *_consoleFld;
343 
345  IntField *_consoleSizeInKiloBytesFld;
346 
348  NotifyField *_clearConsoleFld;
349 
351  IntField *_outVolIdxFld;
352 
354  NotifyField *_dplImportFld;
355 
357  BoolField *_clearAfterImportFld;
358 
363  BoolField *_clearSingleFrameCacheAfterImportFld;
364 
367  NotifyField *_clearSingleFrameCacheFld;
368 
370  NotifyField *_clearCacheFld;
371 
373  NotifyField *_clearResultCacheFld;
374 
376  NotifyField *_clearVolumeListFld;
377 
379  NotifyField *_loadResultCacheFld;
380 
384  BoolField *_preferCacheBeforeImportFld;
385 
387  NotifyField *_saveResultCacheFld;
388 
390  NotifyField *_stopImportingFld;
391 
393  BoolField *_useResultCachingFld;
394 
396  ProgressField *_progressFld;
397 
399  StringField *_progressInfoFld;
400 
402  IntField *_maxCachedMegaBytesTreeCacheFld;
403 
405  IntField *_maxCachedMegaBytesTagCacheFld;
406 
408  BoolField *_dicomCacheEditableFld;
409 
411  BoolField *_processingFld;
413 
414 
415  //--------------------------------------------------------------
417  //--------------------------------------------------------------
419 
421  IntField *_numVolumesFld;
422 
424  IntField *_totalSlicesFld;
425 
427  IntField *_totalTimePointsFld;
428 
430  IntField *_totalSlicesMultTimePointsFld;
431 
433  DoubleField *_totalVoxelsFld;
434 
436  IntField *_extFld[6];
437 
439  DoubleField *_numVolVoxelsFld;
440 
442  DicomTagDumpFieldAddOn _dicomTagDumpFieldAddOn;
443 
445  StringField *_volumeInfoDumpFld;
446 
448  StringField *_fileListInfoFld;
449 
452  StringField *_suppressedFilesAndSuffixesFld;
453 
455  StringField *_explicitFileTypesFld;
456 
458  StringField *_inputFileListFld;
459 
461  BoolField *_hadWarningsFld;
462 
464  BoolField *_hadErrorsFld;
465 
467  BoolField *_logDicomCacheInfosFld;
468 
470  BoolField *_warnDicomCacheOverflowsFld;
472 
475 };
476 
477 
478 ML_END_NAMESPACE
Project global and OS specific declarations.
#define MLDIRECTDICOMIMPORT_EXPORT
Only for diagnostic purposes.
An instance of this class creates singleton proxies for DICOMCachedIO cache classes such that all cac...
Field to encapsulate a pointer to an ML base object.
Definition: mlFields.h:1187
Field to encapsulate a boolean value.
Definition: mlFields.h:62
Class managing fields to show and handle a DICOM tree tag dump.
Class handling all DICOM Processor Library Import (DPL) stuff for the DirectDicomImport module.
Base importer class for the DirectDicomImport module.
Derived importer to import non DICOM files into DirectDicomImport.
Imports image files directly from DICOM or other file types without an intermediate representation.
void handleNotification(Field *field) override
Handle field changes of the field field.
bool isStopImportingPressed() const
Returns true if _stopImporting is pressed otherwise it returns false.
void updateProgressIndicator(const std::string &info, float state)
Update a progress indicator about the current import state.
MultiFileVolumeList & getNonConstOutVolumes()
Provides non constant access to list of all imported output volumes.
void _resetMessageFlags()
Resets the error/warnings error state to no errors/warnings.
static bool isStopImportingPressedCB(void *ddiOpPtr)
Static callback version of isStopImportingPressed(), requires either nullptr as argument or a valid D...
~DirectDicomImport() override
Destructor.
virtual void calculateOutputImageProperties(int outIndex, PagedImage *outImg) override
Sets properties of the output image at output outIndex.
DirectDicomImport()
Constructor.
void activateAttachments() override
Update internal module state after load or clone and enable notification handling again.
void updateConsole(bool force=true)
Updates the _consoleFld.
virtual DicomConfigurableMessageFilterBaseRefCountedPtr _getMessageCollector()
Convenience routine to returns a new instance of a message collector to be used for message handling;...
virtual void calculateOutputSubImage(SubImage *outSubImg, int outIndex, SubImage *inSubImgs) override
Calculates page outSubImg of output image with index outIndex by using inSubimgs.
static void updateProgressIndicatorCB(void *userData, const std::string &info, float state)
Static callback version to update a progress indicator about the current import state.
const MultiFileVolumeList & getConstOutVolumes() const
Provides constant access to list of all imported output volumes.
Field to encapsulate a double value.
Definition: mlFields.h:806
Base class for all fields used in the ML.
Definition: mlField.h:73
A tool class to manage a list of file/frame names/urls associated with attributes.
Field to encapsulate an integer value.
Definition: mlFields.h:161
Base class for an image processing module of the ML.
Definition: mlModule.h:156
The ML module class MultiFileVolumeListImageOutput for extending the number of image outputs of Multi...
Manages the volume list view and its contents for the DirectDicomImport module.
Class managing a list of MultiFileVolume instances for the DirectDicomImport module; taking ownership...
Management class used by DirectDicomImport to create, represent and describe volumes composed of mult...
Field without value for notifications.
Definition: mlFields.h:1049
Class which represents an image, which manages properties of an image and image data which is located...
Definition: mlPagedImage.h:70
Field to encapsulate an increasing float value from range [0,1].
Definition: mlFields.h:744
Configurable logger and progress handler class which can be used as base class for logging,...
Field to encapsulate a string value.
Definition: mlFields.h:1000
This class manages/represents a rectangular 6d image region which is organized linearly in memory.
Definition: mlSubImage.h:75
Class to measure precise time intervals.
Definition: mlTimeCounter.h:26
#define ML_MODULE_CLASS_HEADER(className)
Like ML_CLASS_HEADER for the usage of derived classes from Module.
An instance of this class creates singleton proxies for DICOMCachedIO cache classes such that all cac...
Header file of ML module class DicomConfigurableMessageFilter usable as plugin for modules which prod...
Header file for the DicomTagDumpFieldAddOn which manages fields to show and handle a DICOM tree tag d...
A concrete module class for file and DCMTree filtering which can be used by FileList importers to fil...
The ML module class MultiFileVolumeListImageOutput for extending the number of image outputs of Multi...
Reference counted Base class encapsulating a list of MultiFileVolume instances.
boost::shared_ptr< const Tree > Const_TreePtr
Definition: DCMTree_Lib.h:73
Namespace containing a number of tools and classes to scan directories for files, assign attributes t...