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#pragma once
14
15#include "librarySystem.h"
16#include <mlModuleIncludes.h>
17#include <CSOBase/CSOList.h>
18#include <DCMTree_Tree.h>
19#include <FMEThirdPartyWarningsDisable.h>
21#include <FMEThirdPartyWarningsRestore.h>
22
23ML_START_NAMESPACE
24
25class RTBase;
26
29{
30public:
31 RTObjectSaveBackgroundTask(Module* module, FloatField* progressField, StringField* statusField);
32
34 {
35 _dicomTree.reset();
36 }
37
39 {
40 if (isSynchronous())
41 {
42 _dicomTree = dicomTree;
43 }
44 else
45 {
46 _dicomTree = dicomTree->copy();
47 }
48 }
49
50 void setFilename(const std::string& filename) { _filename = filename; }
51
52 bool hasSuccessfullySaved() const { return _savingWasSuccessful; }
53
54 virtual void run() override;
55
56private:
57 std::string _filename;
58 bool _savingWasSuccessful;
59 DCMTree::TreePtr _dicomTree;
60};
61
62
65{
66public:
67
69
71 virtual void handleNotification (Field *field) override;
72
73private:
74
75 bool _isInputRTObjectValid();
76
77 bool _getInputDicomTreeFromBaseField();
78
79 virtual void taskFinished(BackgroundTask* task) override;
80
81 virtual ModuleBackgroundTask* createTask() override;
82
83
85 BoolField* _autoSaveFld;
87 BaseField* _rtObjectFld;
89 BoolField* _isBaseInputValidFld;
91 StringField* _statusFld;
92 StringField* _dcmFilenameFld;
93 DCMTree::TreePtr _dicomTree;
95 RTBase* _rtObject;
96
99};
100
101ML_END_NAMESPACE
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
Checks whether the task is synchronous, which means it is not executed in a different thread.
Field to encapsulate a pointer to an ML base object.
Definition mlFields.h:729
Field to encapsulate a boolean value.
Definition mlFields.h:56
Base class for all fields used in the ML.
Definition mlField.h:73
Field to encapsulate a float value.
Definition mlFields.h:389
ModuleBackgroundTask extends the ImagingBackgroundTask with several useful methods that allow asynchr...
Base class for an image processing module of the ML.
Definition mlModule.h:151
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
Method that needs to be reimplemented. This is called from the 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:553
#define ML_MODULE_CLASS_HEADER(className)
Similar to 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:66