MeVisLab Toolbox Reference
WEMProcessor.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 "WEMBase/WEM.h"
16#include "WEMGenerator.h"
18
19
21
23
30{
31public:
32
34 WEMProcessor(std::string type="WEMProcessor", bool useInput=true, int numInImages=0, int numOutImages=0, std::string inWEMFieldName="inWEM");
35
36protected:
37
39 ~WEMProcessor() override;
40
41
42 /* FIELDS */
43
47
50
51
52 /* STATE VARIABLES */
53
58
61
63 inline WEMRequirements* getRequirements() { return _requirements; }
64
66 inline bool areEdgesRequired() { return _requirements->areEdgesRequired(); }
68 inline bool isSinglePatchRequired() { return _requirements->isSinglePatchRequired(); }
70 inline bool isPatchTypeRequired(PatchTypes patchType) { return _requirements->isPatchTypeRequired(patchType); }
72 inline bool isOrientationTypeRequired(OrientationTypes orientationType) { return _requirements->isOrientationTypeRequired(orientationType); }
73
75 inline void requireEdges(bool requireEdgesFlag=true) { _requirements->requireEdges(requireEdgesFlag); }
77 inline void requireSinglePatch(bool requireSinglePatchFlag=true) { _requirements->requireSinglePatch(requireSinglePatchFlag); }
79 inline void requirePatchType(PatchTypes patchType) { _requirements->requirePatchType(patchType); }
81 inline void requireOrientationType(OrientationTypes orientationType) { _requirements->requireOrientationType(orientationType); }
82
86
87
88 /* METHODS */
89
93 void activateAttachments() override;
95 void _process() override;
96
100 virtual void _addWEMPatch(WEMPatch* wemPatch, bool mergeAllPatches=false);
102 void _notifyObservers() override;
103
105 static void _wemInputNotificationCB(void* userData, std::vector<WEMEventContainer> ecList);
106
111
114
115private:
116 void _addWEMPatch(ml::WEMPatch*) override {}
117 /* FIELDS */
118
120 BoolField* _listenToFinishNotificationsFld;
122 BoolField* _listenToRepaintNotificationsFld;
124 BoolField* _listenToSelectionChangedNotificationsFld;
125
126 /* METHODS */
127
131 void _warnAboutInvalidUpdateModeOrAutoApplyFieldConfiguration();
132
135 void _setupOutputWEM();
137 void _copyInputWEMToOutputWEMMakeCompatible();
139 bool _doesMakeCompatibleCreateNew(WEMPatch* wemPatch);
140
141 /* VARIABLES */
142
144 WEMRequirements* _requirements;
145
148};
149
151
#define MLWEM_EXPORT
Definition MLWEMSystem.h:18
Field to encapsulate a pointer to an ML base object.
Definition mlFields.h:797
Field to encapsulate a boolean value.
Definition mlFields.h:58
Base class for all fields used in the ML.
Definition mlField.h:73
Field to encapsulate an increasing float value from range [0,1].
Definition mlFields.h:491
TypedEnumField is used to encapsulate a C++ enum value and work with a real enum value instead of int...
Definition mlFields.h:384
The WEMGenerator is the base class for all modules that generate WEMs, be it automatically or interac...
virtual void _addWEMPatch(WEMPatch *wemPatch)
Adds a new WEMPatch to the output list and applies the default attributes.
Base class for triangle and quad patches.
Definition WEMPatch.h:48
The WEMProcessor is the base class for all modules that process WEMs, be it automatically or interact...
void _copyWEMPatch(WEMPatch *wemPatch)
Copy given WEM.
bool _forceCompatible
Make compatible during creation of _outWEM? If new patches are created, _copyInputWEMs is set to true...
TypedEnumField< TriangulationModes > * _triangulationModeFld
Triangulation mode (used to get compatible patch on requireTriangulation).
bool _isNotifyingMyself
Is this module notifying itself?
bool _isInNotificationCB
Is this module currently in the notification callback?
bool isOrientationTypeRequired(OrientationTypes orientationType)
Is orientation type required?
void _process() override
Triggers the computation of the preprocessing.
bool areEdgesRequired()
Are edges required?
void requirePatchType(PatchTypes patchType)
Require patch type.
WEMPatch * _makeCompatible(WEMPatch *wemPatch)
Make given WEMPatch compatible with module requirements.
static void _wemInputNotificationCB(void *userData, std::vector< WEMEventContainer > ecList)
Callback method that gets triggered on notifications sent to the input WEM.
WEMRequirements * getRequirements()
Get requirements.
bool isSinglePatchRequired()
Is a single patch required?
void requireOrientationType(OrientationTypes orientationType)
Require orientation type.
bool isPatchTypeRequired(PatchTypes patchType)
Is patch type required?
~WEMProcessor() override
Standard destructor.
void requireSinglePatch(bool requireSinglePatchFlag=true)
Require single patch.
void _notifyObservers() override
Notify observers with FINISHED | SELECTION | REPAINT message.
virtual void _addWEMPatch(WEMPatch *wemPatch, bool mergeAllPatches=false)
Adds a new WEMPatch to the output list and optionally applies the default attributes.
void handleNotification(Field *field) override
Called when input changes.
BaseField * _inputWEMFld
Input WEM list field.
void activateAttachments() override
Initialize module after loading.
void requireEdges(bool requireEdgesFlag=true)
Require edges.
WEM * _inWEM
Pointer to inWEM.
WEMProcessor(std::string type="WEMProcessor", bool useInput=true, int numInImages=0, int numOutImages=0, std::string inWEMFieldName="inWEM")
Standard constructor.
BoolField * _workDirectlyOnInputWEMsFld
ProgressField * _progressFld
Progress field.
This class represents WEMPatch requirements to be used by WEMProcessor.
A WEM comprises a number of WEMPatches.
Definition WEM.h:88
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
#define ML_CLASS_HEADER(className)
Same like ML_CLASS_HEADER_EXPORTED with a non existing export symbol.
OrientationTypes
Enumeration of orientation types.
PatchTypes
Enumeration of mesh types.