From 2ba0e08bcd103d68ec94bbaa9083f3ce83e9c445 Mon Sep 17 00:00:00 2001
From: Patrick Imbo <patrick.imbo@c-s.fr>
Date: Mon, 20 Mar 2006 15:37:26 +0000
Subject: [PATCH] HuImage invariants

---
 Code/Common/otbComplexMomentImageFunction.h   |  51 ++--
 Code/Common/otbComplexMomentImageFunction.txx |   4 +-
 Code/Common/otbFlusserImageFunction.h         | 130 ++++++++++
 Code/Common/otbFlusserImageFunction.txx       | 228 ++++++++++++++++++
 Code/Common/otbGeometricMomentImageFunction.h |  18 +-
 Code/Common/otbHuImageFunction.h              |  54 ++---
 Code/Common/otbRealMomentImageFunction.h      |  70 ++++++
 7 files changed, 481 insertions(+), 74 deletions(-)
 create mode 100644 Code/Common/otbFlusserImageFunction.h
 create mode 100644 Code/Common/otbFlusserImageFunction.txx
 create mode 100644 Code/Common/otbRealMomentImageFunction.h

diff --git a/Code/Common/otbComplexMomentImageFunction.h b/Code/Common/otbComplexMomentImageFunction.h
index 26d2ebc909..fd6f5dc85c 100644
--- a/Code/Common/otbComplexMomentImageFunction.h
+++ b/Code/Common/otbComplexMomentImageFunction.h
@@ -1,25 +1,20 @@
 /*=========================================================================
 
-  Program:   Insight Segmentation & Registration Toolkit
-  Module:    $RCSfile: itkMeanImageFunction.h,v $
-  Language:  C++
-  Date:      $Date: 2003/09/10 14:29:15 $
-  Version:   $Revision: 1.7 $
-
-  Copyright (c) Insight Software Consortium. All rights reserved.
-  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
-
-     This software is distributed WITHOUT ANY WARRANTY; without even 
-     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
-     PURPOSE.  See the above copyright notices for more information.
+  Programme :   OTB (ORFEO ToolBox)
+  Auteurs   :   CS - P. Imbo
+  Language  :   C++
+  Date      :   20 mars 2006
+  Version   :   
+  Role      :   Complex Geometric Moments Class of iamges 
+  $Id:$
 
 =========================================================================*/
 #ifndef _otbComplexMomentImageFunction_h
 #define _otbComplexMomentImageFunction_h
 
-#include "itkImageFunction.h"
-#include <complex>
+#include "otbGeometricMomentImageFunction.h"
 
