1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
6 #ifndef __fpa__Base__Algorithm__h__
7 #define __fpa__Base__Algorithm__h__
9 #include <fpa/Config.h>
12 #include <itkObject.h>
13 #include <itkEventObject.h>
21 template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
24 public _TMarksInterface,
25 public _TSeedsInterface
28 typedef Algorithm Self;
29 typedef _TFilter Superclass;
30 typedef _TMarksInterface TMarksInterface;
31 typedef _TSeedsInterface TSeedsInterface;
32 typedef itk::SmartPointer< Self > Pointer;
33 typedef itk::SmartPointer< const Self > ConstPointer;
35 typedef typename _TSeedsInterface::TInputValue TInputValue;
36 typedef typename _TSeedsInterface::TOutputValue TOutputValue;
37 typedef typename _TSeedsInterface::TNode TNode;
38 typedef typename _TSeedsInterface::TNodes TNodes;
39 typedef typename _TSeedsInterface::TSeeds TSeeds;
40 typedef typename _TSeedsInterface::TVertex TVertex;
42 typedef std::vector< TVertex > TNeighborhood;
47 : public itk::EventObject
51 typedef itk::EventObject Superclass;
55 TEvent( const TVertex& v, unsigned long fid, bool intoq );
57 virtual const char* GetEventName( ) const override;
58 virtual bool CheckEvent( const itk::EventObject* e ) const override;
59 virtual itk::EventObject* MakeObject( ) const override;
62 // Purposely not implemented.
63 Self& operator=( const Self& other );
67 unsigned long FrontId;
72 itkTypeMacro( fpa::Base::Algorithm, _TFilter );
74 itkBooleanMacro( VisualDebug );
76 itkGetConstMacro( InitValue, TOutputValue );
77 itkGetConstMacro( VisualDebug, bool );
79 itkSetMacro( InitValue, TOutputValue );
80 itkSetMacro( VisualDebug, bool );
83 virtual void InvokeEvent( const itk::EventObject& e );
84 virtual void InvokeEvent( const itk::EventObject& e ) const;
88 virtual ~Algorithm( );
90 virtual void GenerateData( ) override;
91 virtual void _BeforeGenerateData( );
92 virtual void _AfterGenerateData( );
94 virtual void _QueueInit( );
96 virtual void _ConfigureOutput( const TOutputValue& v ) = 0;
97 virtual TNeighborhood _GetNeighbors( const TVertex& v ) const = 0;
98 virtual TInputValue _GetInputValue( const TVertex& v ) const = 0;
99 virtual TOutputValue _GetOutputValue( const TVertex& v ) const = 0;
101 virtual TOutputValue _ComputeOutputValue( const TNode& n ) = 0;
102 virtual void _UpdateOutputValue( const TNode& n ) = 0;
103 virtual void _QueueClear( ) = 0;
104 virtual void _QueuePush( const TNode& node ) = 0;
105 virtual unsigned long _QueueSize( ) const = 0;
106 virtual TNode _QueuePop( ) = 0;
109 // Purposely not implemented
110 Algorithm( const Self& other );
111 Self& operator=( const Self& other );
115 TOutputValue m_InitValue;
122 #ifndef ITK_MANUAL_INSTANTIATION
123 # include <fpa/Base/Algorithm.hxx>
124 #endif // ITK_MANUAL_INSTANTIATION
126 #endif // __fpa__Base__Algorithm__h__