MeVisLab Toolbox Reference
mlVTKModule.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
15// Include dll-specific settings.
17
18// Include most ml specific things.
19#include "mlModuleIncludes.h"
20
21// Include vtkObject class which is a base class of all automatically VTK
22// objects which potentially can be observed.
23#include <vtkObject.h>
24
25// Include support for subject/observer design pattern of VTK.
26#include <vtkCallbackCommand.h>
27
28// Include the class for dummy polygon data source used as placeholder for NULL polygon data sources.
29#include "vtkPolyDataAlgorithm.h"
30
31
33
34 //----------------------------------------------------------------------------------
38 //----------------------------------------------------------------------------------
40 {
41 public:
42
45
47 virtual ~VTKModule();
48
51
54
55 protected:
56
59
62
63
66 vtkCommand::EventIds eventId=vtkCommand::AnyEvent,
67 float priority = 0.0f);
68
71
72
76 virtual void handleVTKObject(vtkObject * /*caller*/,
77 unsigned long /*eventId*/,
78 void * /*callData*/) { };
79
83 std::string getInputCheckString() const;
84
89
90 private:
91
94 virtual void _handleManagedVTKObject(vtkObject *caller,
95 unsigned long eventId,
96 void *callData);
97
99 static void _vtkCallbackFunc(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata);
100
102 static void _vtkManagedCallbackFunc(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata);
103
104
106 bool _suppressHandleVTKObjectCalls;
107
109 vtkCallbackCommand *_observer;
110
112 vtkObject *_observedObject;
113
115 vtkObject *_managedObject;
116
118 vtkCallbackCommand **_managedObservers;
119
122 };
123
Base class for an image processing module of the ML.
Definition mlModule.h:151
Base class to derive from all modules which wrap automatically generated VTK classes.
Definition mlVTKModule.h:40
std::string getInputCheckString() const
Check input connections whether they are allowed to be open.
void setObservedObject(vtkObject *vObj, vtkCommand::EventIds eventId=vtkCommand::AnyEvent, float priority=0.0f)
The object to be observed. Use NULL as parameter to unregister former objects.
void setManagedObject(vtkObject *vObj)
The object managed by the wrapper. Use NULL as parameter to unregister former objects.
VTKModule(int inputNum=0, int outputNum=0)
Normally used constructor.
vtkObject * getManagedObject()
Return currently managed object.
virtual void handleVTKObject(vtkObject *, unsigned long, void *)
Method called if observing of vtkObject is active and if the vtkObjects posts any event.
Definition mlVTKModule.h:76
virtual ~VTKModule()
Destructor.
vtkPolyDataAlgorithm * getDummyPolyDataAlgorithm(int polyType=0)
Returns an empty vtkPolyDataAlgorithm; to be used when a placeholder is needed.
void suppressHandleVTKObjectCalls(bool suppress)
Set a flag which suppresses handleObject calls if true.
bool areHandleVTKObjectCallsSuppressed()
Returns whether handleObject calls are suppressed.
vtkObject * getObservedObject()
Return currently observed object.
#define ML_MODULE_CLASS_HEADER(className)
Like ML_CLASS_HEADER for the usage of derived classes from Module.
#define MLVTK_SUPPORT_EXPORT
When included by other libraries MLVTK_SUPPORT_EXPORT is compiled as import symbol.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.