+#include <complex>
 
 namespace otb
 {
@@ -31,12 +26,13 @@ namespace otb
  * Calculate the complex moment value over an image. 
  * The implemented equation is:
  *
- *  \f$ C_{p,q}=\int\int_{} (x+iy)^{p} \cdot (x-iy)^{q} \cdot f(x,y) \cdot
- dx \cdot dy \f$
+ *  \f[  c_{p,q}=\int_{-\infty}^{\infty} \int_{-\infty}^{\infty} (x+iy)^{p} \cdot (x-iy)^{q} \cdot f(x,y) \cdot
+ dx \cdot dy \f]
  *
  * With:
- *  + \f$(x,y)$f\ pixel localization;
- *  + \f$ f(x,y) $f\  the pixel value over the \f$(x,y)$f\ coordinate.
+ *
+ *   - \f$ (x,y) \f$ pixel localization;
+ *   - \f$ f(x,y) \f$  the pixel value over the \f$(x,y) \f$ coordinate.
  *
  * This class is templated over the input image type and the
  * coordinate representation type (e.g. float or double).
@@ -44,26 +40,26 @@ namespace otb
  * \ingroup ImageFunctions
  */
 template < class TInput, 
-           class TOutput = std::complex<float >,
+           class TOutput = std::complex<double >,
 	   class TCoordRep = float >
 class ITK_EXPORT ComplexMomentImageFunction :
-  public itk::ImageFunction< TInput, TOutput,TCoordRep >
+    public GeometricMomentImageFunction<TInput, TOutput,TCoordRep>
 {
 public:
   /** Standard class typedefs. */
   typedef ComplexMomentImageFunction                                 Self;
-  typedef itk::ImageFunction< TInput, TOutput,TCoordRep >            Superclass;
+  typedef GeometricMomentImageFunction<TInput, TOutput,TCoordRep>    Superclass;
   typedef itk::SmartPointer<Self>                                    Pointer;
   typedef itk::SmartPointer<const Self>                              ConstPointer;
   
   /** Run-time type information (and related methods). */
-  itkTypeMacro(ComplexMomentImageFunction, itk::ImageFunction);
+  itkTypeMacro(ComplexMomentImageFunction, GeometricMomentImageFunction);
 
   /** Method for creation through the object factory. */
   itkNewMacro(Self);
 
   /** InputImageType typedef support. */
-  typedef TInput                                    InputType;
+  typedef typename Superclass::InputType            InputType;
   typedef typename Superclass::IndexType            IndexType;
   typedef typename Superclass::ContinuousIndexType  ContinuousIndexType;
   typedef typename Superclass::PointType            PointType;
@@ -71,12 +67,9 @@ public:
   typedef TOutput                                   ComplexType;
 
   /** Dimension of the underlying image. */
-  itkStaticConstMacro(ImageDimension, unsigned int,
-                      InputType::ImageDimension);
+//  itkStaticConstMacro(ImageDimension, unsigned int,
+//                      InputType::ImageDimension);
   			 
-  /** Evaluate at the specified input position */
-//  virtual ComplexType Evaluate(const InputType& input) const;
-
   /** Evalulate the function at specified index */
   virtual ComplexType EvaluateAtIndex( const IndexType& index ) const;
   
@@ -116,8 +109,6 @@ private:
   unsigned int m_P;
   unsigned int m_Q;
   int m_NeighborhoodRadius;
-  int m_NeighborhoodRadiusX;
-  int m_NeighborhoodRadiusY;
   
 };
 
diff --git a/Code/Common/otbComplexMomentImageFunction.txx b/Code/Common/otbComplexMomentImageFunction.txx
index ba98f787bd..a2368dee23 100644
--- a/Code/Common/otbComplexMomentImageFunction.txx
+++ b/Code/Common/otbComplexMomentImageFunction.txx
@@ -77,7 +77,7 @@ ComplexMomentImageFunction<TInput,TOutput,TCoordRep>
       return std::complex<float>(0.,0.); // A modifier
 //    return ( NumericTraits<RealType>::max() );
     }
-
+#if 0
    if(m_NeighborhoodRadius<0)
      {
      ImageSize = this->GetInputImage()->GetBufferedRegion().GetSize();
@@ -127,6 +127,8 @@ ComplexMomentImageFunction<TInput,TOutput,TCoordRep>
            
   return (static_cast<ComplexType>(Sum) );
 
+#endif
+
 }
 
 
