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.
31
32// DICOM tree prototypes.
33#include <DCMTree_Lib.h>
34
35// References DICOM caches to prevent their removal during life time of this.
37
38// AddOn for DicomTagDumps.
40
41// Configurable message collector class(es).
43
44// Forward to internally or friend used class.
46class VolumeBuilderGeneric;
47class VolumeBuilderFromDICOMs;
48
49ML_START_NAMESPACE
50
51// Forwards to internally or only incompletely used classes.
52class DirectDicomImportDPLImporter;
53class DirectDicomImportImporterBase;
54class DirectDicomImportOtherImporter;
55class MultiFileVolume;
56class MultiFileVolumeListView;
57class ProgressLogger;
58namespace FileListTools {
59 class FileList;
60}
61
62//----------------------------------------------------------------------------------
65//----------------------------------------------------------------------------------
67{
68public:
69
72
75
78
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
99protected:
101 friend class ::MLDirectDicomImportWrapper;
103 friend class ::VolumeBuilderGeneric;
104 friend class ::VolumeBuilderFromDICOMs;
105
108
111
114
117
118
120 void handleNotification(Field *field) override;
121
123 void activateAttachments() override;
124
128 virtual DicomConfigurableMessageFilterBaseRefCountedPtr _getMessageCollector();
129
130 // ----------------------------------------------------------
133 // ----------------------------------------------------------
134
136 virtual void calculateOutputImageProperties(int outIndex,
137 PagedImage* outImg) override;
138
144 virtual void calculateOutputSubImage(SubImage *outSubImg,
145 int outIndex,
146 SubImage *inSubImgs) override;
147
149
150private:
151
152 // ----------------------------------------------------------
154 // ----------------------------------------------------------
156
158 void _import();
159
165 void _populateFileList(const std::string &srcDirPath,
166 const std::vector<std::string> &additionalFiles,
167 FileListTools::FileList &fileList);
168
173 void _importLabeledFileList(size_t fListIdx,
174 size_t numFLists,
175 const FileListTools::FileList& fileList);
176
180 bool _importDirectoriesAndFiles(std::vector<std::string> srcDirPaths,
181 std::vector<std::string> singleAdditionalFiles,
182 bool interrupted);
183
190 void _importDicomAndNonDicomFromFileList(const FileListTools::FileList &fileList,
191 size_t numVolumesBeforeDicomImports,
192 bool& interrupted,
193 size_t& numDCMImports,
194 size_t& numNonDCMImports);
195
200 void _logPlannedImportFromFileList(const std::vector<std::string>& srcDirPaths,
201 const std::vector<std::string>& singleAdditionalFiles,
202 const std::string& srcDirPath);
203
208 void _logImportFinishState(bool interrupted,
209 size_t numDCMImports,
210 size_t numNonDCMImports);
211
212
216 DCMTree::Const_TreePtr _getSelectedDCMTree(bool checkImgProps=false);
217
219 bool _isCachingEnabledAndHasPath() const;
220
226 bool _verifyAndOrCreateResultCacheDirectory() const;
227
229 void _updateTreeCacheSizeInformation();
231 void _updateTagCacheSizeInformation();
233 void _clearCaches();
234
236 void _logDICOMCacheInfos(ProgressLogger &logger, bool forceLog=false);
237
240 bool _flushAndCheckDICOMCacheOverflow(ProgressLogger &logger);
241
244 bool _flushAndCheckDICOMTagCacheOverflow(ProgressLogger &logger);
245
248 bool _flushAndCheckDICOMTreeCacheOverflow(ProgressLogger &logger);
249
251
252 // ----------------------------------------------------------
254 // ----------------------------------------------------------
256
260 MultiFileVolume *_updateImageOutputToSelectedIndex();
261
263 void _appendDirectDicomImportFields();
264
266 void _updateInfoFields(bool updateTagDump);
267
269 void _showCurrentIssue();
271
272
273 // ----------------------------------------------------------
275 // ----------------------------------------------------------
277
280 TimeCounter _updateCounter;
281
283 MultiFileVolumeListRefCountedPtr _outVolumes;
284
286 MultiFileVolumeListImageOutput _currentDDIOutput;
287
289 MultiFileVolumeListView *_volumeListView;
290
292 DirectDicomImportDPLImporter *_dplImporter;
293
295 DirectDicomImportOtherImporter *_otherImporter;
296
298 MLDICOMCachedIOProxies _cacheProxies;
300
301 // ----------------------------------------------------------
304 // ----------------------------------------------------------
305
308 BaseField *_outputAccessConnectorFld;
309
312 BaseField *_inputFilterPluginFld;
313
316 BaseField *_inputMessageFilterPluginFld;
317
319 StringField *_fullSrcDirPathFld;
320
321
323 StringField *_fullUserSrcDirPathsFld;
324
326 StringField *_fullUserSrcDirPathsResolvedFld;
327
329 BoolField *_useFullUserSrcDirPathsCommentPrefixFld;
330
332 StringField *_fullUserSrcDirPathsCommentPrefixFld;
333
334
336 StringField *_fullTargetPathFld;
337
339 StringField *_cachePathFld;
340
344 BoolField *_useRelativeCachePathsFld;
345
348 BoolField *_writeSingleVolumeCacheFilesFld;
349
351 BoolField *_cachePathAutoCreateFld;
352
354 StringField *_cacheFileNameFld;
355
357 StringField *_consoleFld;
358
360 IntField *_consoleSizeInKiloBytesFld;
361
363 NotifyField *_clearConsoleFld;
364
366 IntField *_outVolIdxFld;
367
369 NotifyField *_dplImportFld;
370
372 BoolField *_clearAfterImportFld;
373
378 BoolField *_clearSingleFrameCacheAfterImportFld;
379
382 NotifyField *_clearSingleFrameCacheFld;
383
385 NotifyField *_clearCacheFld;
386
388 NotifyField *_clearResultCacheFld;
389
391 NotifyField *_clearVolumeListFld;
392
394 NotifyField *_loadResultCacheFld;
395
399 BoolField *_preferCacheBeforeImportFld;
400
402 NotifyField *_saveResultCacheFld;
403
405 NotifyField *_stopImportingFld;
406
408 BoolField *_useResultCachingFld;
409
411 ProgressField *_progressFld;
412
414 StringField *_progressInfoFld;
415
417 IntField *_maxCachedMegaBytesTreeCacheFld;
418
420 IntField *_maxCachedMegaBytesTagCacheFld;
421
423 BoolField *_dicomCacheEditableFld;
424
426 BoolField *_processingFld;
428
429
430 //--------------------------------------------------------------
432 //--------------------------------------------------------------
434
436 IntField *_numVolumesFld;
437
439 IntField *_totalSlicesFld;
440
442 IntField *_totalTimePointsFld;
443
445 IntField *_totalSlicesMultTimePointsFld;
446
448 DoubleField *_totalVoxelsFld;
449
451 IntField *_extFld[6];
452
454 DoubleField *_numVolVoxelsFld;
455
457 DicomTagDumpFieldAddOn _dicomTagDumpFieldAddOn;
458
460 StringField *_volumeInfoDumpFld;
461
463 StringField *_fileListInfoFld;
464
467 StringField *_suppressedFilesAndSuffixesFld;
468
470 StringField *_explicitFileTypesFld;
471
472
474 StringField *_inputFileListFld;
475
477 StringField *_inputFileListResolvedFld;
478
480 BoolField *_useInputFileListCommentPrefixFld;
481
483 StringField *_inputFileListCommentPrefixFld;
484
485
487 BoolField *_hadWarningsFld;
488
490 BoolField *_hadErrorsFld;
491
493 BoolField *_logDicomCacheInfosFld;
494
496 BoolField *_warnDicomCacheOverflowsFld;
498
501};
502
503
504ML_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...
This class wraps the MultiFileVolumeList of the output connector of ml::DirectDicomImport such that i...
Field to encapsulate a pointer to an ML base object.
Definition mlFields.h:729
Field to encapsulate a boolean value.
Definition mlFields.h:56
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.
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.
void _writeResultCache()
Tries to clear and write the loaded volumes list into the result cache, logs errors on failures.
virtual DicomConfigurableMessageFilterBaseRefCountedPtr _getMessageCollector()
Convenience routine to returns a new instance of a message collector to be used for message handling;...
MultiFileVolumeList & getNonConstOutVolumes()
Provides non constant access to list of all imported output volumes.
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:494
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:117
Base class for an image processing module of the ML.
Definition mlModule.h:151
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:598
The class PagedImage, representing a fragmented image that manages properties and data of an image lo...
Field to encapsulate an increasing float value from range [0,1].
Definition mlFields.h:451
Configurable logger and progress handler class which can be used as base class for logging,...
Field to encapsulate a string value.
Definition mlFields.h:553
This class manages/represents a rectangular 6D image region that is organized linearly in memory.
Definition mlSubImage.h:75
Class to measure precise time intervals.
#define ML_MODULE_CLASS_HEADER(className)
Similar to 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:67
Namespace containing a number of tools and classes to scan directories for files, assign attributes t...