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