X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FRegionGrow.h;h=5cd36de8a2c202cea2e69ff418920fde0e2c27e2;hb=86a6d5df2aa1aa5292a5fa851d98bfc13939bdf3;hp=b5ce46e3a6449042659d3858c4ca1d288f09da42;hpb=015105c2f44abb80923a59adfb1a01713506744f;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/RegionGrow.h b/lib/fpa/Base/RegionGrow.h index b5ce46e..5cd36de 100644 --- a/lib/fpa/Base/RegionGrow.h +++ b/lib/fpa/Base/RegionGrow.h @@ -1,103 +1,78 @@ -#ifndef __FPA__BASE__REGIONGROW__H__ -#define __FPA__BASE__REGIONGROW__H__ +#ifndef __fpa__Base__RegionGrow__h__ +#define __fpa__Base__RegionGrow__h__ #include -#include -#include -#include +#include +#include namespace fpa { namespace Base { /** - * Region grow is a front propagation with no costs. - * - * @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 S, class VC, class B > + template< class _TSuperclass > class RegionGrow - : public Algorithm< V, C, R, S, VC, B > + : public _TSuperclass { public: - typedef RegionGrow Self; - typedef Algorithm< V, C, R, S, VC, B > Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; + typedef RegionGrow Self; + typedef _TSuperclass 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::TSpace TSpace; - typedef typename Superclass::TVertexCompare TVertexCompare; + typedef typename Superclass::TOutput TOutput; + typedef typename Superclass::TVertex TVertex; - typedef fpa::Base::Functors::TautologyFunction< S, V > TGrowingFunction; + typedef fpa::Base::RegionGrowFunctionBase< TVertex > TGrowFunction; protected: - typedef typename Superclass::_TVertices _TVertices; - typedef typename Superclass::_TCollision _TCollision; - typedef typename Superclass::_TCollisionsRow _TCollisionsRow; - typedef typename Superclass::_TCollisions _TCollisions; - typedef typename Superclass::_TNode _TNode; - typedef typename Superclass::_TNodes _TNodes; - - typedef std::queue< std::pair< TVertex, _TNode > > _TQueue; + typedef typename Superclass::_TQueueNode _TQueueNode; + typedef std::queue< _TQueueNode > _TQueue; public: itkTypeMacro( RegionGrow, Algorithm ); - itkGetConstMacro( InsideValue, TResult ); - itkGetConstMacro( OutsideValue, TResult ); - itkGetObjectMacro( GrowingFunction, TGrowingFunction ); - itkGetConstObjectMacro( GrowingFunction, TGrowingFunction ); + itkGetObjectMacro( GrowFunction, TGrowFunction ); + itkGetConstMacro( InsideValue, TOutput ); + itkGetConstMacro( OutsideValue, TOutput ); - itkSetMacro( InsideValue, TResult ); - itkSetMacro( OutsideValue, TResult ); - itkSetObjectMacro( GrowingFunction, TGrowingFunction ); + itkSetObjectMacro( GrowFunction, TGrowFunction ); + itkSetMacro( InsideValue, TOutput ); + itkSetMacro( OutsideValue, TOutput ); protected: RegionGrow( ); virtual ~RegionGrow( ); - virtual bool _CheckMembership( const TVertex& v ) const; - - // Results-related abstract methods - virtual bool _ComputeNeighborResult( - TResult& result, const TVertex& neighbor, const TVertex& parent - ) const; - - // Queue-related abstract methods - virtual bool _IsQueueEmpty( ) const; - virtual void _QueuePush( const TVertex& v, const _TNode& n ); - virtual void _QueuePop( TVertex& v, _TNode& n ); - virtual void _QueueClear( ); + 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; private: - // Purposely not implemented + // Purposely not defined RegionGrow( const Self& other ); Self& operator=( const Self& other ); protected: - TResult m_InsideValue; - TResult m_OutsideValue; + TOutput m_InsideValue; + TOutput m_OutsideValue; _TQueue m_Queue; - - typename TGrowingFunction::Pointer m_GrowingFunction; + typename TGrowFunction::Pointer m_GrowFunction; }; } // ecapseman } // ecapseman -#include +#ifndef ITK_MANUAL_INSTANTIATION +# include +#endif // ITK_MANUAL_INSTANTIATION -#endif // __FPA__BASE__REGIONGROW__H__ +#endif // __fpa__Base__RegionGrow__h__ // eof - $RCSfile$