]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/RegionGrow.h
...
[FrontAlgorithms.git] / lib / fpa / Base / RegionGrow.h
index 615059f471bdfdee457d43787b89b22c8eb743a7..2586033f0f7d1d38ea5eeb491f8a188760bfb6c5 100644 (file)
@@ -1,9 +1,12 @@
-#ifndef __FPA__BASE__REGIONGROW__H__
-#define __FPA__BASE__REGIONGROW__H__
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Base__RegionGrow__h__
+#define __fpa__Base__RegionGrow__h__
 
-#include <deque>
 #include <itkFunctionBase.h>
-#include <fpa/Base/Algorithm.h>
 
 namespace fpa
 {
@@ -11,65 +14,59 @@ namespace fpa
   {
     /**
      */
-    template< class _TSuperclass >
+    template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
     class RegionGrow
-      : public _TSuperclass
+      : public _TFilter,
+        public _TMarksInterface,
+        public _TSeedsInterface
     {
     public:
       typedef RegionGrow                      Self;
-      typedef _TSuperclass                    Superclass;
+      typedef _TFilter                        Superclass;
+      typedef _TMarksInterface                TMarksInterface;
+      typedef _TSeedsInterface                TSeedsInterface;
       typedef itk::SmartPointer< Self >       Pointer;
       typedef itk::SmartPointer< const Self > ConstPointer;
 
-      // Template arguments
-      typedef typename Superclass::TVertex        TVertex;
-      typedef typename Superclass::TScalar        TScalar;
-      typedef typename Superclass::TFilter        TFilter;
-      typedef typename Superclass::TVertexCompare TVertexCompare;
-      typedef typename Superclass::TFrontId       TFrontId;
-      typedef typename Superclass::TCollision     TCollision;
-      typedef typename Superclass::TCollisionsRow TCollisionsRow;
-      typedef typename Superclass::TCollisions    TCollisions;
-      typedef typename Superclass::TNodeLabel     TNodeLabel;
-      typedef typename Superclass::TNode          TNode;
-      typedef typename Superclass::TNodes         TNodes;
-      typedef typename Superclass::TVertices      TVertices;
-
-      typedef itk::FunctionBase< TVertex, bool > TRegionGrowFunction;
+      typedef typename Superclass::TInputValue  TInputValue;
+      typedef typename Superclass::TOutputValue TOutputValue;
+      typedef typename Superclass::TVertex      TVertex;
+      typedef typename Superclass::TVertices    TVertices;
+
+      typedef itk::FunctionBase< TInputValue, bool > TIntensityFunctor;
+      typedef itk::FunctionBase< TVertex, bool >     TVertexFunctor;
 
     public:
-      itkTypeMacro( RegionGrow, Algorithm );
+      itkTypeMacro( RegionGrow, TFilter );
+
+      itkGetConstMacro( InsideValue, TOutputValue );
+      itkGetConstMacro( OutsideValue, TOutputValue );
 
-      itkGetObjectMacro( RegionGrowFunction, TRegionGrowFunction );
-      itkGetConstMacro( InsideValue, TScalar );
-      itkGetConstMacro( OutsideValue, TScalar );
+      itkSetMacro( InsideValue, TOutputValue );
+      itkSetMacro( OutsideValue, TOutputValue );
+
+    public:
+      const TIntensityFunctor* GetIntensityPredicate( ) const;
+      const TVertexFunctor* GetVertexPredicate( ) const;
 
-      itkSetObjectMacro( RegionGrowFunction, TRegionGrowFunction );
-      itkSetMacro( InsideValue, TScalar );
-      itkSetMacro( OutsideValue, TScalar );
+      void SetPredicate( TIntensityFunctor* functor );
+      void SetPredicate( TVertexFunctor* functor );
 
     protected:
-      // Methods to extend itk-based architecture
       RegionGrow( );
       virtual ~RegionGrow( );
 
-      // Front propagation methods to be overloaded
-      virtual bool _Result( TNode& node, const TNode& parent ) fpa_OVERRIDE;
-      virtual void  _QueueClear( ) fpa_OVERRIDE;
-      virtual void  _QueuePush( const TNode& node ) fpa_OVERRIDE;
-      virtual TNode _QueuePop( ) fpa_OVERRIDE;
-      virtual bool  _IsQueueEmpty( ) const fpa_OVERRIDE;
+      virtual void GenerateData( ) override;
 
     private:
-      // Purposely not implemented
       RegionGrow( const Self& other );
       Self& operator=( const Self& other );
 
     protected:
-      std::deque< TNode > m_Queue;
-      typename TRegionGrowFunction::Pointer m_RegionGrowFunction;
-      TScalar m_InsideValue;
-      TScalar m_OutsideValue;
+      typename TIntensityFunctor::Pointer m_IntensityFunctor;
+      typename TVertexFunctor::Pointer m_VertexFunctor;
+      TOutputValue m_InsideValue;
+      TOutputValue m_OutsideValue;
     };
 
   } // ecapseman
@@ -78,8 +75,8 @@ namespace fpa
 
 #ifndef ITK_MANUAL_INSTANTIATION
 #  include <fpa/Base/RegionGrow.hxx>
-#endif
+#endif // ITK_MANUAL_INSTANTIATION
 
-#endif // __FPA__BASE__REGIONGROW__H__
+#endif // __fpa__Base__RegionGrow__h__
 
 // eof - $RCSfile$