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