From 8132feffcc284861bc54c49d8878ce65044a912b Mon Sep 17 00:00:00 2001
From: Cyrille Valladeau <cyrille.valladeau@c-s.fr>
Date: Tue, 15 Jan 2008 09:48:40 +0000
Subject: [PATCH] oups... oubli d'un bout de commit.

---
 .../otbProlateInterpolateImageFunction.h      |   4 +-
 .../otbProlateInterpolateImageFunction.txx    |  14 +-
 ...tbWindowedSincInterpolateImageFunction.txx |  13 --
 .../otbGenericInterpolateImageFunction.h~     | 135 ------------------
 .../otbProlateInterpolateImageFunction.cxx    |  23 +--
 Testing/Code/Radiometry/CMakeLists.txt        |   2 +-
 6 files changed, 27 insertions(+), 164 deletions(-)
 delete mode 100644 Code/Common/otbGenericInterpolateImageFunction.h~

diff --git a/Code/BasicFilters/otbProlateInterpolateImageFunction.h b/Code/BasicFilters/otbProlateInterpolateImageFunction.h
index 15ab1ee838..05aae130df 100644
--- a/Code/BasicFilters/otbProlateInterpolateImageFunction.h
+++ b/Code/BasicFilters/otbProlateInterpolateImageFunction.h
@@ -43,8 +43,10 @@ class ProlateFunction
   VectorType GetProfil(){ return m_Profil; };
 
   inline TOutput operator()( const TInput & A ) const
