1 #ifndef __CPEXTENSIONS__ALGORITHMS__GRADIENTIMAGEFUNCTIONBASE__H__
2 #define __CPEXTENSIONS__ALGORITHMS__GRADIENTIMAGEFUNCTIONBASE__H__
4 #include <cpExtensions/Config.h>
6 #include <itkImageFunction.h>
13 * Base class to compute values based on image gradients (vector).
15 template< class _TGradient, class _TMask = itk::Image< unsigned char, _TGradient::ImageDimension > >
16 class GradientImageFunctionBase
17 : public itk::ImageFunction< _TGradient, typename _TGradient::PixelType::ValueType, typename _TGradient::PixelType::ValueType >
20 // Types from input arguments
21 typedef _TGradient TGradient;
23 typedef typename _TGradient::PixelType TVector;
24 typedef typename TVector::ValueType TScalar;
26 Dimension, unsigned int, _TGradient::ImageDimension
30 typedef GradientImageFunctionBase Self;
31 typedef itk::ImageFunction< _TGradient, TScalar, TScalar > Superclass;
32 typedef itk::SmartPointer< Self > Pointer;
33 typedef itk::SmartPointer< const Self > ConstPointer;
35 // Types from base itk::ImageFunction
36 typedef typename Superclass::InputType TInput;
37 typedef typename Superclass::OutputType TOutput;
38 typedef typename Superclass::PointType TPoint;
39 typedef typename Superclass::ContinuousIndexType TContIndex;
40 typedef typename Superclass::IndexType TIndex;
43 itkTypeMacro( GradientImageFunctionBase, itkImageFunction );
45 itkGetConstObjectMacro( Mask, TMask );
46 itkSetConstObjectMacro( Mask, TMask );
49 virtual void Prepare( ) const;
50 virtual TOutput Evaluate( const TPoint& p ) const cpExtensions_OVERRIDE;
51 virtual TOutput EvaluateAtIndex( const TIndex& i ) const cpExtensions_OVERRIDE;
52 virtual TOutput EvaluateAtContinuousIndex( const TContIndex& i ) const cpExtensions_OVERRIDE;
55 GradientImageFunctionBase( );
56 virtual ~GradientImageFunctionBase( );
58 virtual TOutput _Evaluate( const TIndex& i ) const = 0;
61 // Purposely not implemented.
62 GradientImageFunctionBase( const Self& );
63 void operator=( const Self& );
66 typename _TMask::ConstPointer m_Mask;
73 #ifndef ITK_MANUAL_INSTANTIATION
74 # include <cpExtensions/Algorithms/GradientImageFunctionBase.hxx>
75 #endif // ITK_MANUAL_INSTANTIATION
77 #endif // __CPEXTENSIONS__ALGORITHMS__GRADIENTIMAGEFUNCTIONBASE__H__