diff --git a/Code/Common/otbFlusserImageFunction.h b/Code/Common/otbFlusserImageFunction.h
new file mode 100644
index 0000000000..401911ce46
--- /dev/null
+++ b/Code/Common/otbFlusserImageFunction.h
@@ -0,0 +1,130 @@
+/*=========================================================================
+
+  Programme :   OTB (ORFEO ToolBox)
+  Auteurs   :   CS - P. Imbo
+  Language  :   C++
+  Date      :   20 mars 2006
+  Version   :   
+  Role      :   Flusser's invariant Class of iamges 
+  $Id:$
+
+=========================================================================*/
+#ifndef _otbFlusserImageFunction_h
+#define _otbFlusserImageFunction_h
+
+#include "otbRealMomentImageFunction.h"
+
+#include <complex>
+
+
+namespace otb
+{
+
+/**
+ * \class FlusserImageFunction
+ * \brief Calculate the Flusser's invariant parameters.
+ *
+ * Calculate the Flusser's invariant over an image defined as:
+ *
+ * - \f$ \psi_{1} = c_{11} \f$
+ * - \f$ \psi_{2} = c_{21} c_{12} \f$
+ * - \f$ \psi_{3} = Re (c_{20} c_{12}^{2} )\f$
+ * - \f$ \psi_{4} = Im (c_{20} c_{12}^{2} )\f$
+ * - \f$ \psi_{5} = Re (c_{30} c_{12}^{3} )\f$
+ * - \f$ \psi_{6} = Im (c_{30} c_{12}^{3} )\f$
+ * - \f$ \psi_{7} = c_{22} \f$
+ * - \f$ \psi_{8} = Re (c_{31} c_{12}^{2} )\f$
+ * - \f$ \psi_{9} = Im (c_{31} c_{12}^{2} )\f$
+ * - \f$ \psi_{10} = Re (c_{40} c_{12}^{4} )\f$
+ * - \f$ \psi_{11} = Im (c_{40} c_{12}^{4} )\f$
+ *  
+ * With :
+ *
+ *  \f[  c_{p,q}=\int_{-\infty}^{\infty} \int_{-\infty}^{\infty} (x+iy)^{p} \cdot (x-iy)^{q} \cdot f(x,y) \cdot
+ dx \cdot dy \f]
+ *
+ * And:
+ *  - \f$(x,y)\f$ pixel localization;
+ *  - \f$ f(x,y)\f$ the pixel value over the \f$(x,y)\f$ coordinate.
+ *
+ * This class is templated over the input image type and the
+ * coordinate representation type (e.g. float or double).
+ * 
+ * \ingroup ImageFunctions
+ */
+
+template < class TInput, 
+           class TOutput   = double,
+	   class TCoordRep = float >
+class ITK_EXPORT FlusserImageFunction :
+  public RealMomentImageFunction< TInput, TOutput,TCoordRep >
+{
+public:
+  /** Standard class typedefs. */
+  typedef FlusserImageFunction                                      Self;
+  typedef RealMomentImageFunction< TInput, TOutput,TCoordRep >      Superclass;
+  typedef itk::SmartPointer<Self>                                   Pointer;
+  typedef itk::SmartPointer<const Self>                             ConstPointer;
+  
+  /** Run-time type information (and related methods). */
+  itkTypeMacro(FlusserImageFunction, RealMomentImageFunction);
+
+  /** Method for creation through the object factory. */
+  itkNewMacro(Self);
+
+  /** InputImageType typedef support. */
+  typedef TInput                                    InputType;
+  typedef typename Superclass::IndexType            IndexType;
+  typedef typename Superclass::ContinuousIndexType  ContinuousIndexType;
+  typedef typename Superclass::PointType            PointType;
+
+  typedef TOutput                                   RealType;
+  typedef typename std::complex<RealType>           ComplexType;
+   
+  /** Dimension of the underlying image. */
+  itkStaticConstMacro(ImageDimension, unsigned int,
+                      InputType::ImageDimension);
+  			 
+
+  /** Evalulate the function at specified index */
+  virtual RealType EvaluateAtIndex( const IndexType& index ) const;
+  
+  /** Evaluate the function at non-integer positions */
+  virtual RealType Evaluate( const PointType& point ) const
+    { 
+      IndexType index;
+      this->ConvertPointToNearestIndex( point, index );
+      return this->EvaluateAtIndex( index ); 
+    }
+  virtual RealType EvaluateAtContinuousIndex( 
+    const ContinuousIndexType& cindex ) const
+    { 
+      IndexType index;
+      this->ConvertContinuousIndexToNearestIndex( cindex, index );
+      return this->EvaluateAtIndex( index ) ; 
+    }
+
+  /** Get/Set the radius of the neighborhood over which the
+      statistics are evaluated */  
+  itkSetClampMacro(Number,short,1,11);
+  itkGetConstReferenceMacro( Number, short );
+
+protected:
+  FlusserImageFunction();
+  ~FlusserImageFunction(){};
+  void PrintSelf(std::ostream& os, itk::Indent indent) const;
+
+private:
+  FlusserImageFunction( const Self& ); //purposely not implemented
+  void operator=( const Self& ); //purposely not implemented
+
+  short m_Number;  
+};
+
+} // namespace otb
+
+#ifndef OTB_MANUAL_INSTANTIATION
+#include "otbFlusserImageFunction.txx"
+#endif
+
+#endif
diff --git a/Code/Common/otbFlusserImageFunction.txx b/Code/Common/otbFlusserImageFunction.txx
new file mode 100644
index 0000000000..a3c5ca6af7
--- /dev/null
+++ b/Code/Common/otbFlusserImageFunction.txx
@@ -0,0 +1,228 @@
+/*=========================================================================
+
+    Program:   Insight Segmentation & Registration Toolkit
+    Module:    $RCSfile: itkMeanImageFunction.txx,v $
+    Language:  C++
+    Date:      $Date: 2004/12/12 22:07:24 $
+    Version:   $Revision: 1.12 $
+
+    Copyright (c) Insight Software Consortium. All rights reserved.
+    See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
+
+       This software is distributed WITHOUT ANY WARRANTY; without even 
+       the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+       PURPOSE.  See the above copyright notices for more information.
+
+  =========================================================================*/
+#ifndef _otbFlusserImageFunction_txx
+#define _otbFlusserImageFunction_txx
+
+#include "otbFlusserImageFunction.h"
+#include "otbComplexMomentImageFunction.h"
+#include "itkNumericTraits.h"
+#include "itkMacro.h"
+#include <complex>
+
+namespace otb
+{
+
+/**
+   * Constructor
+   */
+template < class TInput, class TOutput, class TCoordRep>
+FlusserImageFunction<TInput,TOutput,TCoordRep>
+::FlusserImageFunction()
+{
+  m_Number =-1; 
+}
+
+/**
+   *
+   */
+template < class TInput, class TOutput, class TCoordRep>
+void
+FlusserImageFunction<TInput,TOutput,TCoordRep>
+::PrintSelf(std::ostream& os, itk::Indent indent) const
+{
+  this->Superclass::PrintSelf(os,indent);
+  os << indent << " m_Number           : "  << m_Number << std::endl;
+}
+
+
+template < class TInput, class TOutput, class TCoordRep>
+typename FlusserImageFunction<TInput,TOutput,TCoordRep>::RealType
+FlusserImageFunction<TInput,TOutput,TCoordRep>
+::EvaluateAtIndex(const IndexType& index) const
+{
+  typename InputType::SizeType        ImageSize;
+  RealType                            FlusserValue;
+  ComplexType                         FlusserValueComplex;
+
+  typedef otb::ComplexMomentImageFunction<InputType,ComplexType>   CMType;
+  typename CMType::Pointer function =CMType::New();
+
+  if( !this->GetInputImage() )
+    {
+    return ( itk::NumericTraits<RealType>::max() );
+    }
+  
+  if ( !this->IsInsideBuffer( index ) )
+    {
+    return ( itk::NumericTraits<RealType>::max() );
+    }
+
+  assert(m_Number > 0);
+  assert(m_Number < 12);
+	
+   function->SetInputImage( this->GetInputImage() );
+
+
+  switch(m_Number)
+    {
+    case 1 : 
+        {
+	ComplexType C11;
+	function->SetP(1);
+	function->SetQ(1);
+	C11 = function->EvaluateAtIndex( index );
+        FlusserValue = C11.real() ;
+	}
+	break;
+    case 2:
+        {
+	ComplexType C21;
+	function->SetP(2);
+	function->SetQ(1);
+	C21 = function->EvaluateAtIndex( index );
+	FlusserValue = abs( C21 * conj(C21) ) ;
+	}
+	break;
+    case 3:
+        {
+	ComplexType C20,C12;
+	function->SetP(2);
+	function->SetQ(0);
+	C20 = function->EvaluateAtIndex( index );
+	function->SetP(1);
+	function->SetQ(2);
+	C12 = function->EvaluateAtIndex( index );
+	FlusserValueComplex = C20 * pow(C12,2);
+	FlusserValue = FlusserValueComplex.real();
+	}
+	break;
+    case 4:
+        {
+	ComplexType C20,C12;
+	function->SetP(2);
+	function->SetQ(0);
+	C20 = function->EvaluateAtIndex( index );
+	function->SetP(1);
+	function->SetQ(2);
+	C12 = function->EvaluateAtIndex( index );
+	FlusserValueComplex = C20 * pow(C12,2);
+	FlusserValue = FlusserValueComplex.imag();
+	}
+	break;
+    case 5:
+        {
+	ComplexType C30,C12;
+	function->SetP(3);
+	function->SetQ(0);
+	C30 = function->EvaluateAtIndex( index );
+	function->SetP(1);
+	function->SetQ(2);
+	C12 = function->EvaluateAtIndex( index );
+
+	FlusserValueComplex = C30 * pow(C12,3) ;
+	FlusserValue = FlusserValueComplex.real();       
+	}	
+	break;
+    case 6:
+        {
+	ComplexType C30,C12;
+	function->SetP(3);
+	function->SetQ(0);
+	C30 = function->EvaluateAtIndex( index );
+	function->SetP(1);
+	function->SetQ(2);
+	C12 = function->EvaluateAtIndex( index );
+
+	FlusserValueComplex = C30 * pow(C12,3) ;
+	FlusserValue = FlusserValueComplex.real();       
+	}	
+	break;
+    case 7 : 
+        {
+	ComplexType C22;
+	function->SetP(2);
+	function->SetQ(2);
+	C22 = function->EvaluateAtIndex( index );
+        FlusserValue = C22.real() ;
+	}
+	break;
+    case 8:
+        {
+	ComplexType C31,C12;
+	function->SetP(3);
+	function->SetQ(1);
+	C31 = function->EvaluateAtIndex( index );
+	function->SetP(1);
+	function->SetQ(2);
+	C12 = function->EvaluateAtIndex( index );
+	FlusserValueComplex = C31 * pow(C12,2);
+	FlusserValue = FlusserValueComplex.real();
+	}
+	break;
+    case 9:
+        {
+	ComplexType C31,C12;
+	function->SetP(3);
+	function->SetQ(1);
+	C31 = function->EvaluateAtIndex( index );
+	function->SetP(1);
+	function->SetQ(2);
+	C12 = function->EvaluateAtIndex( index );
+	FlusserValueComplex = C31 * pow(C12,2);
+	FlusserValue = FlusserValueComplex.imag();
+	}
+	break;
+    case 10:
+        {
+	ComplexType C40,C12;
+	function->SetP(4);
+	function->SetQ(0);
+	C40 = function->EvaluateAtIndex( index );
+	function->SetP(1);
+	function->SetQ(2);
+	C12 = function->EvaluateAtIndex( index );
+	FlusserValueComplex = C40 * pow(C12,4);
+	FlusserValue = FlusserValueComplex.real();
+	}
+	break;
+    case 11:
+        {
+	ComplexType C40,C12;
+	function->SetP(4);
+	function->SetQ(0);
+	C40 = function->EvaluateAtIndex( index );
+	function->SetP(1);
+	function->SetQ(2);
+	C12 = function->EvaluateAtIndex( index );
+	FlusserValueComplex = C40 * pow(C12,4);
+	FlusserValue = FlusserValueComplex.imag();
+	}
+	break;
+	
+    default:
+	itkWarningMacro("Hu's invariant parameters are between 1 and 7");	
+    }
+
+
+  return (static_cast<RealType>(FlusserValue) );
+
+}
+
+
+} // namespace otb
+
+#endif
diff --git a/Code/Common/otbGeometricMomentImageFunction.h b/Code/Common/otbGeometricMomentImageFunction.h
index 41ec651676..1588a687de 100644
--- a/Code/Common/otbGeometricMomentImageFunction.h
+++ b/Code/Common/otbGeometricMomentImageFunction.h
@@ -6,7 +6,7 @@
   Date      :   17 mars 2006
   Version   :   
   Role      :   Geometric Moments Class of iamges 
