X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FRegionGrow.h;h=8d7439f74e8a6e065e9730e17588445b01885572;hb=89393f2267e42e921571c0184320d6c6382f34ab;hp=2ef070399aa6416c5ed310b92657c4d26ea90ba9;hpb=6585142e69f2ff5e4fceb21320ab3795c3e82218;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/RegionGrow.h b/lib/fpa/Base/RegionGrow.h index 2ef0703..8d7439f 100644 --- a/lib/fpa/Base/RegionGrow.h +++ b/lib/fpa/Base/RegionGrow.h @@ -1,9 +1,15 @@ +// ========================================================================= +// @author Leonardo Florez Valencia +// @email florez-l@javeriana.edu.co +// ========================================================================= + #ifndef __fpa__Base__RegionGrow__h__ #define __fpa__Base__RegionGrow__h__ -#include -#include -#include +#include + +#include +#include namespace fpa { @@ -11,58 +17,72 @@ namespace fpa { /** */ - template< class _TSuperclass > + template< class _TAlgorithm > class RegionGrow - : public _TSuperclass + : public _TAlgorithm { public: typedef RegionGrow Self; - typedef _TSuperclass Superclass; + typedef _TAlgorithm Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; - typedef typename Superclass::TOutput TOutput; - typedef typename Superclass::TVertex TVertex; + typedef typename _TAlgorithm::TNode TNode; + typedef typename _TAlgorithm::TNodes TNodes; + typedef typename _TAlgorithm::TInputValue TInputValue; + typedef typename _TAlgorithm::TOutputValue TOutputValue; + typedef typename _TAlgorithm::TFrontId TFrontId; + typedef typename _TAlgorithm::TVertex TVertex; - typedef fpa::Base::Functors::RegionGrow::Base< TVertex > TGrowFunction; + typedef std::deque< TNode > TQueue; + typedef itk::FunctionBase< TInputValue, bool > TValuePredicate; + typedef itk::FunctionBase< TVertex, bool > TVertexPredicate; - protected: - typedef typename Superclass::_TQueueNode _TQueueNode; - typedef std::queue< _TQueueNode > _TQueue; + public: + itkConceptMacro( + Check_TOutputValue, + ( itk::Concept::IsUnsignedInteger< TOutputValue > ) + ); public: - itkTypeMacro( RegionGrow, Algorithm ); + itkGetObjectMacro( ValuePredicate, TValuePredicate ); + itkGetObjectMacro( VertexPredicate, TVertexPredicate ); + itkGetConstMacro( InsideValue, TOutputValue ); - itkGetObjectMacro( GrowFunction, TGrowFunction ); - itkGetConstMacro( InsideValue, TOutput ); - itkGetConstMacro( OutsideValue, TOutput ); + itkSetMacro( InsideValue, TOutputValue ); - itkSetObjectMacro( GrowFunction, TGrowFunction ); - itkSetMacro( InsideValue, TOutput ); - itkSetMacro( OutsideValue, TOutput ); + public: + virtual itk::ModifiedTimeType GetMTime( ) const override; + virtual TOutputValue GetOutsideValue( ) const; + virtual void SetOutsideValue( const TOutputValue& v ); + + void SetPredicate( TValuePredicate* p ); + void SetPredicate( TVertexPredicate* p ); protected: RegionGrow( ); virtual ~RegionGrow( ); - virtual bool _UpdateValue( - _TQueueNode& v, const _TQueueNode& p - ) fpa_OVERRIDE; - virtual unsigned long _QueueSize( ) const fpa_OVERRIDE; - virtual void _QueueClear( ) fpa_OVERRIDE; - virtual void _QueuePush( const _TQueueNode& node ) fpa_OVERRIDE; - virtual _TQueueNode _QueuePop( ) fpa_OVERRIDE; + virtual void _ComputeOutputValue( TNode& n ) override; + virtual void _UpdateOutputValue( TNode& n ) override; + virtual void _QueueClear( ) override; + virtual TNode _QueuePop( ) override; + virtual void _QueuePush( const TNode& node ) override; + virtual unsigned long _QueueSize( ) const override; + virtual void _PrepareSeeds( TNodes& nodes ) override; private: - // Purposely not defined + // Purposely not implemented. RegionGrow( const Self& other ); Self& operator=( const Self& other ); protected: - TOutput m_InsideValue; - TOutput m_OutsideValue; - _TQueue m_Queue; - typename TGrowFunction::Pointer m_GrowFunction; + typename TValuePredicate::Pointer m_ValuePredicate; + typename TVertexPredicate::Pointer m_VertexPredicate; + + TOutputValue m_InsideValue; + + TQueue m_Queue; }; } // ecapseman