#ifndef __CPEXTENSIONS__ALGORITHMS__GRADIENTIMAGEFUNCTIONBASE__H__ #define __CPEXTENSIONS__ALGORITHMS__GRADIENTIMAGEFUNCTIONBASE__H__ #include namespace cpExtensions { namespace Algorithms { /** * Base class to compute values based on image gradients (vector). */ template< class _TGradient, class _TMask = itk::Image< unsigned char, _TGradient::ImageDimension > > class GradientImageFunctionBase : public itk::ImageFunction< _TGradient, typename _TGradient::PixelType::ValueType, typename _TGradient::PixelType::ValueType > { public: // Types from input arguments typedef _TGradient TGradient; typedef _TMask TMask; typedef typename _TGradient::PixelType TVector; typedef typename TVector::ValueType TScalar; itkStaticConstMacro( Dimension, unsigned int, _TGradient::ImageDimension ); // Standard itk types typedef GradientImageFunctionBase Self; typedef itk::ImageFunction< _TGradient, TScalar, TScalar > Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; // Types from base itk::ImageFunction typedef typename Superclass::InputType TInput; typedef typename Superclass::OutputType TOutput; typedef typename Superclass::PointType TPoint; typedef typename Superclass::ContinuousIndexType TContIndex; typedef typename Superclass::IndexType TIndex; public: itkTypeMacro( GradientImageFunctionBase, itkImageFunction ); itkGetConstObjectMacro( Mask, TMask ); itkSetConstObjectMacro( Mask, TMask ); public: virtual void Prepare( ) const; virtual TOutput Evaluate( const TPoint& p ) const cpExtensions_OVERRIDE; virtual TOutput EvaluateAtIndex( const TIndex& i ) const cpExtensions_OVERRIDE; virtual TOutput EvaluateAtContinuousIndex( const TContIndex& i ) const cpExtensions_OVERRIDE; protected: GradientImageFunctionBase( ); virtual ~GradientImageFunctionBase( ); virtual TOutput _Evaluate( const TIndex& i ) const = 0; private: // Purposely not implemented. GradientImageFunctionBase( const Self& ); void operator=( const Self& ); protected: typename _TMask::ConstPointer m_Mask; }; } // ecapseman } // ecapseman #ifndef ITK_MANUAL_INSTANTIATION # include #endif // ITK_MANUAL_INSTANTIATION #endif // __CPEXTENSIONS__ALGORITHMS__GRADIENTIMAGEFUNCTIONBASE__H__ // eof - $RCSfile$