]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/RegionGrow.h
CMake updated. Some other filters added.
[FrontAlgorithms.git] / lib / fpa / Base / RegionGrow.h
index 0b5b79744c547a1daa588856128c984590344158..b5ce46e3a6449042659d3858c4ca1d288f09da42 100644 (file)
@@ -4,6 +4,7 @@
 #include <queue>
 #include <utility>
 #include <fpa/Base/Algorithm.h>
+#include <fpa/Base/Functors/TautologyFunction.h>
 
 namespace fpa
 {
@@ -15,26 +16,30 @@ namespace fpa
      * @param V  Vertex type.
      * @param C  Vertex value type.
      * @param R  Result value type.
+     * @param S  Space type where vertices are.
      * @param VC Vertex lexicographical compare.
      * @param B  Base class for this algorithm. It should be any itk-based
      *           filter (itk::ProcessObject).
      *
      */
-    template< class V, class C, class R, class VC, class B >
+    template< class V, class C, class R, class S, class VC, class B >
     class RegionGrow
-      : public Algorithm< V, C, R, VC, B >
+      : public Algorithm< V, C, R, S, VC, B >
     {
     public:
       typedef RegionGrow                       Self;
-      typedef Algorithm< V, C, R, VC, B >      Superclass;
+      typedef Algorithm< V, C, R, S, VC, B >   Superclass;
       typedef itk::SmartPointer< Self >        Pointer;
       typedef itk::SmartPointer< const Self >  ConstPointer;
 
       typedef typename Superclass::TVertex        TVertex;
       typedef typename Superclass::TValue         TValue;
       typedef typename Superclass::TResult        TResult;
+      typedef typename Superclass::TSpace         TSpace;
       typedef typename Superclass::TVertexCompare TVertexCompare;
 
+      typedef fpa::Base::Functors::TautologyFunction< S, V > TGrowingFunction;
+
     protected:
       typedef typename Superclass::_TVertices      _TVertices;
       typedef typename Superclass::_TCollision     _TCollision;
@@ -50,15 +55,18 @@ namespace fpa
 
       itkGetConstMacro( InsideValue, TResult );
       itkGetConstMacro( OutsideValue, TResult );
+      itkGetObjectMacro( GrowingFunction, TGrowingFunction );
+      itkGetConstObjectMacro( GrowingFunction, TGrowingFunction );
 
       itkSetMacro( InsideValue, TResult );
       itkSetMacro( OutsideValue, TResult );
+      itkSetObjectMacro( GrowingFunction, TGrowingFunction );
 
     protected:
       RegionGrow( );
       virtual ~RegionGrow( );
 
-      virtual bool _CheckMembership( const TVertex& v ) const = 0;
+      virtual bool _CheckMembership( const TVertex& v ) const;
 
       // Results-related abstract methods
       virtual bool _ComputeNeighborResult(
@@ -80,6 +88,8 @@ namespace fpa
       TResult m_InsideValue;
       TResult m_OutsideValue;
       _TQueue m_Queue;
+
+      typename TGrowingFunction::Pointer m_GrowingFunction;
     };
 
   } // ecapseman