]> Creatis software - FrontAlgorithms.git/blob - libs/fpa/Image/Algorithm.h
0105cc3080d13166c0a23ca5b702b7622012c795
[FrontAlgorithms.git] / libs / 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
32       typedef fpa::Image::Functors::Base< itk::ImageBase< _TInputImage::ImageDimension >, typename Superclass::TNeighborhoodFunction > TNeighborhoodFunction;
33       typedef fpa::Image::Functors::Base< _TInputImage, typename Superclass::TVertexFunction > TVertexFunction;
34
35     protected:
36       typedef typename Superclass::_TQueueNode _TQueueNode;
37
38     public:
39       itkTypeMacro( fpa::Image::Algorithm, fpa::Base::Algorithm );
40
41     protected:
42       Algorithm( );
43       virtual ~Algorithm( );
44
45       virtual void _BeforeGenerateData( ) override;
46       virtual void _InitMarks( ) override;
47       virtual void _InitResults( const TOutput& init_value ) override;
48       virtual bool _IsMarked( const TVertex& v ) const override;
49       virtual void _Mark( const _TQueueNode& n ) override;
50       virtual TFrontId _GetMark( const TVertex& v ) const override;
51       virtual void _UpdateResult( const _TQueueNode& n ) override;
52       virtual TOutput _GetResult( const TVertex& v ) const override;
53       virtual unsigned int _GetNumberOfDimensions( ) const override;
54
55     private:
56       // Purposely not defined
57       Algorithm( const Self& other );
58       Self& operator=( const Self& other );
59
60     protected:
61       unsigned int m_MarksIdx;
62     };
63
64   } // ecapseman
65
66 } // ecapseman
67
68 #ifndef ITK_MANUAL_INSTANTIATION
69 #  include <fpa/Image/Algorithm.hxx>
70 #endif // ITK_MANUAL_INSTANTIATION
71
72 #endif // __fpa__Image__Algorithm__h__
73
74 // eof - $RCSfile$