]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Base/RegionGrow.h
71479448ac4b1ae6d53dcc59f6013ce2b3e8cc26
[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 #include <fpa/Config.h>
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::TTraits TTraits;
31       fpa_Base_TraitTypes( typename TTraits );
32       /* TODO
33          typedef typename _TAlgorithm::TNode        TNode;
34          typedef typename _TAlgorithm::TNodes       TNodes;
35          typedef typename _TAlgorithm::TInputValue  TInputValue;
36          typedef typename _TAlgorithm::TOutputValue TOutputValue;
37          typedef typename _TAlgorithm::TFrontId     TFrontId;
38          typedef typename _TAlgorithm::TVertex      TVertex;
39       */
40
41       typedef std::deque< TNode >                    TQueue;
42       typedef itk::FunctionBase< TInputValue, bool > TValuePredicate;
43       typedef itk::FunctionBase< TVertex, bool >     TVertexPredicate;
44
45     private:
46       itkConceptMacro(
47         Check_TOutputValue,
48         ( itk::Concept::IsUnsignedInteger< TOutputValue > )
49         );
50
51     public:
52
53       itkGetObjectMacro( ValuePredicate, TValuePredicate );
54       itkGetObjectMacro( VertexPredicate, TVertexPredicate );
55
56       itkGetConstMacro( InsideValue, TOutputValue );
57       itkSetMacro( InsideValue, TOutputValue );
58
59     public:
60       virtual itk::ModifiedTimeType GetMTime( ) const override;
61       virtual TOutputValue GetOutsideValue( ) const;
62       virtual void SetOutsideValue( const TOutputValue& v );
63
64       void SetPredicate( TValuePredicate* p );
65       void SetPredicate( TVertexPredicate* p );
66
67     protected:
68       RegionGrow( );
69       virtual ~RegionGrow( );
70
71       virtual void _ComputeOutputValue( TNode& n ) override;
72       virtual void _UpdateOutputValue( TNode& n ) override;
73       virtual void _QueueClear( ) override;
74       virtual TNode _QueuePop( ) override;
75       virtual void _QueuePush( const TNode& node ) override;
76       virtual unsigned long _QueueSize( ) const override;
77       virtual void _PrepareSeeds( TNodes& nodes ) override;
78
79     private:
80       // Purposely not implemented.
81       RegionGrow( const Self& other );
82       Self& operator=( const Self& other );
83
84     protected:
85       typename TValuePredicate::Pointer  m_ValuePredicate;
86       typename TVertexPredicate::Pointer m_VertexPredicate;
87
88       TOutputValue m_InsideValue;
89
90       TQueue m_Queue;
91     };
92
93   } // ecapseman
94
95 } // ecapseman
96
97 #ifndef ITK_MANUAL_INSTANTIATION
98 #  include <fpa/Base/RegionGrow.hxx>
99 #endif // ITK_MANUAL_INSTANTIATION
100
101 #endif // __fpa__Base__RegionGrow__h__
102
103 // eof - $RCSfile$