-#ifndef __FPA__BASE__REGIONGROW__H__
-#define __FPA__BASE__REGIONGROW__H__
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
-#include <queue>
-#include <vector>
-#include <fpa/Base/Algorithm.h>
+#ifndef __fpa__Base__RegionGrow__h__
+#define __fpa__Base__RegionGrow__h__
+
+#include <itkFunctionBase.h>
namespace fpa
{
{
/**
*/
- template< class V, class R, class VV, class VC >
- class RegionGrowTraits
- {
- public:
- typedef R TResult;
- typedef V TVertex;
- typedef VV TVertexValue;
- typedef VC TVertexCmp;
-
- typedef bool TCost;
- typedef long TFrontId;
-
- class TNode
- {
- public:
- TNode( )
- { }
- TNode( const TVertex& v, const TFrontId& f )
- : Vertex( v ),
- Parent( v ),
- FrontId( f )
- { }
- TNode( const TVertex& v, const TResult& r, const TFrontId& f )
- : Vertex( v ),
- Parent( v ),
- Result( r ),
- FrontId( f )
- { }
- virtual ~TNode( )
- { }
-
- TVertex Vertex;
- TVertex Parent;
- TResult Result;
- TFrontId FrontId;
- };
-
- typedef std::vector< TNode > TNodes;
- };
-
- /**
- * Region grow is a front propagation with no costs.
- */
- template< class V, class R, class VV, class VC, class B >
+ template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
class RegionGrow
- : public Algorithm< RegionGrowTraits< V, R, VV, VC >, B >
+ : public _TFilter,
+ public _TMarksInterface,
+ public _TSeedsInterface
{
public:
- typedef V TVertex;
- typedef R TResult;
- typedef VV TVertexValue;
- typedef B TBaseFilter;
+ typedef RegionGrow Self;
+ typedef _TFilter Superclass;
+ typedef _TMarksInterface TMarksInterface;
+ typedef _TSeedsInterface TSeedsInterface;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
- /// Standard class typdedefs
- typedef RegionGrowTraits< V, R, VV, VC > TTraits;
- typedef RegionGrow Self;
- typedef Algorithm< TTraits, B > Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
+ typedef typename Superclass::TInputValue TInputValue;
+ typedef typename Superclass::TOutputValue TOutputValue;
+ typedef typename Superclass::TVertex TVertex;
+ typedef typename Superclass::TVertices TVertices;
- typedef typename TTraits::TCost TCost;
+ typedef itk::FunctionBase< TInputValue, bool > TIntensityFunctor;
+ typedef itk::FunctionBase< TVertex, bool > TVertexFunctor;
- protected:
- typedef typename TTraits::TFrontId _TFrontId;
- typedef typename TTraits::TNode _TNode;
- typedef typename TTraits::TNodes _TNodes;
- typedef std::queue< _TNode > _TQueue;
+ public:
+ itkTypeMacro( RegionGrow, TFilter );
+
+ itkGetConstMacro( InsideValue, TOutputValue );
+ itkGetConstMacro( OutsideValue, TOutputValue );
+
+ itkSetMacro( InsideValue, TOutputValue );
+ itkSetMacro( OutsideValue, TOutputValue );
public:
- itkTypeMacro( RegionGrow, Algorithm );
+ const TIntensityFunctor* GetIntensityPredicate( ) const;
+ const TVertexFunctor* GetVertexPredicate( ) const;
+
+ void SetPredicate( TIntensityFunctor* functor );
+ void SetPredicate( TVertexFunctor* functor );
protected:
RegionGrow( );
virtual ~RegionGrow( );
- virtual bool _UpdateResult ( _TNode& n );
- virtual void _InitializeQueue ( );
- virtual bool _IsQueueEmpty ( ) const;
- virtual void _QueuePush ( const _TNode& n );
- virtual _TNode _QueuePop ( );
- virtual void _QueueClear ( );
- virtual bool _UpdateNeigh ( _TNode& nn, const _TNode& n );
-
- virtual bool _CheckMembership( const _TNode& n ) const = 0;
+ virtual void GenerateData( ) override;
private:
- RegionGrow( const Self& ); // Not impl.
- void operator=( const Self& ); // Not impl.
+ RegionGrow( const Self& other );
+ Self& operator=( const Self& other );
protected:
- _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$