]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Filters/Algorithm.h
...
[FrontAlgorithms.git] / lib / fpa / Filters / Algorithm.h
index f0a6cfba26d579a942cbc697da92fc32f78236d0..bf0a44fc4d976bf8c626b200eaef76ab24ffe077 100644 (file)
@@ -6,7 +6,7 @@
 #define __fpa__Filters__Algorithm__h__
 
 #include <set>
-#include <itkConceptChecking.h>
+#include <itkDataObject.h>
 #include <fpa/Config.h>
 #include <fpa/Filters/Event.h>
 
@@ -18,29 +18,23 @@ namespace fpa
      */
     template< class _TTraits >
     class Algorithm
-      : public _TTraits::TFilter,
+      : public _TTraits::TFilterInterface,
         public _TTraits::TMarksInterface,
         public _TTraits::TSeedsInterface
     {
     public:
       typedef _TTraits TTraits;
-      fpaTraitsMacro( typename, TTraits );
+      fpaTraitsMacro( typename TTraits );
 
-      typedef TFilter                         Superclass;
-      typedef Algorithm                       Self;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
+      typedef typename TTraits::TFilterInterface Superclass;
+      typedef Algorithm                          Self;
+      typedef itk::SmartPointer< Self >          Pointer;
+      typedef itk::SmartPointer< const Self >    ConstPointer;
 
       typedef fpa::Filters::Event< TVertex > TEvent;
 
-    protected:
-      itkConceptMacro(
-        Check_Marks,
-        ( itk::Concept::IsUnsignedInteger< TMark > )
-        );
-
     public:
-      itkTypeMacro( fpa::Filters::Image::Algorithm, TFilter );
+      itkTypeMacro( fpa::Filters::Algorithm, TTraits::TFilterInterface );
 
       itkBooleanMacro( VisualDebug );
       itkGetConstMacro( VisualDebug, bool );
@@ -58,6 +52,7 @@ namespace fpa
       Algorithm( );
       virtual ~Algorithm( );
 
+      // Main algorithm method
       virtual void GenerateData( ) override;
 
       // Object association
@@ -65,41 +60,46 @@ namespace fpa
       void _Deassociate( itk::Object* o );
       void _DeassociateAll( );
 
-      // Preparation and termination
+      // Pipeline related methods
       virtual void _BeforeGenerateData( );
       virtual void _AfterGenerateData( );
-      virtual void _Reinitialize( );
 
-      // Memory allocation
+      // Filter related methods
+      virtual void _AssignOutputValue( const TNode& n ) = 0;
       virtual void _ConfigureOutputs( ) = 0;
-
-      // Value assignation/recuperation
-      virtual const itk::DataObject* _GetReferenceInput( ) const;
       virtual TInputValue _GetInputValue( const TVertex& v ) const = 0;
       virtual TInputValue _GetInputValue( const TNode& n ) const;
       virtual TOutputValue _GetOutputValue( const TVertex& v ) const = 0;
       virtual TOutputValue _GetOutputValue( const TNode& n ) const;
       virtual TNeighborhood _GetNeighbors( const TVertex& v ) const = 0;
-      virtual void _UpdateOutputValue( TNode& n ) = 0;
+      virtual TNeighborhood _GetNeighbors( const TNode& n ) const;
+      virtual const itk::DataObject* _GetReferenceInput( ) const;
+
+      // Marks related methods
+      virtual bool _IsMarked( const TVertex& v ) const = 0;
+      virtual bool _IsMarked( const TNode& n ) const;
+      virtual bool _IsNotMarked( const TVertex& v ) const;
+      virtual bool _IsNotMarked( const TNode& n ) const;
+      virtual void _Mark( const TNode& n ) = 0;
 
-      // Queue management
+      // Queue related methods
       virtual void _QueueClear( ) = 0;
       virtual TNode _QueuePop( ) = 0;
       virtual void _QueuePush( const TNode& n ) = 0;
       virtual unsigned long _QueueSize( ) const = 0;
 
-      // Value update according to the particular algorithm
-      virtual void _ComputeOutputValue( TNode& n ) = 0;
+      // Algoritm related methods
+      virtual void _PostComputeOutputValue( TNode& n ) = 0;
+      virtual void _PreComputeOutputValue( TNode& n ) = 0;
+      virtual void _Reinitialize( );
 
     private:
-      // Purposely not implemented.
       Algorithm( const Self& other );
       Self& operator=( const Self& other );
 
     protected:
       bool m_VisualDebug;
       TOutputValue m_InitValue;
-
       std::set< itk::Object* > m_AssociatedObjects;
     };
 
@@ -110,6 +110,5 @@ namespace fpa
 #ifndef ITK_MANUAL_INSTANTIATION
 #  include <fpa/Filters/Algorithm.hxx>
 #endif // ITK_MANUAL_INSTANTIATION
-
 #endif // __fpa__Filters__Algorithm__h__
 // eof - $RCSfile$