-  $Id:$
+  $Id$
 
 =========================================================================*/
 #ifndef _otbGeometricMomentImageFunction_h
@@ -20,7 +20,7 @@ namespace otb
 
 /**
  * \class GeometricMomentImageFunction
- * \brief Virtual class for the Gometric moments for an image function
+ * \brief Virtual class for the Geometric moments for an image function
  *
  * \ingroup ImageFunctions
  */
@@ -41,8 +41,6 @@ public:
   /** Run-time type information (and related methods). */
   itkTypeMacro(GeometricMomentImageFunction, itk::ImageFunction);
 
-  /** Method for creation through the object factory. */
-  itkNewMacro(Self);
 
   /** InputImageType typedef support. */
   typedef typename Superclass::InputType            InputType;
@@ -52,18 +50,6 @@ public:
  
   typedef TOutput                                   OutputType;
 
-  /** Evaluate the function at specified Point position.
-   * Subclasses must provide this method. */
-  virtual TOutput Evaluate( const PointType& point ) const = 0;
-
-  /** Evaluate the function at specified Index position.
-   * Subclasses must provide this method. */
-  virtual TOutput EvaluateAtIndex( const IndexType & index ) const = 0;
-
-  /** Evaluate the function at specified ContinousIndex position.
-   * Subclasses must provide this method. */
-  virtual TOutput EvaluateAtContinuousIndex( 
-    const ContinuousIndexType & index ) const = 0;
 
 protected:
   GeometricMomentImageFunction() {};
