]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/Algorithm.h
...
[FrontAlgorithms.git] / lib / fpa / Base / Algorithm.h
index b457b9e52f0e006b0192d4ef3cf8d340355eadbe..5a02d6ebc2e0843a0e6d0bdb1132983c3c22a173 100644 (file)
@@ -6,7 +6,11 @@
 #ifndef __fpa__Base__Algorithm__h__
 #define __fpa__Base__Algorithm__h__
 
+#include <fpa/Config.h>
+
 #include <vector>
+#include <itkObject.h>
+#include <itkEventObject.h>
 
 namespace fpa
 {
@@ -28,26 +32,76 @@ namespace fpa
       typedef itk::SmartPointer< Self >       Pointer;
       typedef itk::SmartPointer< const Self > ConstPointer;
 
-      typedef typename _TMarksInterface::TNode        TNode;
-      typedef typename _TMarksInterface::TOutputValue TOutputValue;
+      typedef typename _TSeedsInterface::TInputValue  TInputValue;
+      typedef typename _TSeedsInterface::TOutputValue TOutputValue;
+      typedef typename _TSeedsInterface::TNode        TNode;
+      typedef typename _TSeedsInterface::TNodes       TNodes;
       typedef typename _TSeedsInterface::TSeeds       TSeeds;
-
-      typedef std::vector< TNode > TNeighborhood;
+      typedef typename _TSeedsInterface::TVertex      TVertex;
+
+      typedef std::vector< TVertex > TNeighborhood;
+
+      /**
+       */
+      class TEvent
+        : public itk::EventObject
+      {
+      public:
+        typedef TEvent           Self;
+        typedef itk::EventObject Superclass;
+
+      public:
+        TEvent( );
+        TEvent( const TVertex& v, unsigned long fid, bool intoq );
+        virtual ~TEvent( );
+        virtual const char* GetEventName( ) const override;
+        virtual bool CheckEvent( const itk::EventObject* e ) const override;
+        virtual itk::EventObject* MakeObject( ) const override;
+
+      private:
+        // Purposely not implemented.
+        Self& operator=( const Self& other );
+
+      public:
+        TVertex       Vertex;
+        unsigned long FrontId;
+        bool          IntoQueue;
+      };
 
     public:
-      itkTypeMacro( Algorithm, TFilter );
+      itkTypeMacro( fpa::Base::Algorithm, _TFilter );
+
+      itkBooleanMacro( VisualDebug );
 
       itkGetConstMacro( InitValue, TOutputValue );
+      itkGetConstMacro( VisualDebug, bool );
+
       itkSetMacro( InitValue, TOutputValue );
+      itkSetMacro( VisualDebug, bool );
+
+    public:
+      virtual void InvokeEvent( const itk::EventObject& e );
+      virtual void InvokeEvent( const itk::EventObject& e ) const;
 
     protected:
       Algorithm( );
       virtual ~Algorithm( );
 
       virtual void GenerateData( ) override;
+      virtual void _BeforeGenerateData( );
+      virtual void _AfterGenerateData( );
+      virtual void _FinishOneLoop( );
+
+      virtual void _QueueInit( );
 
       virtual void _ConfigureOutput( const TOutputValue& v ) = 0;
-      virtual void _QueueInit( ) = 0;
+      virtual TNeighborhood _GetNeighbors( const TVertex& v ) const = 0;
+      virtual TInputValue _GetInputValue( const TVertex& v ) const = 0;
+      virtual TOutputValue _GetOutputValue( const TVertex& v ) const = 0;
+
+      virtual void _ComputeOutputValue( TNode& n ) = 0;
+      virtual void _UpdateOutputValue( TNode& n ) = 0;
+      virtual void _QueueClear( ) = 0;
       virtual void _QueuePush( const TNode& node ) = 0;
       virtual unsigned long _QueueSize( ) const = 0;
       virtual TNode _QueuePop( ) = 0;
@@ -58,6 +112,7 @@ namespace fpa
       Self& operator=( const Self& other );
 
     protected:
+      bool m_VisualDebug;
       TOutputValue m_InitValue;
     };