]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/Algorithm.h
70a87a611543fe78b7d3076a44df96eba271355a
[FrontAlgorithms.git] / lib / fpa / Image / Algorithm.h
1 #ifndef __fpa__Image__Algorithm__h__
2 #define __fpa__Image__Algorithm__h__
3
4 #include <itkFunctionBase.h>
5 #include <itkImageToImageFilter.h>
6 #include <fpa/Base/Algorithm.h>
7 #include <fpa/Image/Functors/Base.h>
8
9 namespace fpa
10 {
11   namespace Image
12   {
13     /**
14      */
15     template< class _TInputImage, class _TOutputImage >
16     class Algorithm
17       : public fpa::Base::Algorithm< itk::ImageToImageFilter< _TInputImage, _TOutputImage >, typename _TInputImage::IndexType, typename _TOutputImage::PixelType >
18     {
19     public:
20       typedef itk::ImageToImageFilter< _TInputImage, _TOutputImage > TFilter;
21       typedef typename _TInputImage::IndexType                       TVertex;
22       typedef typename _TOutputImage::PixelType                      TOutput;
23
24       typedef Algorithm                                         Self;
25       typedef fpa::Base::Algorithm< TFilter, TVertex, TOutput > Superclass;
26       typedef itk::SmartPointer< Self >                         Pointer;
27       typedef itk::SmartPointer< const Self >                   ConstPointer;
28
29       typedef typename Superclass::TFrontId      TFrontId;
30       typedef typename Superclass::TNeighborhood TNeighborhood;
31       typedef fpa::Image::Functors::Base< itk::ImageBase< _TInputImage::ImageDimension >, itk::FunctionBase< TVertex, TNeighborhood > > TNeighborhoodFunction;
32
33     protected:
34       typedef typename Superclass::_TQueueNode _TQueueNode;
35
36     public:
37       itkTypeMacro( fpa::Image::Algorithm, fpa::Base::Algorithm );
38
39     protected:
40       Algorithm( );
41       virtual ~Algorithm( );
42
43       virtual void _BeforeGenerateData( ) fpa_OVERRIDE;
44       virtual void _InitMarks( ) fpa_OVERRIDE;
45       virtual void _InitResults( const TOutput& init_value ) fpa_OVERRIDE;
46       virtual bool _IsMarked( const TVertex& v ) const fpa_OVERRIDE;
47       virtual void _Mark( const _TQueueNode& n ) fpa_OVERRIDE;
48       virtual TFrontId _GetMark( const TVertex& v ) const fpa_OVERRIDE;
49       virtual void _UpdateResult( const _TQueueNode& n ) fpa_OVERRIDE;
50
51     private:
52       // Purposely not defined
53       Algorithm( const Self& other );
54       Self& operator=( const Self& other );
55
56     protected:
57       unsigned int m_MarksIdx;
58     };
59
60   } // ecapseman
61
62 } // ecapseman
63
64 #ifndef ITK_MANUAL_INSTANTIATION
65 #  include <fpa/Image/Algorithm.hxx>
66 #endif // ITK_MANUAL_INSTANTIATION
67
68 #endif // __fpa__Image__Algorithm__h__
69
70 // eof - $RCSfile$