1 // -------------------------------------------------------------------------
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // -------------------------------------------------------------------------
5 #ifndef __CPPLUGINS__EXTENSIONS__ALGORITHMS__GRADIENTFUNCTIONBASE__H__
6 #define __CPPLUGINS__EXTENSIONS__ALGORITHMS__GRADIENTFUNCTIONBASE__H__
9 #include <itkImageFunction.h>
20 class GradientFunctionBase
21 : public itk::ImageFunction< G, typename G::PixelType::ValueType, typename G::PixelType::ValueType >
24 // Types from input arguments
26 typedef typename G::PixelType TVector;
27 typedef typename TVector::ValueType TScalar;
28 itkStaticConstMacro( Dimension, unsigned int, G::ImageDimension );
31 typedef GradientFunctionBase Self;
32 typedef itk::ImageFunction< G, TScalar, TScalar > Superclass;
33 typedef itk::SmartPointer< Self > Pointer;
34 typedef itk::SmartPointer< const Self > ConstPointer;
36 // Types from base itk::ImageFunction
37 typedef typename Superclass::InputType TInput;
38 typedef typename Superclass::OutputType TOutput;
39 typedef typename Superclass::PointType TPoint;
40 typedef typename Superclass::ContinuousIndexType TContIndex;
41 typedef typename Superclass::IndexType TIndex;
44 typedef std::map< TIndex, TOutput, typename TIndex::LexicographicCompare > TBuffer;
47 itkTypeMacro( GradientFunctionBase, itkImageFunction );
49 itkBooleanMacro( BufferResults );
50 itkGetConstMacro( BufferResults, bool );
51 itkSetMacro( BufferResults, bool );
54 virtual void ResetBuffer( );
56 virtual TOutput Evaluate( const TPoint& p ) const;
57 virtual TOutput EvaluateAtIndex( const TIndex& i ) const;
58 virtual TOutput EvaluateAtContinuousIndex( const TContIndex& i ) const;
61 GradientFunctionBase( );
62 virtual ~GradientFunctionBase( );
64 virtual TOutput _Evaluate( const TIndex& i ) const = 0;
67 // Purposely not implemented.
68 GradientFunctionBase( const Self& );
69 void operator=( const Self& );
72 mutable TBuffer m_Buffer;
82 #include <cpPlugins/Extensions/Algorithms/GradientFunctionBase.hxx>
84 #endif // __CPPLUGINS__EXTENSIONS__ALGORITHMS__GRADIENTFUNCTIONBASE__H__