diff --git a/Code/Common/otbHuImageFunction.h b/Code/Common/otbHuImageFunction.h
index bd06b7a688..50577017d4 100644
--- a/Code/Common/otbHuImageFunction.h
+++ b/Code/Common/otbHuImageFunction.h
@@ -1,23 +1,20 @@
 /*=========================================================================
 
-  Program:   Insight Segmentation & Registration Toolkit
-  Module:    $RCSfile: itkMeanImageFunction.h,v $
-  Language:  C++
-  Date:      $Date: 2003/09/10 14:29:15 $
-  Version:   $Revision: 1.7 $
-
-  Copyright (c) Insight Software Consortium. All rights reserved.
-  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
-
-     This software is distributed WITHOUT ANY WARRANTY; without even 
-     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
-     PURPOSE.  See the above copyright notices for more information.
+  Programme :   OTB (ORFEO ToolBox)
+  Auteurs   :   CS - P. Imbo
+  Language  :   C++
+  Date      :   20 mars 2006
+  Version   :   
+  Role      :   Hu's invariant Class of iamges 
+  $Id:$
 
 =========================================================================*/
 #ifndef _otbHuImageFunction_h
 #define _otbHuImageFunction_h
 
-#include "itkImageFunction.h"
+//#include "itkImageFunction.h"
+#include "otbRealMomentImageFunction.h"
+
 #include <complex>
 
 
