X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FRegionGrow.h;h=8d7439f74e8a6e065e9730e17588445b01885572;hb=89393f2267e42e921571c0184320d6c6382f34ab;hp=4790b851a9273768e1d0ae5f4cf1e79e03d025aa;hpb=d93ab4fea6dbc791560451ecdc4bf7555d8cf11d;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/RegionGrow.h b/lib/fpa/Base/RegionGrow.h index 4790b85..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,59 +17,72 @@ namespace fpa { /** */ - template< class _TSuperclass > + template< class _TAlgorithm > class RegionGrow - : public fpa::Base::QueueAlgorithm< _TSuperclass > + : public _TAlgorithm { public: - typedef RegionGrow Self; - typedef fpa::Base::QueueAlgorithm< _TSuperclass > Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; - - typedef typename Superclass::TOutput TOutput; - typedef typename Superclass::TVertex TVertex; - typedef fpa::Base::Functors::RegionGrow::Base< TVertex, TOutput > TGrowFunction; + typedef RegionGrow Self; + typedef _TAlgorithm Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + 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 std::deque< TNode > TQueue; + typedef itk::FunctionBase< TInputValue, bool > TValuePredicate; + typedef itk::FunctionBase< TVertex, bool > TVertexPredicate; - protected: - typedef typename Superclass::_TQueueNode _TQueueNode; + public: + itkConceptMacro( + Check_TOutputValue, + ( itk::Concept::IsUnsignedInteger< TOutputValue > ) + ); public: - itkTypeMacro( RegionGrow, Algorithm ); + itkGetObjectMacro( ValuePredicate, TValuePredicate ); + itkGetObjectMacro( VertexPredicate, TVertexPredicate ); + itkGetConstMacro( InsideValue, TOutputValue ); + + itkSetMacro( InsideValue, TOutputValue ); public: - TGrowFunction* GetGrowFunction( ); - const TGrowFunction* GetGrowFunction( ) const; - TOutput GetInsideValue( ) const; - TOutput GetOutsideValue( ) const; + virtual itk::ModifiedTimeType GetMTime( ) const override; + virtual TOutputValue GetOutsideValue( ) const; + virtual void SetOutsideValue( const TOutputValue& v ); - void SetGrowFunction( TGrowFunction* f ); - void SetInsideValue( const TOutput& v ); - void SetOutsideValue( const TOutput& v ); + void SetPredicate( TValuePredicate* p ); + void SetPredicate( TVertexPredicate* p ); protected: RegionGrow( ); virtual ~RegionGrow( ); - virtual bool _UpdateValue( - _TQueueNode& v, const _TQueueNode& p - ) override; - virtual TOutput _GetInputValue( const _TQueueNode& v, const _TQueueNode& p ) override - { - TOutput res = this->m_InitResult; - if( this->m_GrowFunction.IsNotNull( ) ) - res = this->m_GrowFunction->Evaluate( v.Vertex, p.Vertex ); - return( res ); - } - + 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: - typename TGrowFunction::Pointer m_GrowFunction; + typename TValuePredicate::Pointer m_ValuePredicate; + typename TVertexPredicate::Pointer m_VertexPredicate; + + TOutputValue m_InsideValue; + + TQueue m_Queue; }; } // ecapseman