1 #ifndef __CPEXTENSIONS__ALGORITHMS__GRADIENTIMAGEFUNCTIONBASE__H__
2 #define __CPEXTENSIONS__ALGORITHMS__GRADIENTIMAGEFUNCTIONBASE__H__
4 #include <itkImageFunction.h>
11 * Base class to compute values based on image gradients (vector).
13 template< class _TGradient, class _TMask = itk::Image< unsigned char, _TGradient::ImageDimension > >
14 class GradientImageFunctionBase
15 : public itk::ImageFunction< _TGradient, typename _TGradient::PixelType::ValueType, typename _TGradient::PixelType::ValueType >
18 // Types from input arguments
19 typedef _TGradient TGradient;
21 typedef typename _TGradient::PixelType TVector;
22 typedef typename TVector::ValueType TScalar;
24 Dimension, unsigned int, _TGradient::ImageDimension
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;
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;
41 itkTypeMacro( GradientImageFunctionBase, itkImageFunction );
43 itkGetConstObjectMacro( Mask, TMask );
44 itkSetConstObjectMacro( Mask, TMask );
47 virtual void Prepare( ) const;
48 virtual TOutput Evaluate( const TPoint& p ) const cpExtensions_OVERRIDE;
49 virtual TOutput EvaluateAtIndex( const TIndex& i ) const cpExtensions_OVERRIDE;
50 virtual TOutput EvaluateAtContinuousIndex( const TContIndex& i ) const cpExtensions_OVERRIDE;
53 GradientImageFunctionBase( );
54 virtual ~GradientImageFunctionBase( );
56 virtual TOutput _Evaluate( const TIndex& i ) const = 0;
59 // Purposely not implemented.
60 GradientImageFunctionBase( const Self& );
61 void operator=( const Self& );
64 typename _TMask::ConstPointer m_Mask;
71 #ifndef ITK_MANUAL_INSTANTIATION
72 # include <cpExtensions/Algorithms/GradientImageFunctionBase.hxx>
73 #endif // ITK_MANUAL_INSTANTIATION
75 #endif // __CPEXTENSIONS__ALGORITHMS__GRADIENTIMAGEFUNCTIONBASE__H__