X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FImage%2FFunctors%2FGradientImageFunctionBase.h;fp=lib%2Ffpa%2FImage%2FFunctors%2FGradientImageFunctionBase.h;h=0b53f11941fe97b24af03beda13a60dca98ae098;hb=dfdb2c7a2071c83809767379c88097c9bb1ba7a8;hp=0000000000000000000000000000000000000000;hpb=30e076310c78a53c513b98605e64d661acc954de;p=FrontAlgorithms.git diff --git a/lib/fpa/Image/Functors/GradientImageFunctionBase.h b/lib/fpa/Image/Functors/GradientImageFunctionBase.h new file mode 100644 index 0000000..0b53f11 --- /dev/null +++ b/lib/fpa/Image/Functors/GradientImageFunctionBase.h @@ -0,0 +1,73 @@ +#ifndef __FPA__IMAGE__FUNCTORS__GRADIENTIMAGEFUNCTIONBASE__H__ +#define __FPA__IMAGE__FUNCTORS__GRADIENTIMAGEFUNCTIONBASE__H__ + +#include + +namespace fpa +{ + namespace Image + { + namespace Functors + { + /** + * Base class to compute values based on image gradients (vector). + * It allows incremental computation of the gradient. + */ + template< class _TGradient > + class GradientImageFunctionBase + : public itk::ImageFunction< _TGradient, typename _TGradient::PixelType::ValueType, typename _TGradient::PixelType::ValueType > + { + public: + // Types from input arguments + typedef _TGradient TGradient; + 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 ); + + public: + virtual void Prepare( ) const; + virtual TOutput Evaluate( const TPoint& p ) const; + virtual TOutput EvaluateAtIndex( const TIndex& i ) const; + virtual TOutput EvaluateAtContinuousIndex( const TContIndex& i ) const; + + protected: + GradientImageFunctionBase( ); + virtual ~GradientImageFunctionBase( ); + + virtual TOutput _Evaluate( const TIndex& i ) const = 0; + + private: + // Purposely not implemented. + GradientImageFunctionBase( const Self& ); + void operator=( const Self& ); + }; + + } // ecapseman + + } // ecapseman + +} // ecapseman + +#ifndef ITK_MANUAL_INSTANTIATION +#include +#endif // ITK_MANUAL_INSTANTIATION + +#endif // __FPA__IMAGE__FUNCTORS__GRADIENTIMAGEFUNCTIONBASE__H__ + +// eof - $RCSfile$