-    { 
+    { std::cout<<"~~~~~Prolate : Function"<<std::endl;
+std::cout<<"~~~~~Prolate : Function : "<<A<<" -> "<<static_cast<TOutput>(m_Profil[static_cast<unsigned int>(A)])<<std::endl;
       return (static_cast<TOutput>(m_Profil[static_cast<unsigned int>(A)])); 
+std::cout<<"~~~~~Prolate : Function : FIN"<<std::endl;
     }
 
   private:
diff --git a/Code/BasicFilters/otbProlateInterpolateImageFunction.txx b/Code/BasicFilters/otbProlateInterpolateImageFunction.txx
index 6bb10befd0..f961387ebb 100644
--- a/Code/BasicFilters/otbProlateInterpolateImageFunction.txx
+++ b/Code/BasicFilters/otbProlateInterpolateImageFunction.txx
@@ -112,12 +112,13 @@ template<class TInputImage, class TBoundaryCondition, class TCoordRep, class TIn
 void
 ProlateInterpolateImageFunction<TInputImage, TBoundaryCondition, TCoordRep, TInputInterpolator, TOutputInterpolator>
 ::SetRadius(unsigned int rad)
-{
+{std::cout<<"*****Prolate : SetRadius"<<std::endl;
   Superclass::SetRadius(rad);
   VectorType temp(2*rad+1, 0.);
   m_ResampledProfil = temp;
   this->ComputeResampledProlateProfil();
   this->Modified();
+std::cout<<"*****Prolate : SetRadius : Fin"<<std::endl;
 }
 
 
@@ -126,7 +127,7 @@ template<class TInputImage, class TBoundaryCondition, class TCoordRep, class TIn
 void
 ProlateInterpolateImageFunction<TInputImage, TBoundaryCondition, TCoordRep, TInputInterpolator, TOutputInterpolator>
 ::ComputeResampledProlateProfil()
-{ 
+{ std::cout<<"*****Prolate : ComputeResampledProlateProfil"<<std::endl;
   unsigned int ival;
   double dval;
   /* Initialisation sur les lignes : */
@@ -141,14 +142,15 @@ ProlateInterpolateImageFunction<TInputImage, TBoundaryCondition, TCoordRep, TInp
       m_ResampledProfil[this->GetRadius()-i] = dval;
       sum += 2*dval;
     }
-  sum -= m_ResampledProfil[this->GetRadius()];// the middle pixel was compted twice
-  mean = sum/(2*this->GetRadius()+1);
-  
+  sum -= m_ResampledProfil[this->GetRadius()];// the middled pixel was compted twice
+  mean = sum/(2*static_cast<double>(this->GetRadius())+1);
+  std::cout<<"*****Prolate : ComputeResampledProlateProfil : mean : "<<mean<<std::endl;
   for (unsigned int i=0; i<m_ResampledProfil.size(); i++)
-    {
+    {std::cout<<"*****Prolate : ComputeResampledProlateProfil : value : "<<m_ResampledProfil[i]<<" -> "<<m_ResampledProfil[i]/mean<<std::endl;
       m_ResampledProfil[i] = m_ResampledProfil[i]/mean;
     }
   this->GetFunction().SetProfil(m_ResampledProfil);
+std::cout<<"*****Prolate : ComputeResampledProlateProfil : Fin"<<std::endl;
 } 
 
 template<class TInputImage, class TBoundaryCondition, class TCoordRep, class TInputInterpolator, class TOutputInterpolator>
diff --git a/Code/BasicFilters/otbWindowedSincInterpolateImageFunction.txx b/Code/BasicFilters/otbWindowedSincInterpolateImageFunction.txx
index b2a689b14a..95d6585b9c 100644
--- a/Code/BasicFilters/otbWindowedSincInterpolateImageFunction.txx
+++ b/Code/BasicFilters/otbWindowedSincInterpolateImageFunction.txx
@@ -33,19 +33,6 @@ WindowedSincInterpolateImageFunction<TInputImage, TWindowFunction, TBoundaryCond
 {
 }
 
-/*
-// Overload method to add the construction of resampledprfil
-template<class TInputImage, class TWindowFunction, class TBoundaryCondition, class TCoordRep>
-void
-WindowedSincInterpolateImageFunction<TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep>
-::SetRadius(unsigned int rad)
-{
-  Superclass::SetRadius(rad);
-  this->GetFunction().SetRadius(rad);
-  this->Modified();
-}
-*/
-
 // Overload method to add the construction of resampledprfil
 template<class TInputImage, class TWindowFunction, class TBoundaryCondition, class TCoordRep>
 void
diff --git a/Code/Common/otbGenericInterpolateImageFunction.h~ b/Code/Common/otbGenericInterpolateImageFunction.h~
deleted file mode 100644
index b12b93f964..0000000000
--- a/Code/Common/otbGenericInterpolateImageFunction.h~
+++ /dev/null
@@ -1,135 +0,0 @@
-/*=========================================================================
-
-Program:   ORFEO Toolbox
-Language:  C++
-Date:      $Date$
-Version:   $Revision$
-
-
-Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
-See OTBCopyright.txt 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 _otbGenericInterpolateImageFunction_h
-#define _otbGenericInterpolateImageFunction_h
-
-#include "itkInterpolateImageFunction.h"
-#include "itkConstNeighborhoodIterator.h"
-#include "itkConstantBoundaryCondition.h"
-
-namespace otb
-{
-  
-/** \class GenericInterpolateImageFunction
- * \brief Generic interpolation of an otb::image.
- *
- * GenericInterpolateImageFunction interpolates image intensity according to a 
- * resampling profil.
- * \ingroup ImageFunctions ImageInterpolators
- */
-template <class TInputImage, class TFunction, class TBoundaryCondition = itk::ConstantBoundaryCondition<TInputImage>, class TCoordRep = double>
-class ITK_EXPORT GenericInterpolateImageFunction : 
-public itk::InterpolateImageFunction<TInputImage,TCoordRep> 
-  {
-    public:
-    /** Standard class typedefs. */
-    typedef GenericInterpolateImageFunction Self;
-    typedef itk::InterpolateImageFunction<TInputImage,TCoordRep> Superclass;
-    typedef itk::SmartPointer<Self> Pointer;
-    typedef itk::SmartPointer<const Self>  ConstPointer;
-    
-    /** Run-time type information (and related methods). */
-    itkTypeMacro(GenericInterpolateImageFunction, itk::InterpolateImageFunction);
-    
-    /** Method for creation through the object factory. */
-    itkNewMacro(Self);  
-    
-    /** Input and output images typedef definition. */
-    typedef typename Superclass::OutputType     OutputType;
-    typedef typename Superclass::InputImageType InputImageType;
-    
-    /** Dimension underlying input image. */
-    //itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
-    
-    /** Index and typedef support. */
-    typedef typename Superclass::IndexType                                 IndexType;
-    typedef typename InputImageType::SizeType                              SizeType;
-    typedef typename Superclass::RealType                                  RealType;
-    typedef TFunction                                                      FunctionType;
-    typedef itk::ConstNeighborhoodIterator< InputImageType, TBoundaryCondition> IteratorType;
-
-    /** ContinuousIndex typedef support. */
-    typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
-
-    /** Dimension underlying input image. */
-    itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
-    
-    virtual void SetInputImage(const InputImageType *image);
-
-    /** Evaluate the function at a ContinuousIndex position
-     *
-     * Returns the interpolated image intensity at a 
-     * specified point position. No bounds checking is done.
-     * The point is assume to lie within the image buffer.
-     *
-     * ImageFunction::IsInsideBuffer() can be used to check bounds before
-     * calling the method. */
-    virtual OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const;
-
- 
-    /** Set/Get the window radius*/
-    void SetRadius(unsigned int rad);
-    unsigned int GetRadius(){ return this->GetFunction().GetRadius();};
-
-    /** Get the functor list */
-    FunctionType& GetFunction(void)
-    {
-      return m_Function;
-    } 
-    
-    /** Delete tables.*/
-    void ResetOffsetTable();
-    /** Initialize used tables*/ 
-    void InitializeTables();    
-    /** Fill the weight offset table*/
-    void FillWeightOffsetTable();
-
-    protected:
-    GenericInterpolateImageFunction();
-    ~GenericInterpolateImageFunction();
-    void PrintSelf(std::ostream& os, itk::Indent indent) const;
- 
-
-    private:
-    GenericInterpolateImageFunction(const Self&); //purposely not implemented
-    void operator=(const Self&); //purposely not implemented
-  /** Store the window radius. */
-    unsigned int m_Radius;
-    // Constant to store twice the radius
-    unsigned int m_WindowSize;
-
-     /** The offset array, used to keep a list of relevant
-     * offsets in the neihborhoodIterator */
-    unsigned int *m_OffsetTable;
-    /** Used function */
-    FunctionType m_Function;
-    /** Size of the offset table */
-    unsigned int m_OffsetTableSize;
-    /** Store the image dimension.*/
-    unsigned int m_ImageDimension;  
-    /** Index into the weights array for each offset */
-    unsigned int **m_WeightOffsetTable;
-  };
-
-} // end namespace itk
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#include "otbGenericInterpolateImageFunction.txx"
-#endif
-
-#endif
diff --git a/Testing/Code/BasicFilters/otbProlateInterpolateImageFunction.cxx b/Testing/Code/BasicFilters/otbProlateInterpolateImageFunction.cxx
index e4720ad6a9..1aa3495ea6 100644
--- a/Testing/Code/BasicFilters/otbProlateInterpolateImageFunction.cxx
+++ b/Testing/Code/BasicFilters/otbProlateInterpolateImageFunction.cxx
@@ -35,11 +35,11 @@ int otbProlateInterpolateImageFunction(int argc, char * argv[])
    unsigned int i = 4;
 
    std::vector<ContinuousIndexType> indicesList;
-
+   std::cout<<"Prolate : Test : while varie jusqua : "<<static_cast<unsigned int>(argc)<<std::endl;
   while(i<static_cast<unsigned int>(argc) && (i+1)<static_cast<unsigned int>(argc))
-    {
+    {  std::cout<<"Prolate : Test : while i vaut : "<<i<<" -> "<<atof(argv[i])<<" , "<<atof(argv[i+1])<<std::endl;
       ContinuousIndexType idx;
-
+      std::cout<<"Prolate : Test : while"<<std::endl;
       idx[0]=atof(argv[i]);
       idx[1]=atof(argv[i+1]);
       
@@ -47,15 +47,20 @@ int otbProlateInterpolateImageFunction(int argc, char * argv[])
 
       i+=2;
     }
-
+  std::cout<<"Prolate : Test : New()"<<std::endl;
   // Instantiating object
   InterpolatorType::Pointer prolate = InterpolatorType::New();
-
+  std::cout<<"Prolate : Test : Reader::New()"<<std::endl;
   ReaderType::Pointer reader = ReaderType::New();
+  std::cout<<"Prolate : Test : Reader::SetFileName : "<<infname<<std::endl;
   reader->SetFileName(infname);
+  std::cout<<"Prolate : Test : Update()"<<std::endl;
   reader->Update();
+  std::cout<<"Prolate : Test : prolate::Setinput()"<<std::endl;
   prolate->SetInputImage(reader->GetOutput());
+  std::cout<<"Prolate : Test : prolate::SetRadius() : "<<atoi(argv[3])<<std::endl;
   prolate->SetRadius(atoi(argv[3]));
+  std::cout<<"Prolate : Test : output name : "<<outfname<<std::endl;
   /************************
   typedef InterpolatorType::VectorType            VectType;
   VectType tutu=prolate->GetResampledProfil();
@@ -67,12 +72,14 @@ int otbProlateInterpolateImageFunction(int argc, char * argv[])
   std::ofstream file;
   file.open(outfname);
 
-
+ std::cout<<"Prolate : Test : for : "<<outfname<<std::endl;
+ unsigned mmm = 1;
   for(std::vector<ContinuousIndexType>::iterator it = indicesList.begin();it!=indicesList.end();++it)
-    {
+    {std::cout<<"Prolate : Test : for indice : "<<mmm<<std::endl;
       file<<(*it)<<" -> "<<prolate->EvaluateAtContinuousIndex((*it))<<std::endl;
+      mmm++;
     }
-  
+   std::cout<<"Prolate : Test : close"<<std::endl;
   file.close();
   
   return EXIT_SUCCESS;
diff --git a/Testing/Code/Radiometry/CMakeLists.txt b/Testing/Code/Radiometry/CMakeLists.txt
index 1aba26db29..e8be3a7078 100755
--- a/Testing/Code/Radiometry/CMakeLists.txt
+++ b/Testing/Code/Radiometry/CMakeLists.txt
@@ -357,7 +357,7 @@ ADD_TEST(raTuAtmosphericCorrectionParametersNew ${RADIOMETRY_TESTS3}
 ##########           otb::FilterFunctionValues -------------------
 # in otbAtmosphericCorrectionParameters.h/.cxx
 ADD_TEST(raTvFilterFunctionValuesTest ${RADIOMETRY_TESTS3}
-    --compare-ascii ${TOL} ${BASELINE_FILES}/raTvFilterFunctionValuesTest.txt
+    --compare-ascii ${EPSILON_10e6} ${BASELINE_FILES}/raTvFilterFunctionValuesTest.txt
                            ${TEMP}/raTvFilterFunctionValuesTest.txt
         otbFilterFunctionValuesTest
 	${TEMP}/raTvFilterFunctionValuesTest.txt
-- 
GitLab