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 
20 ML_START_NAMESPACE
21 
23 
30 {
31 public:
32 
34  WEMProcessor(std::string type="WEMProcessor", bool useInput=true, int numInImages=0, int numOutImages=0, std::string inWEMFieldName="inWEM");
35 
36 protected:
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 
91  void handleNotification(Field *field) override;
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 
110  void _copyWEMPatch(WEMPatch *wemPatch);
111 
114 
115 private:
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 
152 ML_END_NAMESPACE
#define MLWEM_EXPORT
Definition: MLWEMSystem.h:18
Field to encapsulate a pointer to an ML base object.
Definition: mlFields.h:1187
Field to encapsulate a boolean value.
Definition: mlFields.h:62
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:744
The WEMGenerator is the base class for all modules that generate WEMs, be it automatically or interac...
Definition: WEMGenerator.h:28
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...
Definition: WEMProcessor.h:30
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...
Definition: WEMProcessor.h:85
TypedEnumField< TriangulationModes > * _triangulationModeFld
Triangulation mode (used to get compatible patch on requireTriangulation).
Definition: WEMProcessor.h:49
bool _isNotifyingMyself
Is this module notifying itself?
Definition: WEMProcessor.h:60
bool _isInNotificationCB
Is this module currently in the notification callback?
Definition: WEMProcessor.h:57
WEMPatch * _makeCompatible(WEMPatch *wemPatch)
Make given WEMPatch compatible with module requirements.
bool isOrientationTypeRequired(OrientationTypes orientationType)
Is orientation type required?
Definition: WEMProcessor.h:72
void _process() override
Triggers the computation of the preprocessing.
bool areEdgesRequired()
Are edges required?
Definition: WEMProcessor.h:66
void requirePatchType(PatchTypes patchType)
Require patch type.
Definition: WEMProcessor.h:79
static void _wemInputNotificationCB(void *userData, std::vector< WEMEventContainer > ecList)
Callback method that gets triggered on notifications sent to the input WEM.
bool isSinglePatchRequired()
Is a single patch required?
Definition: WEMProcessor.h:68
void requireOrientationType(OrientationTypes orientationType)
Require orientation type.
Definition: WEMProcessor.h:81
WEMRequirements * getRequirements()
Get requirements.
Definition: WEMProcessor.h:63
bool isPatchTypeRequired(PatchTypes patchType)
Is patch type required?
Definition: WEMProcessor.h:70
~WEMProcessor() override
Standard destructor.
void requireSinglePatch(bool requireSinglePatchFlag=true)
Require single patch.
Definition: WEMProcessor.h:77
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.
Definition: WEMProcessor.h:113
void activateAttachments() override
Initialize module after loading.
void requireEdges(bool requireEdgesFlag=true)
Require edges.
Definition: WEMProcessor.h:75
WEM * _inWEM
Pointer to inWEM.
Definition: WEMProcessor.h:55
WEMProcessor(std::string type="WEMProcessor", bool useInput=true, int numInImages=0, int numOutImages=0, std::string inWEMFieldName="inWEM")
Standard constructor.
BoolField * _workDirectlyOnInputWEMsFld
Definition: WEMProcessor.h:44
ProgressField * _progressFld
Progress field.
Definition: WEMProcessor.h:46
This class represents WEMPatch requirements to be used by WEMProcessor.
A WEM comprises a number of WEMPatches.
Definition: WEM.h:88
#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.