]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Base/RegionGrow.h
...
[FrontAlgorithms.git] / lib / fpa / Base / RegionGrow.h
1 #ifndef __fpa__Base__RegionGrow__h__
2 #define __fpa__Base__RegionGrow__h__
3
4 #include <queue>
5 #include <fpa/Base/QueueAlgorithm.h>
6 #include <fpa/Base/Functors/RegionGrow/Base.h>
7
8 namespace fpa
9 {
10   namespace Base
11   {
12     /**
13      */
14     template< class _TSuperclass >
15     class RegionGrow
16       : public fpa::Base::QueueAlgorithm< _TSuperclass >
17     {
18     public:
19       typedef RegionGrow                                Self;
20       typedef fpa::Base::QueueAlgorithm< _TSuperclass > Superclass;
21       typedef itk::SmartPointer< Self >                 Pointer;
22       typedef itk::SmartPointer< const Self >           ConstPointer;
23
24       typedef typename Superclass::TOutput TOutput;
25       typedef typename Superclass::TVertex TVertex;
26       typedef fpa::Base::Functors::RegionGrow::Base< TVertex, TOutput > TGrowFunction;
27
28     protected:
29       typedef typename Superclass::_TQueueNode _TQueueNode;
30
31     public:
32       itkTypeMacro( RegionGrow, Algorithm );
33
34     public:
35       TGrowFunction* GetGrowFunction( );
36       const TGrowFunction* GetGrowFunction( ) const;
37       TOutput GetInsideValue( ) const;
38       TOutput GetOutsideValue( ) const;
39
40       void SetGrowFunction( TGrowFunction* f );
41       void SetInsideValue( const TOutput& v );
42       void SetOutsideValue( const TOutput& v );
43
44     protected:
45       RegionGrow( );
46       virtual ~RegionGrow( );
47
48       virtual bool _UpdateValue(
49         _TQueueNode& v, const _TQueueNode& p
50         ) override;
51       virtual TOutput _GetInputValue( const _TQueueNode& v, const _TQueueNode& p ) override
52         {
53           TOutput res = this->m_InitResult;
54           if( this->m_GrowFunction.IsNotNull( ) )
55             res = this->m_GrowFunction->Evaluate( v.Vertex, p.Vertex );
56           return( res );
57         }
58
59
60     private:
61       // Purposely not defined
62       RegionGrow( const Self& other );
63       Self& operator=( const Self& other );
64
65     protected:
66       typename TGrowFunction::Pointer m_GrowFunction;
67     };
68
69   } // ecapseman
70
71 } // ecapseman
72
73 #ifndef ITK_MANUAL_INSTANTIATION
74 #  include <fpa/Base/RegionGrow.hxx>
75 #endif // ITK_MANUAL_INSTANTIATION
76
77 #endif // __fpa__Base__RegionGrow__h__
78
79 // eof - $RCSfile$