MeVisLab Toolbox Reference
mlMultiFileVolume.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3//----------------------------------------------------------------------------------
5
10//----------------------------------------------------------------------------------
11
12#pragma once
13
15#include <mlZTUFileNameSet.h>
19#include <mlDicomToMLTools.h>
20
21#include <mlTypeDefs.h>
22#include <FMEThirdPartyWarningsDisable.h>
23#include <string>
24#include <vector>
25#include <FMEThirdPartyWarningsRestore.h>
26#include <DCMTree_Lib.h>
27
28ML_START_NAMESPACE
29
30// Forwards to the internally used stuff.
31class MLImageFormat;
32class DicomMessageCollector;
33class DicomConfigurableMessageFilter;
34
39 public:
40
41 // --- Constants:
43 static const char* const DDIVersionStringBase;
44
46 static const char* const DDISMFTreeCacheFileSuffix;
47
48 // --- Construction, destruction, initialization and important tools:
49
52
55
58
61
64
70 const DCMTree::Const_StructuredMFPtr getSMFTree(bool checkImgProps = false) const;
71
78 const DCMTree::Const_TreePtr getDCMTree(bool checkImgProps = false) const;
79
84
89 bool setUpIssues(const DicomMessageCollector *dcmMsgCollector=nullptr);
90
92 std::string getIssues(const DicomMessageCollector *dcmMsgCollector=nullptr) const;
93
96 const std::vector<std::string> &getIssuesVector() const;
97
108 std::string getInfoDump(const std::string& cacheFileRootDirPath,
109 bool useRelativePaths,
110 const DicomMessageCollector *dcmMsgCollector=nullptr) const;
111
119 DicomMessageCollector& dcmMsgCollector);
120
125 PagedImage &,
126 DicomMessageCollector& dcmMsgCollector);
127
128 // --- Persistence and comparison:
129
133 bool equals(const MultiFileVolume& obj) const;
134
147 std::string getVolumeInfoString(const std::string& lineEndStr,
148 const std::string& cacheFileRootDirPath,
149 bool useRelativePaths,
150 const std::string& userInfo=std::string()) const;
151
166 MLErrorCode appendToCache(const std::string& cacheDirPath,
167 std::string& currCacheState,
168 const std::string& lineEndStr,
169 bool useRelativePaths,
170 const std::string &optionalFilePrefix = "");
171
184 MLErrorCode setFromString(const std::string& state,
185 const std::string& cacheDirPath,
186 size_t& readPos,
187 bool lightLoad=false,
188 DicomMessageCollector *dcmMsgCollector=nullptr);
189
190
191 // --- Other stuff:
192
196 void appendFrameFile(MLint imgDim, const std::string& fileName, ImageVector& ext);
197
213 MLErrorCode removeSpatialSlices(std::vector<size_t> zIndexesToRemove);
214
223 PagedImage& imgProps);
224
227
228
229 // --- Scalar Members for volume description.
230
232 size_t getZExt() const { return _zExt; }
233 void setZExt(size_t nZ) { _zExt = nZ; }
235
237 size_t getTExt() const { return _tExt; }
238 void setTExt(size_t nT) { _tExt = nT; }
240
242 size_t getUExt() const { return _uExt; }
243 void setUExt(size_t nU) { _uExt = nU; }
245
247 int getFillValueUInt8() const { return _fillValueUInt8; }
248 void setFillValueUInt8(int fVal) { _fillValueUInt8 = fVal; }
250
252 int getPlanarConfig() const { return _planarConfig; }
253 void setPlanarConfig(int pConfig) { _planarConfig = pConfig; }
255
257 DicomToMLTools::FillPageMethods getFillPageMethod() const { return _fillPageMethod; }
258 void setFillPageMethod(DicomToMLTools::FillPageMethods fpMode) { _fillPageMethod = fpMode; }
260
261 // --- Complex Members for volume description.
262
264 const DICOMCachedIOFileHandle& getFirstFileName() const { return _firstFileName; }
265 void setFirstFileName(const std::string& fName) { _firstFileName = fName; }
267
269 const std::string& getOutVolumeName() const { return _outVolumeName; }
270 void setOutVolumeName(const std::string& fName) { _outVolumeName = fName; }
272
274 const DICOMCachedIOFileHandle& getOvrDataSrcFile() const { return _ovrDataSrcFile; }
275 void setOvrDataSrcFile(const std::string& oDFile) { _ovrDataSrcFile = oDFile; }
277
279 const PagedImage& getImageProperties() const { return _imgProps; };
280 PagedImage& getModifiableImageProperties() { return _imgProps; };
282
284 void invalidateImage(const std::string& stateInfo, MLErrorCode stateErrCode);
285
287 const std::string& getFileFormat() const { return _fileFormat; }
288 void setFileFormat(const std::string& fFormat) { _fileFormat = fFormat; }
290
292 ZTUFileNameSet& getModifiablePageFileNames() { return _pageFileNameSet; }
293 const ZTUFileNameSet& getConstPageFileNames() const { return _pageFileNameSet; }
295
297 const DICOMCachedIOFileHandle& getDicomSMFTagTreeCacheFileName() const { return _dicomSMFTagTreeCacheFileName; }
298 void setDicomSMFTagTreeCacheFileName(const std::string& fName) { _dicomSMFTagTreeCacheFileName = fName; }
300
303 const DICOMCachedIOFileHandle& getDirectDCMTreeFileName() const { return _directDCMTreeName; }
304 void setDirectDCMTreeFileName(const std::string& fName) { _directDCMTreeName = fName; }
306
308 MLdouble getImportTime() const { return _importTime; }
309 void setImportTime(MLdouble iTime) { _importTime = iTime; }
310 void addImportTime(MLdouble iTimeToAdd) { _importTime += iTimeToAdd; }
312
314 const std::string& getInputFilterLabel() const { return _inputFilterLabel; }
315 void setInputFilterLabel(const std::string& label) { _inputFilterLabel = label; }
317
319 const std::string& getInputFilterConfig() const { return _inputFilterConfig; }
320 void setInputFilterConfig(const std::string& config) { _inputFilterConfig = config; }
322
325 MLImageFormat** getMLImageFormatFileLoaderPointer() { return &_mlImageFormatFileLoader; }
326
329 Module** getMLItkImageFileReaderPointer() { return &_mlItkImageFileReader; }
330
333
350 bool searchFrameWithSOPInstanceUID(const std::string& sopInstanceUID,
351 DICOMCachedIOFileHandle& foundHandle,
352 DICOMTagTools::ZTUIndex& ztuPosition,
353 bool forceSearchInEnhancedHandles,
354 bool alsoSearchInSMFTrees,
355 DicomMessageCollector& dcmMsgCollector) const;
356
375 const std::string& tagValue,
376 DICOMCachedIOFileHandle& foundHandle,
377 DICOMTagTools::ZTUIndex& ztuPosition,
378 bool forceSearchInEnhancedHandles,
379 bool alsoSearchInSMFTrees,
380 DicomMessageCollector& dcmMsgCollector) const;
381
390 const std::string& tagValue,
391 bool alsoSearchInSMFTrees) const;
392
395 void appendFilteredIssue(const std::string &issue,
396 const DicomMessageCollector *dcmMsgCollector,
397 bool separateWithTerminatorIfNecessary);
398
399private:
401 MLDICOMCachedIOProxies _cacheProxies;
402
404 size_t _zExt;
405
407 size_t _tExt;
408
410 size_t _uExt;
411
413 int _fillValueUInt8;
414
416 int _planarConfig;
417
419 DicomToMLTools::FillPageMethods _fillPageMethod;
420
422 DICOMCachedIOFileHandle _firstFileName;
423
425 std::string _outVolumeName;
426
429 DICOMCachedIOFileHandle _ovrDataSrcFile;
430
432 PagedImage _imgProps;
433
435 std::string _fileFormat;
436
439 ZTUFileNameSet _pageFileNameSet;
440
442 DCMTree::Const_StructuredMFPtr _dicomSMFTagTree;
443
445 DICOMCachedIOFileHandle _dicomSMFTagTreeCacheFileName;
446
449 DICOMCachedIOFileHandle _directDCMTreeName;
450
453 std::vector<std::string> _issues;
454
456 MLdouble _importTime;
457
460 std::string _inputFilterLabel;
461
464 std::string _inputFilterConfig;
465
469 MLImageFormat* _mlImageFormatFileLoader;
470
474 Module* _mlItkImageFileReader;
475
477 MultiFileVolumeAdditionalOptions _additionalOptions;
478};
479
482
483ML_END_NAMESPACE
Project global and OS specific declarations.
#define MLMULTI_FILE_VOLUME_EXPORT
Only for diagnostic purposes.
Class managing a multi-frame Z, T, and U-dimension plus a string value.
Definition mlZTUIndex.h:26
Class to collect messages and errors related to a given frame handle.
File format class to store, load, and modify a PagedImage in a file.
int getFillValueUInt8() const
Fill value for gaps in volume.
bool setUpIssues(const DicomMessageCollector *dcmMsgCollector=nullptr)
size_t getZExt() const
Z-Extent of the volume.
MLErrorCode setFromString(const std::string &state, const std::string &cacheDirPath, size_t &readPos, bool lightLoad=false, DicomMessageCollector *dcmMsgCollector=nullptr)
PagedImage & getModifiableImageProperties()
ZTUFileNameSet & getModifiablePageFileNames()
2D vector of all DICOM file names to be composed to the result image.
void appendFilteredIssue(const std::string &issue, const DicomMessageCollector *dcmMsgCollector, bool separateWithTerminatorIfNecessary)
bool equals(const MultiFileVolume &obj) const
const DICOMCachedIOFileHandle & getDirectDCMTreeFileName() const
virtual ~MultiFileVolume()
Destructor.
int getPlanarConfig() const
Planar configuration of the volume.
const std::vector< std::string > & getIssuesVector() const
void setFirstFileName(const std::string &fName)
void setUExt(size_t nU)
Module ** getMLItkImageFileReaderPointer()
size_t getTExt() const
Time extent of the volume.
bool hasTagWithValueInTree(DCMTree::RawTagId tagId, const std::string &tagValue, bool alsoSearchInSMFTrees) const
std::string getInfoDump(const std::string &cacheFileRootDirPath, bool useRelativePaths, const DicomMessageCollector *dcmMsgCollector=nullptr) const
void setFileFormat(const std::string &fFormat)
void setFillValueUInt8(int fVal)
MLErrorCode appendToCache(const std::string &cacheDirPath, std::string &currCacheState, const std::string &lineEndStr, bool useRelativePaths, const std::string &optionalFilePrefix="")
static const char *const DDISMFTreeCacheFileSuffix
A constant suffix for SMF tree file generated for cache files.
std::string getVolumeInfoString(const std::string &lineEndStr, const std::string &cacheFileRootDirPath, bool useRelativePaths, const std::string &userInfo=std::string()) const
void setImportTime(MLdouble iTime)
MultiFileVolume()
Default constructor.
DicomToMLTools::FillPageMethods getFillPageMethod() const
The way how a page is filled with data from the source file or tree.
MLErrorCode copyToSubImage(SubImage &outSubImg, PagedImage &, DicomMessageCollector &dcmMsgCollector)
void setUpMetaDataDumpsFromAdditionalOptions()
Calls setUpMetaDataDumpsFromAdditionalOptions(this->_additionalOptions and this->_imgProps).
const DICOMCachedIOFileHandle & getFirstFileName() const
Name of first file used to compose the output image.
MultiFileVolume & operator=(const MultiFileVolume &ref)
Assignment operator.
void setInputFilterConfig(const std::string &config)
void appendFrameFile(MLint imgDim, const std::string &fileName, ImageVector &ext)
static const char *const DDIVersionStringBase
A constant version string used as base for all currently used version strings written to cache files.
void setSMFTree(DCMTree::Const_StructuredMFPtr tree)
Set the SMF DCMTree of the volume.
MLErrorCode removeSpatialSlices(std::vector< size_t > zIndexesToRemove)
MultiFileVolumeAdditionalOptions & getAdditionalOptionsContainer()
Provide access to the container with additional options.
const DICOMCachedIOFileHandle & getOvrDataSrcFile() const
In case of DCM/Tiff pairs or other formats this stores the file the data comes from instead of the or...
const std::string & getInputFilterLabel() const
Return the volume label defined input filters; default is "".
void setDicomSMFTagTreeCacheFileName(const std::string &fName)
size_t getUExt() const
U extent of the volume.
void setInputFilterLabel(const std::string &label)
void setOvrDataSrcFile(const std::string &oDFile)
void setTExt(size_t nT)
const std::string & getFileFormat() const
String set to the file format if it is not a DICOM or DICOM/Tiff import.
const DCMTree::Const_StructuredMFPtr getSMFTree(bool checkImgProps=false) const
void setPlanarConfig(int pConfig)
static void setUpMetaDataDumpsFromAdditionalOptions(const MultiFileVolumeAdditionalOptions &additionalOptions, PagedImage &imgProps)
std::string getIssues(const DicomMessageCollector *dcmMsgCollector=nullptr) const
Returns a string containing a description of issues related to the imported volume or "" if no proble...
void invalidateImage(const std::string &stateInfo, MLErrorCode stateErrCode)
Invalidate image properties, sets outOfDate and UpdateOfImagePropertiesNeeded flags,...
bool searchFrameWithValueInTag(DCMTree::RawTagId tagId, const std::string &tagValue, DICOMCachedIOFileHandle &foundHandle, DICOMTagTools::ZTUIndex &ztuPosition, bool forceSearchInEnhancedHandles, bool alsoSearchInSMFTrees, DicomMessageCollector &dcmMsgCollector) const
MLImageFormat ** getMLImageFormatFileLoaderPointer()
const DICOMCachedIOFileHandle & getDicomSMFTagTreeCacheFileName() const
Name of the cache file associated with the dicomSMFTagTree if it was written to a cache or reloaded f...
void setZExt(size_t nZ)
void setOutVolumeName(const std::string &fName)
MLErrorCode copyToSubImage(SubImage &outSubImg, DicomMessageCollector &dcmMsgCollector)
const ZTUFileNameSet & getConstPageFileNames() const
void addImportTime(MLdouble iTimeToAdd)
bool searchFrameWithSOPInstanceUID(const std::string &sopInstanceUID, DICOMCachedIOFileHandle &foundHandle, DICOMTagTools::ZTUIndex &ztuPosition, bool forceSearchInEnhancedHandles, bool alsoSearchInSMFTrees, DicomMessageCollector &dcmMsgCollector) const
const PagedImage & getImageProperties() const
MLPaged image properties of the volume.
const DCMTree::Const_TreePtr getDCMTree(bool checkImgProps=false) const
MLdouble getImportTime() const
Rough time needed to import this volume in seconds (not very precise).
const std::string & getInputFilterConfig() const
Return the DPL configuration defined by input filters; default is "".
void setFillPageMethod(DicomToMLTools::FillPageMethods fpMode)
void setDirectDCMTreeFileName(const std::string &fName)
DCMTree::Const_TreePtr getDCMTreeAlsoFromFiles() const
const std::string & getOutVolumeName() const
Name base (without extension) of generated output volumes or empty if no output is generated.
MultiFileVolume(const MultiFileVolume &ref)
Copy constructor.
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:715
double MLdouble
Definition mlTypeDefs.h:216
MLint64 MLint
Definition mlTypeDefs.h:489
boost::shared_ptr< const StructuredMF > Const_StructuredMFPtr
boost::shared_ptr< const Tree > Const_TreePtr
Definition DCMTree_Lib.h:67
unsigned int RawTagId
FillPageMethods
Methods how to fill a page with data from the DICOM file or tree.
DICOMCachedIOFileHandleBase< char > DICOMCachedIOFileHandle
"Forward" to DICOMCachedIOFileHandle.
MultiFileVolume DirectDicomImportVolumeReference
For backward compatibility to DirectDicomImport applications:
TImageVector< MLint > ImageVector
Defines the standard ImageVector type that is used by the ML for indexing and coordinates.