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