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 
37 #include <mlStringLineMultiField.h>
38 
40 #include <mlDICOMCachedIOProxies.h>
41 
42 ML_START_NAMESPACE
43 
45 class ZTUFileNameSet;
46 
47 //----------------------------------------------------------------------------------
51 //----------------------------------------------------------------------------------
53 {
54 public:
55 
57 
58 protected:
59 
61  void activateAttachments() override;
62 
64  void handleNotification(Field *field) override;
65 
75  const ZTUFileNameSet *_getInputVolumeFileSet(Matrix4 *w2vMatrix = nullptr,
76  bool *validMatrix = nullptr) const;
77 
81  bool _requiresModifications() const;
82 
91  const ZTUFileNameSet &fileSet,
92  DicomMessageCollector &dcmMsgCollector);
93 
101  const ZTUFileNameSet &inFileSet) const;
102 
104  void _export();
105 
118  std::string &oldToNewSOPInstanceUIDList,
119  const Matrix4 *w2vMatrix,
120  DicomMessageCollector &dcmMsgCollector);
121 
134  void _exportFilteredFileSet(const std::vector<DICOMCachedIOFileHandle> &allFiles,
135  std::string &oldToNewSOPInstanceUIDList,
136  const Matrix4 *w2vMatrix,
137  const ZTUFileNameSet &originalInFileSet,
138  DicomMessageCollector &dcmMsgCollector);
139 
171  void _createExportTree(const DICOMCachedIOFileHandle &inOrigFilePath,
172  DCMTree::Const_TreePtr inDCMTree,
173  DICOMCachedIOFileHandle &recentMFFileHandle,
174  DCMTree::Const_TreePtr &recentMFTree,
175  DCMTree::TreePtr &modifiableExportTree,
176  DCMTree::Const_TreePtr &constExportTree,
177  DicomMessageCollector &dcmMsgCollector);
178 
205  void _exportFile(const DICOMCachedIOFileHandle &inOrigFilePath,
206  DCMTree::Const_TreePtr inDCMTree,
207  size_t inFileIdx,
208  BaseField *inFilterBase,
209  const std::string &dstDirBase,
210  const std::string &dstFileNameSuffix,
211  std::string &oldSOPInstanceUID,
212  std::string &newSOPInstanceUID,
213  DICOMCachedIOFileHandle &recentMFFileHandle,
214  DCMTree::Const_TreePtr &recentMFTree,
215  const Matrix4 *w2vMatrix,
216  const DICOMTagTools::ZTUIndex *ztuPos,
217  DicomMessageCollector &dcmMsgCollector);
218 
226  std::string &oldSOPInstanceUID,
227  std::string &newSOPInstanceUID);
228 
232  std::string &errStr);
233 
243  static std::string _filterDCMTree(DCMTree::TreePtr dcmTree,
244  BaseField *inFilterBase,
245  const Matrix4 *w2vMatrix,
246  const DICOMTagTools::ZTUIndex *ztuPos);
247 
262  const DICOMCachedIOFileHandle &srcFilePath,
263  size_t fileIdx,
264  const std::string &dstDirBase,
265  const std::string &dstFileNameSuffix,
266  std::string &dstFilePath,
267  DicomMessageCollector &dcmMsgCollector);
268 
269 private:
270 
273  MLDICOMCachedIOProxies _cacheProxies;
274 
276  TreeAndVolumeInputFieldAddOn _dcmTreeInputFieldAddOn;
277 
278 
280  BaseField *_inputDicomModifierFld;
281 
282 
285  StringLineMultiField *_ztuFrameSuppressionsFld;
286 
288  StringField *_destinationDirectoryFld;
289 
291  StringField *_destinationFileNameSuffixFld;
292 
295  BoolField *_handleAllIssuesAsErrorFld;
296 
298  BoolField *_postErrorsToMLErrorHandlerFld;
299 
301  NotifyField *_exportFld;
302 
303 
304  // StudyInstanceUID:
307  StringField *_studyInstanceUIDFld;
308 
310  NotifyField *_createNewStudyInstanceUIDFld;
311 
314  BoolField *_modifyStudyInstanceUIDFld;
315 
316 
317  // SeriesInstanceUID:
319  StringField *_seriesInstanceUIDFld;
320 
322  NotifyField *_createNewSeriesInstanceUIDFld;
323 
326  BoolField *_modifySeriesInstanceUIDFld;
327 
328 
329  // SOPInstanceUID:
332  BoolField *_modifySOPInstanceUIDFld;
333 
334 
335  // ImageTypeUID:
337  EnumField *_imageTypeValue1And2Fld;
338 
340  StringField *_imageTypeValue3Fld;
341 
344  BoolField *_modifyImageTypeValue3Fld;
345 
347  StringField *_imageTypeValue4Fld;
348 
351  BoolField *_modifyImageTypeValue4Fld;
352 
355  BoolField *_modifyImageTypeFld;
356 
357 
359  StringField *_assignmentOfSOPInstanceUIDsFld;
360 
361 
363  StringField *_statusFld;
364 
367 
368 };
369 
370 ML_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:1187
Field to encapsulate a boolean value.
Definition: mlFields.h:62
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.
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 _setUpImageTypeTag(DCMTree::TreePtr dcmTree, std::string &errStr)
Sets up the value(s) of the ImageType tag in dcmTree according to the field settings,...
const ZTUFileNameSet * _getInputVolumeFileSet(Matrix4 *w2vMatrix=nullptr, bool *validMatrix=nullptr) const
Return the input ZTUFileNameSet either from the currently connected MultiFileVolume or from the speci...
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:363
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:156
Field without value for notifications.
Definition: mlFields.h:1049
Field to encapsulate a string value.
Definition: mlFields.h:1000
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)
Like 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:73
boost::shared_ptr< Tree > TreePtr
shared pointer to a DCMTree::Tree
Definition: DCMTree_Lib.h:70
std::vector< ZTUIndex > ZTUVector
A std::vector typedef of ZTUIndexes to describe indexes of handles in the multi-frame Z,...
Definition: mlZTUIndex.h:70