@@ -30,43 +27,46 @@ namespace otb
  *
  * Calculate the Hu's invariant over an image defined as:
  *
- * \f$ \phi_{1} = c_{11} \f$
- * \f$ \phi_{2} = c_{20} c_{02} \f$
- * \f$ \phi_{3} = c_{30} c_{03} \f$
- * \f$ \phi_{4} = c_{21} c_{12} \f$
- * \f$ \phi_{5} = \Re (c_{30} c_{12}^{3}) \f$
- * \f$ \phi_{6} = \Re (c_{20} c_{12}^{2}) \f$
- * \f$ \phi_{7} = \Im (c_{30} c_{12}^{3}) \f$
+ * - \f$ \phi_{1} = c_{11} \f$
+ * - \f$ \phi_{2} = c_{20} c_{02} \f$
+ * - \f$ \phi_{3} = c_{30} c_{03} \f$
+ * - \f$ \phi_{4} = c_{21} c_{12} \f$
+ * - \f$ \phi_{5} = Re (c_{30} c_{12}^{3}) \f$
+ * - \f$ \phi_{6} = Re (c_{20} c_{12}^{2}) \f$
+ * - \f$ \phi_{7} = Im (c_{30} c_{12}^{3}) \f$
  *  
  * With :
  *
- *  \f$ C_{p,q}=\int\int_{} (x+iy)^{p} \cdot (x-iy)^{q} \cdot f(x,y) \cdot
- dx \cdot dy \f$
+ *  \f[  c_{p,q}=\int_{-\infty}^{\infty} \int_{-\infty}^{\infty} (x+iy)^{p} \cdot (x-iy)^{q} \cdot f(x,y) \cdot
+ dx \cdot dy \f]
  *
  * And:
