]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Base/RegionGrow.h
8d7439f74e8a6e065e9730e17588445b01885572
[FrontAlgorithms.git] / lib / fpa / Base / RegionGrow.h
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5
6 #ifndef __fpa__Base__RegionGrow__h__
7 #define __fpa__Base__RegionGrow__h__
8
9 #include <deque>
10
11 #include <itkConceptChecking.h>
12 #include <itkFunctionBase.h>
13
14 namespace fpa
15 {
16   namespace Base
17   {
18     /**
19      */
20     template< class _TAlgorithm >
21     class RegionGrow
22       : public _TAlgorithm
23     {
24     public:
25       typedef RegionGrow                      Self;
26       typedef _TAlgorithm                     Superclass;
27       typedef itk::SmartPointer< Self >       Pointer;
28       typedef itk::SmartPointer< const Self > ConstPointer;
29
30       typedef typename _TAlgorithm::TNode        TNode;
31       typedef typename _TAlgorithm::TNodes       TNodes;
32       typedef typename _TAlgorithm::TInputValue  TInputValue;
33       typedef typename _TAlgorithm::TOutputValue TOutputValue;
34       typedef typename _TAlgorithm::TFrontId     TFrontId;
35       typedef typename _TAlgorithm::TVertex      TVertex;
36
37       typedef std::deque< TNode >                    TQueue;
38       typedef itk::FunctionBase< TInputValue, bool > TValuePredicate;
39       typedef itk::FunctionBase< TVertex, bool >     TVertexPredicate;
40
41     public:
42       itkConceptMacro(
43         Check_TOutputValue,
44         ( itk::Concept::IsUnsignedInteger< TOutputValue > )
45         );
46
47     public:
48       itkGetObjectMacro( ValuePredicate, TValuePredicate );
49       itkGetObjectMacro( VertexPredicate, TVertexPredicate );
50       itkGetConstMacro( InsideValue, TOutputValue );
51
52       itkSetMacro( InsideValue, TOutputValue );
53
54     public:
55       virtual itk::ModifiedTimeType GetMTime( ) const override;
56       virtual TOutputValue GetOutsideValue( ) const;
57       virtual void SetOutsideValue( const TOutputValue& v );
58
59       void SetPredicate( TValuePredicate* p );
60       void SetPredicate( TVertexPredicate* p );
61
62     protected:
63       RegionGrow( );
64       virtual ~RegionGrow( );
65
66       virtual void _ComputeOutputValue( TNode& n ) override;
67       virtual void _UpdateOutputValue( TNode& n ) override;
68       virtual void _QueueClear( ) override;
69       virtual TNode _QueuePop( ) override;
70       virtual void _QueuePush( const TNode& node ) override;
71       virtual unsigned long _QueueSize( ) const override;
72       virtual void _PrepareSeeds( TNodes& nodes ) override;
73
74     private:
75       // Purposely not implemented.
76       RegionGrow( const Self& other );
77       Self& operator=( const Self& other );
78
79     protected:
80       typename TValuePredicate::Pointer  m_ValuePredicate;
81       typename TVertexPredicate::Pointer m_VertexPredicate;
82
83       TOutputValue m_InsideValue;
84
85       TQueue m_Queue;
86     };
87
88   } // ecapseman
89
90 } // ecapseman
91
92 #ifndef ITK_MANUAL_INSTANTIATION
93 #  include <fpa/Base/RegionGrow.hxx>
94 #endif // ITK_MANUAL_INSTANTIATION
95
96 #endif // __fpa__Base__RegionGrow__h__
97
98 // eof - $RCSfile$