MeVisLab Toolbox Reference
mlRTObjectSave.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 
15 #ifndef __mlRTObjectSave_H
16 #define __mlRTObjectSave_H
17 
18 // Local includes
20 
21 // ML includes
22 #include <mlModuleIncludes.h>
23 #include <CSOBase/CSOList.h>
24 #include "DCMTree_Tree.h"
25 #include <ThirdPartyWarningsDisable.h>
27 #include <ThirdPartyWarningsRestore.h>
28 
29 ML_START_NAMESPACE
30 
31 class RTBase;
32 
34  : public ModuleBackgroundTask
35 {
36 public:
37  RTObjectSaveBackgroundTask(Module* module, FloatField* progressField, StringField* statusField);
38 
40  {
41  _dicomTree.reset();
42  }
43 
45  {
46  if (isSynchronous())
47  {
48  _dicomTree = dicomTree;
49  }
50  else
51  {
52  _dicomTree = dicomTree->copy();
53  }
54  }
55 
56  void setFilename(const std::string& filename) { _filename = filename; }
57 
58  bool hasSuccessfullySaved() const { return _savingWasSuccessful; }
59 
60  virtual void run() override;
61 
62 private:
63  std::string _filename;
64  bool _savingWasSuccessful;
65  DCMTree::TreePtr _dicomTree;
66 };
67 
68 
71 {
72 public:
73 
75 
77  virtual void handleNotification (Field *field) override;
78 
79 private:
80 
81  bool _isInputRTObjectValid();
82 
83  bool _getInputDicomTreeFromBaseField();
84 
85  virtual void taskFinished(BackgroundTask* task) override;
86 
87  virtual ModuleBackgroundTask* createTask() override;
88 
89 
91  BoolField* _autoSaveFld;
93  BaseField* _rtObjectFld;
95  BoolField* _isBaseInputValidFld;
97  StringField* _statusFld;
98  StringField* _dcmFilenameFld;
99  DCMTree::TreePtr _dicomTree;
101  RTBase* _rtObject;
102 
105 };
106 
107 
108 ML_END_NAMESPACE
109 
110 #endif // __mlRTObjectSave_H
111 
Project global and OS specific declarations.
#define MLDCMTKMLCONVERTERMODULES_EXPORT
Base class for ML modules that use background tasks.
Base class for a task that is started in an extra thread.
bool isSynchronous() const
check if task is synchronous (which means it is NOT run in an extra thread)
Field to encapsulate a pointer to an ML base object.
Definition: mlFields.h:1187
Field to encapsulate a boolean value.
Definition: mlFields.h:62
Base class for all fields used in the ML.
Definition: mlField.h:73
Field to encapsulate a float value.
Definition: mlFields.h:627
ModuleBackgroundTask extends the ImagingBackgroundTask with a number of useful methods that allow asy...
Base class for an image processing module of the ML.
Definition: mlModule.h:156
DcmtkBase derived base object class for base objects that wrap RT related objects.
Definition: mlRTBase.h:34
RTObjectSaveBackgroundTask(Module *module, FloatField *progressField, StringField *statusField)
void setDicomTree(DCMTree::TreePtr dicomTree)
virtual void run() override
run method that needs to be reimplemented (called from worker thread)
void setFilename(const std::string &filename)
Module that stores a RTObject to dcm file.
virtual void handleNotification(Field *field) override
Handle field changes of the field field.
Field to encapsulate a string value.
Definition: mlFields.h:1000
#define ML_MODULE_CLASS_HEADER(className)
Like ML_CLASS_HEADER for the usage of derived classes from Module.
boost::shared_ptr< Tree > TreePtr
shared pointer to a DCMTree::Tree
Definition: DCMTree_Lib.h:70