MeVisLabToolboxReference
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"
26 
27 ML_START_NAMESPACE
28 
29 class RTBase;
30 
32  : public ModuleBackgroundTask
33 {
34 public:
35  RTObjectSaveBackgroundTask(Module* module, FloatField* progressField, StringField* statusField);
36 
38  {
39  _dicomTree.reset();
40  }
41 
43  {
44  if (isSynchronous())
45  {
46  _dicomTree = dicomTree;
47  }
48  else
49  {
50  _dicomTree = dicomTree->copy();
51  }
52  }
53 
54  void setFilename(const std::string& filename) { _filename = filename; }
55 
56  bool hasSuccessfullySaved() const { return _savingWasSuccessful; }
57 
58  virtual void run() override;
59 
60 private:
61  std::string _filename;
62  bool _savingWasSuccessful;
63  DCMTree::TreePtr _dicomTree;
64 };
65 
66 
69 {
70 public:
71 
72  RTObjectSave ();
73 
75  virtual void handleNotification (Field *field) override;
76 
77 private:
78 
79  bool _isInputRTObjectValid();
80 
81  bool _getInputDicomTreeFromBaseField();
82 
83  virtual void taskFinished(BackgroundTask* task) override;
84 
85  virtual ModuleBackgroundTask* createTask() override;
86 
87 
89  BoolField* _autoSaveFld;
91  BaseField* _rtObjectFld;
93  BoolField* _isBaseInputValidFld;
95  StringField* _statusFld;
96  StringField* _dcmFilenameFld;
97  DCMTree::TreePtr _dicomTree;
99  RTBase* _rtObject;
100 
103 };
104 
105 
106 ML_END_NAMESPACE
107 
108 #endif // __mlRTObjectSave_H
109 
virtual void taskFinished(BackgroundTask *task)
Callback for finished/canceled tasks (to be derived, make sure to call parent method).
void setFilename(const std::string &filename)
The ML module class BackgroundTaskBaseModule.
virtual ModuleBackgroundTask * createTask()=0
Request a new task to be created, reimplement this method and make sure that you keep no reference to...
Base class for a task that is started in an extra thread.
virtual void run()=0
run method that needs to be reimplemented (called from worker thread)
Field to encapsulate a boolean value.
Definition: mlFields.h:55
Project global and OS specific declarations.
Module that stores a RTObject to dcm file.
void handleNotification(Field *field) override
Handle field changes of the field field.
bool isSynchronous() const
check if task is synchronous (which means it is NOT run in an extra thread)
#define MLDCMTKMLCONVERTERMODULES_EXPORT
Base class for all fields used in the ML.
Definition: mlField.h:65
Field to encapsulate a pointer to an ML base object.
Definition: mlFields.h:1178
A CSOList comprises a number of CSOs and CSOGroups and is the central object for contour segmentation...
Field to encapsulate a float value.
Definition: mlFields.h:618
This class represents a complete DICOM-message, including sequences etc.
ModuleBackgroundTask extends the ImagingBackgroundTask with a number of useful methods that allow asy...
Field to encapsulate a string value.
Definition: mlFields.h:991
void setDicomTree(DCMTree::TreePtr dicomTree)
Base class for ML modules that use background tasks.
This file includes most files needed to implement new ML modules.
#define ML_MODULE_CLASS_HEADER(className)
Like ML_CLASS_HEADER for the usage of derived classes from Module.
Base class for an image processing module of the ML.
Definition: mlModule.h:152
DcmtkBase derived base object class for base objects that wrap RT related objects.
Definition: mlRTBase.h:33
boost::shared_ptr< Tree > TreePtr
shared pointer to a DCMTree::Tree
Definition: DCMTree_Lib.h:69