X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FRegionGrow.h;h=8d7439f74e8a6e065e9730e17588445b01885572;hb=89393f2267e42e921571c0184320d6c6382f34ab;hp=2586033f0f7d1d38ea5eeb491f8a188760bfb6c5;hpb=f287dfe5d76525d02c37224c0a09ed6277fbbb52;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/RegionGrow.h b/lib/fpa/Base/RegionGrow.h index 2586033..8d7439f 100644 --- a/lib/fpa/Base/RegionGrow.h +++ b/lib/fpa/Base/RegionGrow.h @@ -6,6 +6,9 @@ #ifndef __fpa__Base__RegionGrow__h__ #define __fpa__Base__RegionGrow__h__ +#include + +#include #include namespace fpa @@ -14,59 +17,72 @@ namespace fpa { /** */ - template< class _TFilter, class _TMarksInterface, class _TSeedsInterface > + template< class _TAlgorithm > class RegionGrow - : public _TFilter, - public _TMarksInterface, - public _TSeedsInterface + : public _TAlgorithm { public: typedef RegionGrow Self; - typedef _TFilter Superclass; - typedef _TMarksInterface TMarksInterface; - typedef _TSeedsInterface TSeedsInterface; + typedef _TAlgorithm 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 _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 itk::FunctionBase< TInputValue, bool > TIntensityFunctor; - typedef itk::FunctionBase< TVertex, bool > TVertexFunctor; + typedef std::deque< TNode > TQueue; + typedef itk::FunctionBase< TInputValue, bool > TValuePredicate; + typedef itk::FunctionBase< TVertex, bool > TVertexPredicate; public: - itkTypeMacro( RegionGrow, TFilter ); + itkConceptMacro( + Check_TOutputValue, + ( itk::Concept::IsUnsignedInteger< TOutputValue > ) + ); + public: + itkGetObjectMacro( ValuePredicate, TValuePredicate ); + itkGetObjectMacro( VertexPredicate, TVertexPredicate ); itkGetConstMacro( InsideValue, TOutputValue ); - itkGetConstMacro( OutsideValue, TOutputValue ); itkSetMacro( InsideValue, TOutputValue ); - itkSetMacro( OutsideValue, TOutputValue ); public: - const TIntensityFunctor* GetIntensityPredicate( ) const; - const TVertexFunctor* GetVertexPredicate( ) const; + virtual itk::ModifiedTimeType GetMTime( ) const override; + virtual TOutputValue GetOutsideValue( ) const; + virtual void SetOutsideValue( const TOutputValue& v ); - void SetPredicate( TIntensityFunctor* functor ); - void SetPredicate( TVertexFunctor* functor ); + void SetPredicate( TValuePredicate* p ); + void SetPredicate( TVertexPredicate* p ); protected: RegionGrow( ); virtual ~RegionGrow( ); - virtual void GenerateData( ) 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 implemented. RegionGrow( const Self& other ); Self& operator=( const Self& other ); protected: - typename TIntensityFunctor::Pointer m_IntensityFunctor; - typename TVertexFunctor::Pointer m_VertexFunctor; + typename TValuePredicate::Pointer m_ValuePredicate; + typename TVertexPredicate::Pointer m_VertexPredicate; + TOutputValue m_InsideValue; - TOutputValue m_OutsideValue; + + TQueue m_Queue; }; } // ecapseman