]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Base/Algorithm.h
...
[FrontAlgorithms.git] / lib / fpa / Base / Algorithm.h
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5
6 #ifndef __fpa__Base__Algorithm__h__
7 #define __fpa__Base__Algorithm__h__
8
9 #include <fpa/Config.h>
10 #include <itkConceptChecking.h>
11 #include <itkObject.h>
12
13 namespace fpa
14 {
15   namespace Base
16   {
17     /**
18      */
19     template< class _TFilter, class _TMarks, class _TSeeds >
20     class Algorithm
21       : public _TFilter, public _TMarks, public _TSeeds
22     {
23     public:
24       typedef _TMarks                         TMarksInterface;
25       typedef _TSeeds                         TSeedsInterface;
26       typedef _TFilter                        Superclass;
27       typedef Algorithm                       Self;
28       typedef itk::SmartPointer< Self >       Pointer;
29       typedef itk::SmartPointer< const Self > ConstPointer;
30
31       typedef typename _TMarks::TTraits TTraits;
32       fpa_Base_TraitTypes( typename TTraits );
33
34     private:
35       itkConceptMacro(
36         Marks_and_Seeds_SameTraits,
37         ( itk::Concept::SameType< typename _TSeeds::TTraits, TTraits > )
38         );
39
40     public:
41       itkTypeMacro( fpa::Base::Algorithm, _TFilter );
42
43       itkBooleanMacro( VisualDebug );
44       itkGetConstMacro( VisualDebug, bool );
45       itkSetMacro( VisualDebug, bool );
46
47       itkGetConstMacro( InitValue, TOutputValue );
48       itkSetMacro( InitValue, TOutputValue );
49
50     public:
51       virtual void InvokeEvent( const itk::EventObject& e );
52       virtual void InvokeEvent( const itk::EventObject& e ) const;
53
54     protected:
55       Algorithm( );
56       virtual ~Algorithm( );
57
58       virtual void GenerateData( ) override;
59       virtual void _BeforeGenerateData( );
60       virtual void _AfterGenerateData( );
61       virtual void _FinishOneLoop( );
62
63       virtual void _QueueInit( );
64
65       virtual void _ConfigureOutput( const TOutputValue& v ) = 0;
66       virtual TNeighborhood _GetNeighbors( const TVertex& v ) const = 0;
67       virtual TInputValue _GetInputValue( const TVertex& v ) const = 0;
68       virtual TOutputValue _GetOutputValue( const TVertex& v ) const = 0;
69
70       virtual void _ComputeOutputValue( TNode& n ) = 0;
71       virtual void _UpdateOutputValue( TNode& n ) = 0;
72       virtual void _QueueClear( ) = 0;
73       virtual void _QueuePush( const TNode& node ) = 0;
74       virtual unsigned long _QueueSize( ) const = 0;
75       virtual TNode _QueuePop( ) = 0;
76
77     private:
78       // Purposely not implemented
79       Algorithm( const Self& other );
80       Self& operator=( const Self& other );
81
82     protected:
83       bool m_VisualDebug;
84       TOutputValue m_InitValue;
85     };
86
87   } // ecapseman
88
89 } // ecapseman
90
91 #ifndef ITK_MANUAL_INSTANTIATION
92 #  include <fpa/Base/Algorithm.hxx>
93 #endif // ITK_MANUAL_INSTANTIATION
94
95 #endif // __fpa__Base__Algorithm__h__
96
97 // eof - $RCSfile$