MeVisLab Toolbox Reference
mlDicomModifyMultiFileVolumeExport.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3//----------------------------------------------------------------------------------
7
12//----------------------------------------------------------------------------------
13#pragma once
14
16#include "MLDicomModifySystem.h"
17
19#include <mlModuleIncludes.h>
20
22#include <mlDicomModifyList.h>
23
25#include <mlDicomTree.h>
26
29
32
34#include <mlZTUFileNameSet.h>
35
38
41
42ML_START_NAMESPACE
43
45class ZTUFileNameSet;
46class ProgressLogger;
47
48//----------------------------------------------------------------------------------
52//----------------------------------------------------------------------------------
54{
55public:
56
58
59protected:
60
62 void activateAttachments() override;
63
65 void handleNotification(Field *field) override;
66
76 const ZTUFileNameSet *_getInputVolumeFileSet(Matrix4 *w2vMatrix = nullptr,
77 bool *validMatrix = nullptr) const;
78
83
92 const ZTUFileNameSet &fileSet,
93 DicomMessageCollector &dcmMsgCollector);
94
102 const ZTUFileNameSet &inFileSet) const;
103
105 void _export();
106
118 std::string &oldToNewSOPInstanceUIDList,
119 const Matrix4 *w2vMatrix,
120 DicomMessageCollector &dcmMsgCollector);
121
133 void _exportFilteredFileSet(const std::vector<DICOMCachedIOFileHandle> &allFiles,
134 std::string &oldToNewSOPInstanceUIDList,
135 const Matrix4 *w2vMatrix,
136 const ZTUFileNameSet &originalInFileSet,
137 DicomMessageCollector &dcmMsgCollector);
138
168 void _createExportTree(const DICOMCachedIOFileHandle &inOrigFilePath,
169 DCMTree::Const_TreePtr inDCMTree,
170 DICOMCachedIOFileHandle &recentMFFileHandle,
171 DCMTree::Const_TreePtr &recentMFTree,
172 DCMTree::TreePtr &modifiableExportTree,
173 DCMTree::Const_TreePtr &constExportTree,
174 DicomMessageCollector &dcmMsgCollector);
175
177 void _appendExportedPath(const DICOMCachedIOFileHandle &pathOfNewlyExportedFile);
178
204 void _exportFile(const DICOMCachedIOFileHandle &inOrigFilePath,
205 DCMTree::Const_TreePtr inDCMTree,
206 size_t inFileIdx,
207 BaseField *inFilterBase,
208 const std::string &dstDirBase,
209 const std::string &dstFileNameSuffix,
210 std::string &oldSOPInstanceUID,
211 std::string &newSOPInstanceUID,
212 DICOMCachedIOFileHandle &recentMFFileHandle,
213 DCMTree::Const_TreePtr &recentMFTree,
214 const Matrix4 *w2vMatrix,
215 const DICOMTagTools::ZTUIndex *ztuPos,
216 DicomMessageCollector &dcmMsgCollector);
217
225 std::string &oldSOPInstanceUID,
226 std::string &newSOPInstanceUID);
227
231 std::string &errStr);
232
242 static std::string _filterDCMTree(DCMTree::TreePtr dcmTree,
243 BaseField *inFilterBase,
244 const Matrix4 *w2vMatrix,
245 const DICOMTagTools::ZTUIndex *ztuPos);
246
260 const DICOMCachedIOFileHandle &srcFilePath,
261 size_t fileIdx,
262 const std::string &dstDirBase,
263 const std::string &dstFileNameSuffix,
264 std::string &dstFilePath,
265 DicomMessageCollector &dcmMsgCollector);
266
267private:
268
271 MLDICOMCachedIOProxies _cacheProxies;
272
274 TreeAndVolumeInputFieldAddOn _dcmTreeInputFieldAddOn;
275
276
278 BaseField *_inputDicomModifierFld;
279
280
283 StringLineMultiField *_ztuFrameSuppressionsFld;
284
286 StringField *_destinationDirectoryFld;
287
289 StringField *_destinationFileNameSuffixFld;
290
293 BoolField *_handleAllIssuesAsErrorFld;
294
296 BoolField *_postErrorsToMLErrorHandlerFld;
297
299 NotifyField *_exportFld;
300
302 NotifyField *_stopExportingFld = nullptr;
303
305 ProgressLogger _progressLogger;
306
308 BoolField *_isExportingFld = nullptr;
309
311 ProgressField *_progressFld = nullptr;
312
313 // StudyInstanceUID:
316 StringField *_studyInstanceUIDFld;
317
319 NotifyField *_createNewStudyInstanceUIDFld;
320
323 BoolField *_modifyStudyInstanceUIDFld;
324
325
326 // SeriesInstanceUID:
328 StringField *_seriesInstanceUIDFld;
329
331 NotifyField *_createNewSeriesInstanceUIDFld;
332
335 BoolField *_modifySeriesInstanceUIDFld;
336
337
338 // SOPInstanceUID:
341 BoolField *_modifySOPInstanceUIDFld;
342
343
344 // ImageTypeUID:
346 EnumField *_imageTypeValue1And2Fld;
347
349 StringField *_imageTypeValue3Fld;
350
353 BoolField *_modifyImageTypeValue3Fld;
354
356 StringField *_imageTypeValue4Fld;
357
360 BoolField *_modifyImageTypeValue4Fld;
361
364 BoolField *_modifyImageTypeFld;
365
366
368 StringField *_assignmentOfSOPInstanceUIDsFld;
369
371 StringField *_exportedFramePathsFld = nullptr;
372
373
375 StringField *_statusFld;
376
379
380};
381
382ML_END_NAMESPACE
Project global and OS specific declarations.
#define ML_DICOM_MODIFY_EXPORT
DLL export macro definition.
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:729
Field to encapsulate a boolean value.
Definition mlFields.h:56
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.
ML module class DicomModifyMultiFileVolumeExport which exports a MultiFileVolume composed of DICOM fr...
static std::string _filterDCMTree(DCMTree::TreePtr dcmTree, BaseField *inFilterBase, const Matrix4 *w2vMatrix, const DICOMTagTools::ZTUIndex *ztuPos)
If a DicomModifyTagsPluginBase at inFilterBase is connected then it is applied to dcmTree.
void _exportFilteredFileSet(const std::vector< DICOMCachedIOFileHandle > &allFiles, std::string &oldToNewSOPInstanceUIDList, const Matrix4 *w2vMatrix, const ZTUFileNameSet &originalInFileSet, DicomMessageCollector &dcmMsgCollector)
Get all DCMFiles from the given file set and writes the files into the destination directory.
void _exportFilteredDicomBaseObject(DCMTree::Const_TreePtr inDCMTree, std::string &oldToNewSOPInstanceUIDList, const Matrix4 *w2vMatrix, DicomMessageCollector &dcmMsgCollector)
If necessary then modify the passed DICOM tree and write it into the destination directory where the ...
void _export()
Stores the (modified) DICOM frames in the destination directory.
const ZTUFileNameSet * _getInputVolumeFileSet(Matrix4 *w2vMatrix=nullptr, bool *validMatrix=nullptr) const
Return the input ZTUFileNameSet either from the currently connected MultiFileVolume or from the speci...
std::string _applyDCMTreeChanges(DCMTree::TreePtr dcmTree, std::string &oldSOPInstanceUID, std::string &newSOPInstanceUID)
Applies all necessary DICOM tree changes to dcmTree before writing it to disk.
void handleNotification(Field *field) override
Handles field changes.
void _createExportTree(const DICOMCachedIOFileHandle &inOrigFilePath, DCMTree::Const_TreePtr inDCMTree, DICOMCachedIOFileHandle &recentMFFileHandle, DCMTree::Const_TreePtr &recentMFTree, DCMTree::TreePtr &modifiableExportTree, DCMTree::Const_TreePtr &constExportTree, DicomMessageCollector &dcmMsgCollector)
Creates/determines the DICOM tree which can be modified and exported.
DICOMTagTools::ZTUVector _getZTUSuppressions(std::string &parseInfo, const ZTUFileNameSet &inFileSet) const
Returns a list of ztu positions which are described in _ztuFrameSuppressionsFld.
bool _requiresModifications() const
Returns true if any modification is implied by the module parameters, for example by a connected filt...
DICOMTagTools::ZTUIndex _getZTUPos(const DICOMCachedIOFileHandle &fileHandle, const ZTUFileNameSet &fileSet, DicomMessageCollector &dcmMsgCollector)
Gets the SOPInstanceUID of fileHandle, searches it in fileSet and returns the ztu position of the fil...
void _saveDCMTree(DCMTree::Const_TreePtr dcmTree, const DICOMCachedIOFileHandle &srcFilePath, size_t fileIdx, const std::string &dstDirBase, const std::string &dstFileNameSuffix, std::string &dstFilePath, DicomMessageCollector &dcmMsgCollector)
Stores dcmTree in file dstFileName.
void _appendExportedPath(const DICOMCachedIOFileHandle &pathOfNewlyExportedFile)
Appends a newly exported file path to _exportedFramePathsFld.
void _setUpImageTypeTag(DCMTree::TreePtr dcmTree, std::string &errStr)
Sets up the value(s) of the ImageType tag in dcmTree according to the field settings,...
void _exportFile(const DICOMCachedIOFileHandle &inOrigFilePath, DCMTree::Const_TreePtr inDCMTree, size_t inFileIdx, BaseField *inFilterBase, const std::string &dstDirBase, const std::string &dstFileNameSuffix, std::string &oldSOPInstanceUID, std::string &newSOPInstanceUID, DICOMCachedIOFileHandle &recentMFFileHandle, DCMTree::Const_TreePtr &recentMFTree, const Matrix4 *w2vMatrix, const DICOMTagTools::ZTUIndex *ztuPos, DicomMessageCollector &dcmMsgCollector)
Loads the DICOM file from origFilePath, filters it with a DicomModifyTagsPluginBase possible connecte...
void activateAttachments() override
Handles changes which were applied without notifications.
Field to encapsulate an enumerated value.
Definition mlFields.h:173
Base class for all fields used in the ML.
Definition mlField.h:73
Base class for an image processing module of the ML.
Definition mlModule.h:151
Field without value for notifications.
Definition mlFields.h:598
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
The field class StringLineMultiField which manages a vector of std::string lines typically separated ...
Class implementing a FieldAddOn managing fields and functionality for a multi- purpose input connecto...
Class to manage a 3D set of handles describing frames or volumes to be composed to a higher dimension...
#define ML_MODULE_CLASS_HEADER(className)
Similar to ML_CLASS_HEADER for the usage of derived classes from Module.
Header of FileHandle class which should be used in DICOM importing modules to resolve the filename fo...
An instance of this class creates singleton proxies for DICOMCachedIO cache classes such that all cac...
Header file of a class which manages a list of DicomModifyBase objects and an input which allows the ...
Header file of a FieldAddOn managing fields and functionality for a multi- purpose input connector fo...
Header file of class to manage a 3D set of handles describing frames or volumes to be composed to a h...
boost::shared_ptr< const Tree > Const_TreePtr
Definition DCMTree_Lib.h:67
boost::shared_ptr< Tree > TreePtr
Shared pointer to a DCMTree::Tree.
Definition DCMTree_Lib.h:66
std::vector< ZTUIndex > ZTUVector
A std::vector typedef of ZTUIndexes to describe indexes of handles in the multi-frame Z,...
Definition mlZTUIndex.h:70