1 #ifndef __FPA__BASE__REGIONGROW__H__
2 #define __FPA__BASE__REGIONGROW__H__
6 #include <fpa/Base/Algorithm.h>
7 #include <fpa/Base/Functors/TautologyFunction.h>
14 * Region grow is a front propagation with no costs.
16 * @param V Vertex type.
17 * @param C Vertex value type.
18 * @param R Result value type.
19 * @param S Space type where vertices are.
20 * @param VC Vertex lexicographical compare.
21 * @param B Base class for this algorithm. It should be any itk-based
22 * filter (itk::ProcessObject).
25 template< class V, class C, class R, class S, class VC, class B >
27 : public Algorithm< V, C, R, S, VC, B >
30 typedef RegionGrow Self;
31 typedef Algorithm< V, C, R, S, VC, B > Superclass;
32 typedef itk::SmartPointer< Self > Pointer;
33 typedef itk::SmartPointer< const Self > ConstPointer;
35 typedef typename Superclass::TVertex TVertex;
36 typedef typename Superclass::TValue TValue;
37 typedef typename Superclass::TResult TResult;
38 typedef typename Superclass::TSpace TSpace;
39 typedef typename Superclass::TVertexCompare TVertexCompare;
41 typedef fpa::Base::Functors::TautologyFunction< S, V > TGrowingFunction;
44 typedef typename Superclass::_TVertices _TVertices;
45 typedef typename Superclass::_TCollision _TCollision;
46 typedef typename Superclass::_TCollisionsRow _TCollisionsRow;
47 typedef typename Superclass::_TCollisions _TCollisions;
48 typedef typename Superclass::_TNode _TNode;
49 typedef typename Superclass::_TNodes _TNodes;
51 typedef std::queue< std::pair< TVertex, _TNode > > _TQueue;
54 itkTypeMacro( RegionGrow, Algorithm );
56 itkGetConstMacro( InsideValue, TResult );
57 itkGetConstMacro( OutsideValue, TResult );
58 itkGetObjectMacro( GrowingFunction, TGrowingFunction );
59 itkGetConstObjectMacro( GrowingFunction, TGrowingFunction );
61 itkSetMacro( InsideValue, TResult );
62 itkSetMacro( OutsideValue, TResult );
63 itkSetObjectMacro( GrowingFunction, TGrowingFunction );
67 virtual ~RegionGrow( );
69 virtual bool _CheckMembership( const TVertex& v ) const;
71 // Results-related abstract methods
72 virtual bool _ComputeNeighborResult(
73 TResult& result, const TVertex& neighbor, const TVertex& parent
76 // Queue-related abstract methods
77 virtual bool _IsQueueEmpty( ) const ITK_OVERRIDE;
78 virtual void _QueuePush( const TVertex& v, const _TNode& n ) ITK_OVERRIDE;
79 virtual void _QueuePop( TVertex& v, _TNode& n ) ITK_OVERRIDE;
80 virtual void _QueueClear( ) ITK_OVERRIDE;
83 // Purposely not implemented
84 RegionGrow( const Self& other );
85 Self& operator=( const Self& other );
88 TResult m_InsideValue;
89 TResult m_OutsideValue;
92 typename TGrowingFunction::Pointer m_GrowingFunction;
99 #ifndef ITK_MANUAL_INSTANTIATION
100 #include <fpa/Base/RegionGrow.hxx>
101 #endif // ITK_MANUAL_INSTANTIATION
103 #endif // __FPA__BASE__REGIONGROW__H__