MeVisLab Toolbox Reference
mlITKCommandIterationUpdate.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #pragma once
14 
16 #include "mlInitSystemITKSupport.h"
17 #include "mlModuleIncludes.h"
18 #include <itkCommand.h>
19 
20 ML_START_NAMESPACE
21 
22 //----------------------------------------------------------------------------------
24 //----------------------------------------------------------------------------------
25 class MLITK_SUPPORT_EXPORT ITKCommandIterationUpdate : public itk::Command
26 {
27 public:
28 
31 
33  typedef itk::Command Superclass;
34 
36  typedef itk::SmartPointer<Self> Pointer;
37 
39  typedef itk::SmartPointer<const Self> ConstPointer;
40 
43 
46 
49  void setObject(itk::Object *object);
50 
53  void setStringField(StringField *strField);
54 
58 
61  void setEndEventField(Field *strField);
62 
65 
67  void reset();
68 
69 protected:
70 
73 
76 
78  void Execute(itk::Object *obj, const itk::EventObject &event) override;
79 
82  void Execute(const itk::Object *obj, const itk::EventObject &event) override;
83 
84 private:
85 
87  unsigned long _observerHandleStartEvent;
88 
90  unsigned long _observerHandleIterationEvent;
91 
93  unsigned long _observerHandleEndEvent;
94 
96  unsigned long _registered;
97 
99  itk::Object *_object;
100 
102  ml::StringField *_stringField;
103 
105  ml::Field *_endEventField;
106 
108  int _eventCounter;
109 };
110 
111 ML_END_NAMESPACE
Base class for all fields used in the ML.
Definition: mlField.h:73
Implementation of the Command Pattern to be invoked every iteration.
void setEndEventField(Field *strField)
Set field to be notified on EndEvents.
~ITKCommandIterationUpdate()
Destructor. Purposely implemented protected.
void Execute(itk::Object *obj, const itk::EventObject &event) override
Wrapper call to the const version.
void reset()
Reset update state.
itkNewMacro(Self)
Method for creation through the object factory.
void setObject(itk::Object *object)
Set object to be observed.
itk::SmartPointer< const Self > ConstPointer
ConstSmart pointer typedef support.
itk::SmartPointer< Self > Pointer
Smart pointer typedef support.
ITKCommandIterationUpdate Self
Standard Self typedef.
StringField * getStringField() const
Get string field to be updated on object changes or NULL if no field is set.
void Execute(const itk::Object *obj, const itk::EventObject &event) override
Gets object state and updates _stringField with process information if stringField is valid.
void setStringField(StringField *strField)
Set string field to be updated on object changes.
Field * getEndEventField() const
Get field to be notified on EndEvents or NULL if no field is set.
itk::Command Superclass
Standard "Superclass" typedef.
itkTypeMacro(ITKCommandIterationUpdate, ::itk::Command)
Run-time type information (and related methods).
ITKCommandIterationUpdate()
Constructor. Purposely implemented protected.
Field to encapsulate a string value.
Definition: mlFields.h:1000
#define MLITK_SUPPORT_EXPORT
When included by other libraries MLITK_SUPPORT_EXPORT is compiled as import symbol.