]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Base/RegionGrow.h
Architecture revisited.
[FrontAlgorithms.git] / lib / fpa / Base / RegionGrow.h
1 #ifndef __FPA__BASE__REGIONGROW__H__
2 #define __FPA__BASE__REGIONGROW__H__
3
4 #include <deque>
5 #include <itkFunctionBase.h>
6 #include <fpa/Base/Algorithm.h>
7
8 namespace fpa
9 {
10   namespace Base
11   {
12     /**
13      */
14     template< class _TSuperclass >
15     class RegionGrow
16       : public _TSuperclass
17     {
18     public:
19       typedef RegionGrow                      Self;
20       typedef _TSuperclass                    Superclass;
21       typedef itk::SmartPointer< Self >       Pointer;
22       typedef itk::SmartPointer< const Self > ConstPointer;
23
24       // Template arguments
25       typedef typename Superclass::TVertex        TVertex;
26       typedef typename Superclass::TScalar        TScalar;
27       typedef typename Superclass::TFilter        TFilter;
28       typedef typename Superclass::TVertexCompare TVertexCompare;
29       typedef typename Superclass::TFrontId       TFrontId;
30       typedef typename Superclass::TCollision     TCollision;
31       typedef typename Superclass::TCollisionsRow TCollisionsRow;
32       typedef typename Superclass::TCollisions    TCollisions;
33       typedef typename Superclass::TNodeLabel     TNodeLabel;
34       typedef typename Superclass::TNode          TNode;
35       typedef typename Superclass::TNodes         TNodes;
36       typedef typename Superclass::TVertices      TVertices;
37
38       typedef itk::FunctionBase< TVertex, bool > TRegionGrowFunction;
39
40     public:
41       itkTypeMacro( RegionGrow, Algorithm );
42
43       itkGetObjectMacro( RegionGrowFunction, TRegionGrowFunction );
44       itkGetConstMacro( InsideValue, TScalar );
45       itkGetConstMacro( OutsideValue, TScalar );
46
47       itkSetObjectMacro( RegionGrowFunction, TRegionGrowFunction );
48       itkSetMacro( InsideValue, TScalar );
49       itkSetMacro( OutsideValue, TScalar );
50
51     protected:
52       // Methods to extend itk-based architecture
53       RegionGrow( );
54       virtual ~RegionGrow( );
55
56       // Front propagation methods to be overloaded
57       virtual bool _Result( TNode& node, const TNode& parent ) fpa_OVERRIDE;
58       virtual void  _QueueClear( ) fpa_OVERRIDE;
59       virtual void  _QueuePush( const TNode& node ) fpa_OVERRIDE;
60       virtual TNode _QueuePop( ) fpa_OVERRIDE;
61       virtual bool  _IsQueueEmpty( ) const fpa_OVERRIDE;
62
63     private:
64       // Purposely not implemented
65       RegionGrow( const Self& other );
66       Self& operator=( const Self& other );
67
68     protected:
69       std::deque< TNode > m_Queue;
70       typename TRegionGrowFunction::Pointer m_RegionGrowFunction;
71       TScalar m_InsideValue;
72       TScalar m_OutsideValue;
73     };
74
75   } // ecapseman
76
77 } // ecapseman
78
79 #ifndef ITK_MANUAL_INSTANTIATION
80 #  include <fpa/Base/RegionGrow.hxx>
81 #endif
82
83 #endif // __FPA__BASE__REGIONGROW__H__
84
85 // eof - $RCSfile$