MeVisLabToolboxReference
MeVisLab/Standard/Sources/ML/MLWEM/WEMBase/WEMModuleBase/WEMProcessor.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00008 
00015 #ifndef __WEMProcessor_H
00016 #define __WEMProcessor_H
00017 
00018 #include "WEMBase/WEM.h"
00019 #include "WEMGenerator.h"
00020 #include "WEMBase/WEMRequirements.h"
00021 
00022 
00023 ML_START_NAMESPACE
00024 
00026 
00032 class MLWEM_EXPORT WEMProcessor : public WEMGenerator
00033 {
00034 
00035 public:
00036 
00038   WEMProcessor(std::string type="WEMProcessor", bool useInput=true, int numInImages=0,int numOutImages=0);
00039 
00040 protected:
00041 
00043   virtual ~WEMProcessor();
00044 
00045 
00046   /* FIELDS */
00047 
00049   BoolField* _copyInputWEMsFld;
00051   ProgressField* _progressFld;
00052 
00054   EnumField* _triangulationModeFld;
00055 
00058   BoolField* _useInputWEMToCreateOutputWEMFld;
00059 
00060 
00061   /* STATE VARIABLES */
00062 
00064   WEM* _inWEM;
00066   bool _isInNotificationCB;
00067 
00069   bool _isNotifyingMyself;
00070 
00072   inline WEMRequirements* getRequirements() { return _requirements; }
00073 
00075   inline bool areEdgesRequired() { return _requirements->areEdgesRequired(); }
00077   inline bool isPatchTypeRequired(PatchTypes patchType) { return _requirements->isPatchTypeRequired(patchType); }
00079   inline bool isOrientationTypeRequired(OrientationTypes orientationType) { return _requirements->isOrientationTypeRequired(orientationType); }
00080 
00082   inline void requireEdges(bool requireEdgesFlag=true) { _requirements->requireEdges(requireEdgesFlag); }
00084   inline void requirePatchType(PatchTypes patchType) { _requirements->requirePatchType(patchType); }
00086   inline void requireOrientationType(OrientationTypes orientationType) { _requirements->requireOrientationType(orientationType); }
00087 
00090   bool _forceCompatible;
00091 
00092 
00093   /* METHODS */
00094 
00096   virtual void handleNotification(Field *field);
00098   virtual void activateAttachments();
00100   virtual void _process();
00102   virtual void _inWEMChanged();
00104   virtual void _addWEMPatch(WEMPatch* wemPatch);
00106   virtual void _notifyObservers();
00107 
00109   static void _wemInputNotificationCB(void* userData, std::vector<WEMEventContainer> ecList);
00111   static void _wemOutputNotificationCB(void* userData, std::vector<WEMEventContainer> ecList);
00112 
00114   WEMPatch* _makeCompatible(WEMPatch* wemPatch);
00116   void _copyWEMPatch(WEMPatch *wemPatch);
00117 
00118 
00119 private:
00120 
00121   /* FIELDS */
00122 
00124   BaseField* _inputWEMFld;
00126   BoolField* _listenToFinishNotificationsFld;
00128   BoolField* _listenToRepaintNotificationsFld;
00130   BoolField* _listenToSelectionChangedNotificationsFld;  
00132   BoolField* _forwardRepaintNotificationsFld;
00134   BoolField* _forwardSelectionNotificationsFld;
00135 
00136 
00137   /* METHODS */
00138 
00140   void _forwardInputNotifications(std::vector<WEMEventContainer> ecList);
00142   void _forwardOutputNotifications(std::vector<WEMEventContainer> ecList);
00143   
00144 
00146   bool _doesMakeCompatibleCreateNew(WEMPatch* wemPatch);
00147 
00148   /* VARIABLES */
00149   
00151   WEMRequirements* _requirements;
00152 
00154   ML_CLASS_HEADER(WEMProcessor)
00155 
00156 };
00157 
00159 
00160 
00161 ML_END_NAMESPACE
00162 
00163 #endif // __WEMProcessor_H
00164