-#ifndef __FPA__BASE__REGIONGROW__H__
-#define __FPA__BASE__REGIONGROW__H__
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
-#include <queue>
-#include <fpa/Base/Algorithm.h>
+#ifndef __fpa__Base__RegionGrow__h__
+#define __fpa__Base__RegionGrow__h__
+
+#include <itkFunctionBase.h>
namespace fpa
{
namespace Base
{
/**
- * Region grow is a front propagation with no costs.
- *
- * @param V Vertex type.
- * @param C Vertex value type.
- * @param R Result value type.
- * @param B Base class for this algorithm. It should be any itk-based
- * filter (itk::ProcessObject).
- *
*/
- template< class V, class C, class R, class B >
+ template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
class RegionGrow
- : public Algorithm< V, C, R, B >
+ : public _TFilter,
+ public _TMarksInterface,
+ public _TSeedsInterface
{
public:
- typedef RegionGrow Self;
- typedef Algorithm< V, C, R, 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 RegionGrow Self;
+ typedef _TFilter Superclass;
+ typedef _TMarksInterface TMarksInterface;
+ typedef _TSeedsInterface TSeedsInterface;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
- protected:
- typedef typename Superclass::_TVertices _TVertices;
- typedef typename Superclass::_TCollision _TCollision;
- typedef typename Superclass::_TCollisionsRow _TCollisionsRow;
- typedef typename Superclass::_TCollisions _TCollisions;
- typedef typename Superclass::_TNode _TNode;
- typedef typename Superclass::_TNodes _TNodes;
+ typedef typename Superclass::TInputValue TInputValue;
+ typedef typename Superclass::TOutputValue TOutputValue;
+ typedef typename Superclass::TVertex TVertex;
+ typedef typename Superclass::TVertices TVertices;
- typedef std::queue< _TNode > _TQueue;
+ 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 );
- itkGetConstMacro( InsideValue, TResult );
- itkGetConstMacro( OutsideValue, TResult );
+ itkSetMacro( InsideValue, TOutputValue );
+ itkSetMacro( OutsideValue, TOutputValue );
- itkSetMacro( InsideValue, TResult );
- itkSetMacro( OutsideValue, TResult );
+ public:
+ const TIntensityFunctor* GetIntensityPredicate( ) const;
+ const TVertexFunctor* GetVertexPredicate( ) const;
+
+ void SetPredicate( TIntensityFunctor* functor );
+ void SetPredicate( TVertexFunctor* functor );
protected:
RegionGrow( );
virtual ~RegionGrow( );
- virtual bool _CheckMembership( const TVertex& v ) const = 0;
-
- // Results-related abstract methods
- virtual bool _ComputeNeighborResult(
- TResult& result, const TVertex& neighbor, const TVertex& parent
- ) const;
-
- // Queue-related abstract methods
- virtual bool _IsQueueEmpty( ) const;
- virtual void _QueuePush( const _TNode& n );
- virtual _TNode _QueuePop( );
- virtual void _QueueClear( );
+ virtual void GenerateData( ) override;
private:
- // Purposely not implemented
RegionGrow( const Self& other );
Self& operator=( const Self& other );
protected:
- TResult m_InsideValue;
- TResult m_OutsideValue;
- _TQueue m_Queue;
+ typename TIntensityFunctor::Pointer m_IntensityFunctor;
+ typename TVertexFunctor::Pointer m_VertexFunctor;
+ TOutputValue m_InsideValue;
+ TOutputValue m_OutsideValue;
};
} // ecapseman
} // ecapseman
-#include <fpa/Base/RegionGrow.hxx>
+#ifndef ITK_MANUAL_INSTANTIATION
+# include <fpa/Base/RegionGrow.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
-#endif // __FPA__BASE__REGIONGROW__H__
+#endif // __fpa__Base__RegionGrow__h__
// eof - $RCSfile$