#ifndef __FPA__BASE__REGIONGROW__H__ #define __FPA__BASE__REGIONGROW__H__ #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 > class RegionGrow : public Algorithm< V, C, R, S, VC, B > { 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 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; 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; 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; // 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( ); private: // Purposely not implemented RegionGrow( const Self& other ); Self& operator=( const Self& other ); protected: TResult m_InsideValue; TResult m_OutsideValue; _TQueue m_Queue; typename TGrowingFunction::Pointer m_GrowingFunction; }; } // ecapseman } // ecapseman #ifndef ITK_MANUAL_INSTANTIATION #include #endif // ITK_MANUAL_INSTANTIATION #endif // __FPA__BASE__REGIONGROW__H__ // eof - $RCSfile$