]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/Functors/GradientImageFunctionBase.h
fa93034803a55f89d97e2dc4f6bac74daaa5d8fc
[FrontAlgorithms.git] / lib / fpa / Image / Functors / GradientImageFunctionBase.h
1 #ifndef __FPA__IMAGE__FUNCTORS__GRADIENTIMAGEFUNCTIONBASE__H__
2 #define __FPA__IMAGE__FUNCTORS__GRADIENTIMAGEFUNCTIONBASE__H__
3
4 #include <itkImageFunction.h>
5
6 namespace fpa
7 {
8   namespace Image
9   {
10     namespace Functors
11     {
12       /**
13        * Base class to compute values based on image gradients (vector).
14        * It allows incremental computation of the gradient.
15        */
16       template< class _TGradient >
17       class GradientImageFunctionBase
18         : public itk::ImageFunction< _TGradient, typename _TGradient::PixelType::ValueType, typename _TGradient::PixelType::ValueType >
19       {
20       public:
21         // Types from input arguments
22         typedef _TGradient                     TGradient;
23         typedef typename _TGradient::PixelType TVector;
24         typedef typename TVector::ValueType    TScalar;
25         itkStaticConstMacro( Dimension, unsigned int, _TGradient::ImageDimension );
26
27         // Standard itk types
28         typedef GradientImageFunctionBase                          Self;
29         typedef itk::ImageFunction< _TGradient, TScalar, TScalar > Superclass;
30         typedef itk::SmartPointer< Self >                          Pointer;
31         typedef itk::SmartPointer< const Self >                    ConstPointer;
32
33         // Types from base itk::ImageFunction
34         typedef typename Superclass::InputType           TInput;
35         typedef typename Superclass::OutputType          TOutput;
36         typedef typename Superclass::PointType           TPoint;
37         typedef typename Superclass::ContinuousIndexType TContIndex;
38         typedef typename Superclass::IndexType           TIndex;
39
40       public:
41         itkTypeMacro( GradientImageFunctionBase, itkImageFunction );
42
43       public:
44         virtual void Prepare( ) const;
45         virtual TOutput Evaluate( const TPoint& p ) const ITK_OVERRIDE;
46         virtual TOutput EvaluateAtIndex( const TIndex& i ) const ITK_OVERRIDE;
47         virtual TOutput EvaluateAtContinuousIndex( const TContIndex& i ) const ITK_OVERRIDE;
48
49       protected:
50         GradientImageFunctionBase( );
51         virtual ~GradientImageFunctionBase( );
52
53         virtual TOutput _Evaluate( const TIndex& i ) const = 0;
54
55       private:
56         // Purposely not implemented.
57         GradientImageFunctionBase( const Self& );
58         void operator=( const Self& );
59       };
60
61     } // ecapseman
62
63   } // ecapseman
64
65 } // ecapseman
66
67 #ifndef ITK_MANUAL_INSTANTIATION
68 #include <fpa/Image/Functors/GradientImageFunctionBase.hxx>
69 #endif // ITK_MANUAL_INSTANTIATION
70
71 #endif // __FPA__IMAGE__FUNCTORS__GRADIENTIMAGEFUNCTIONBASE__H__
72
73 // eof - $RCSfile$