MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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{
41public:
43 VTKModule(int inputNum = 0, int outputNum = 0);
44
46 virtual ~VTKModule();
47
50
53
54protected:
57
60
61
63 void setObservedObject(vtkObject* vObj, vtkCommand::EventIds eventId = vtkCommand::AnyEvent, float priority = 0.0f);
64
67
68
72 virtual void handleVTKObject(vtkObject* /*caller*/, unsigned long /*eventId*/, void* /*callData*/) {};
73
77 std::string getInputCheckString() const;
78
83
84private:
87 virtual void _handleManagedVTKObject(vtkObject* caller, unsigned long eventId, void* callData);
88
90 static void _vtkCallbackFunc(vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
91
93 static void _vtkManagedCallbackFunc(vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
94
95
97 bool _suppressHandleVTKObjectCalls;
98
100 vtkCallbackCommand* _observer;
101
103 vtkObject* _observedObject;
104
106 vtkObject* _managedObject;
107
109 vtkCallbackCommand** _managedObservers;
110
113};
114
Base class for an image processing module of the ML.
Definition mlModule.h:150
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:72
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)
Similar to 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.