- *  + \f$(x,y)$f\ pixel localization;
- *  + \f$ f(x,y) $f\  the pixel value over the \f$(x,y)$f\ coordinate.
+ *  - \f$(x,y)\f$ pixel localization;
+ *  - \f$ f(x,y)\f$  the pixel value over the \f$(x,y)\f$ coordinate.
  *
  * This class is templated over the input image type and the
  * coordinate representation type (e.g. float or double).
  * 
  * \ingroup ImageFunctions
  */
+//  public itk::ImageFunction< TInput, TOutput,TCoordRep >
+
 template < class TInput, 
            class TOutput   = double,
 	   class TCoordRep = float >
 class ITK_EXPORT HuImageFunction :
-  public itk::ImageFunction< TInput, TOutput,TCoordRep >
+  public RealMomentImageFunction< TInput, TOutput,TCoordRep >
 {
 public:
   /** Standard class typedefs. */
   typedef HuImageFunction                                           Self;
-  typedef itk::ImageFunction< TInput, TOutput,TCoordRep >           Superclass;
+  typedef RealMomentImageFunction< TInput, TOutput,TCoordRep >      Superclass;
   typedef itk::SmartPointer<Self>                                   Pointer;
   typedef itk::SmartPointer<const Self>                             ConstPointer;
   
   /** Run-time type information (and related methods). */
-  itkTypeMacro(HuImageFunction, itk::ImageFunction);
+//  itkTypeMacro(HuImageFunction, itk::ImageFunction);
+  itkTypeMacro(HuImageFunction, RealMomentImageFunction);
 
   /** Method for creation through the object factory. */
   itkNewMacro(Self);
diff --git a/Code/Common/otbRealMomentImageFunction.h b/Code/Common/otbRealMomentImageFunction.h
new file mode 100644
index 0000000000..0e25af090e
--- /dev/null
+++ b/Code/Common/otbRealMomentImageFunction.h
@@ -0,0 +1,70 @@
+/*=========================================================================
+
+  Programme :   OTB (ORFEO ToolBox)
+  Auteurs   :   CS - P. Imbo
+  Language  :   C++
+  Date      :   17 mars 2006
+  Version   :   
+  Role      :   Real Geometric Moments Class of iamges 
+  $Id:$
+
+=========================================================================*/
+#ifndef _otbRealMomentImageFunction_h
+#define _otbRealMomentImageFunction_h
+
+#include "otbGeometricMomentImageFunction.h"
+
+
+namespace otb
+{
+
+/**
+ * \class RealMomentImageFunction
+ * \brief Virtual class for the Real moments for an image function
+ *
+ * \ingroup ImageFunctions
+ */
+
+template < class TInput, 
+           class TOutput = float,
+	   class TCoordRep = float >
+class ITK_EXPORT RealMomentImageFunction :
+  public GeometricMomentImageFunction<TInput, TOutput,TCoordRep >
+{
+public:
+  /** Standard class typedefs. */
+  typedef RealMomentImageFunction                                     Self;
+  typedef GeometricMomentImageFunction< TInput, TOutput,TCoordRep >   Superclass;
+  typedef itk::SmartPointer<Self>                                     Pointer;
+  typedef itk::SmartPointer<const Self>                               ConstPointer;
+  
+  /** Run-time type information (and related methods). */
+  itkTypeMacro(RealMomentImageFunction, GeometricMomentImageFunction);
+
+
+  /** InputImageType typedef support. */
+  typedef typename Superclass::InputType            InputType;
+  typedef typename Superclass::IndexType            IndexType;
+  typedef typename Superclass::ContinuousIndexType  ContinuousIndexType;
+  typedef typename Superclass::PointType            PointType;
+ 
+  typedef TOutput                                   OutputType;
+
+
+protected:
+  RealMomentImageFunction() {};
+  ~RealMomentImageFunction(){};
+  void PrintSelf(std::ostream& os, itk::Indent indent) const 
+     {
+      Superclass::PrintSelf( os, indent );
+     }
+     
+private:
+  RealMomentImageFunction( const Self& ); //purposely not implemented
+  void operator=( const Self& );               //purposely not implemented
+};
+
+} // namespace otb
+
+#endif
+
-- 
GitLab