]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/Functors/GradientImageFunctionBase.h
...
[FrontAlgorithms.git] / lib / fpa / Image / Functors / GradientImageFunctionBase.h
diff --git a/lib/fpa/Image/Functors/GradientImageFunctionBase.h b/lib/fpa/Image/Functors/GradientImageFunctionBase.h
new file mode 100644 (file)
index 0000000..0b53f11
--- /dev/null
@@ -0,0 +1,73 @@
+#ifndef __FPA__IMAGE__FUNCTORS__GRADIENTIMAGEFUNCTIONBASE__H__
+#define __FPA__IMAGE__FUNCTORS__GRADIENTIMAGEFUNCTIONBASE__H__
+
+#include <itkImageFunction.h>
+
+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 <fpa/Image/Functors/GradientImageFunctionBase.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __FPA__IMAGE__FUNCTORS__GRADIENTIMAGEFUNCTIONBASE__H__
+
+// eof - $RCSfile$