X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FRegionGrow.h;h=b5ce46e3a6449042659d3858c4ca1d288f09da42;hb=ab4b440668b2007d94345967ac154c4b20aa389f;hp=6028b754622fb5f91c9413cf92b79cca0da7a9bc;hpb=b70a564ee2d7bc180b77a05c37ab431ab9c393e7;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/RegionGrow.h b/lib/fpa/Base/RegionGrow.h index 6028b75..b5ce46e 100644 --- a/lib/fpa/Base/RegionGrow.h +++ b/lib/fpa/Base/RegionGrow.h @@ -2,7 +2,9 @@ #define __FPA__BASE__REGIONGROW__H__ #include +#include #include +#include namespace fpa { @@ -11,26 +13,32 @@ namespace fpa /** * 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). + * @param V Vertex type. + * @param C Vertex value type. + * @param R Result value type. + * @param S Space type where vertices are. + * @param VC Vertex lexicographical compare. + * @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 V, class C, class R, class S, class VC, class B > class RegionGrow - : public Algorithm< V, C, R, B > + : public Algorithm< V, C, R, S, VC, B > { public: typedef RegionGrow Self; - typedef Algorithm< V, C, R, B > Superclass; + typedef Algorithm< V, C, R, S, VC, 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 typename Superclass::TVertex TVertex; + typedef typename Superclass::TValue TValue; + typedef typename Superclass::TResult TResult; + typedef typename Superclass::TSpace TSpace; + typedef typename Superclass::TVertexCompare TVertexCompare; + + typedef fpa::Base::Functors::TautologyFunction< S, V > TGrowingFunction; protected: typedef typename Superclass::_TVertices _TVertices; @@ -40,22 +48,25 @@ namespace fpa typedef typename Superclass::_TNode _TNode; typedef typename Superclass::_TNodes _TNodes; - typedef std::queue< _TNode > _TQueue; + typedef std::queue< std::pair< TVertex, _TNode > > _TQueue; public: itkTypeMacro( RegionGrow, Algorithm ); itkGetConstMacro( InsideValue, TResult ); itkGetConstMacro( OutsideValue, TResult ); + itkGetObjectMacro( GrowingFunction, TGrowingFunction ); + itkGetConstObjectMacro( GrowingFunction, TGrowingFunction ); itkSetMacro( InsideValue, TResult ); itkSetMacro( OutsideValue, TResult ); + itkSetObjectMacro( GrowingFunction, TGrowingFunction ); protected: RegionGrow( ); virtual ~RegionGrow( ); - virtual bool _CheckMembership( const TVertex& v ) const = 0; + virtual bool _CheckMembership( const TVertex& v ) const; // Results-related abstract methods virtual bool _ComputeNeighborResult( @@ -64,8 +75,8 @@ namespace fpa // Queue-related abstract methods virtual bool _IsQueueEmpty( ) const; - virtual void _QueuePush( const _TNode& n ); - virtual _TNode _QueuePop( ); + virtual void _QueuePush( const TVertex& v, const _TNode& n ); + virtual void _QueuePop( TVertex& v, _TNode& n ); virtual void _QueueClear( ); private: @@ -77,6 +88,8 @@ namespace fpa TResult m_InsideValue; TResult m_OutsideValue; _TQueue m_Queue; + + typename TGrowingFunction::Pointer m_GrowingFunction; }; } // ecapseman