From 37a42b4a2d2bda0679e9943882896cbfdad8bfdb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ga=C3=ABlle=20USSEGLIO?= <gaelle.usseglio@cnes.fr>
Date: Wed, 10 Jul 2019 11:55:06 +0000
Subject: [PATCH] ENH : Clean for correlation/deformation grid applications

---
 app/CMakeLists.txt                            |   4 -
 app/otbSARCorrelationGrid.cxx                 |  91 ++++----
 app/otbSARCorrelationPrecise.cxx              | 194 ------------------
 app/otbSARFineDeformationGrid.cxx             |  16 +-
 ... => otbSARFFTCorrelationGridImageFilter.h} |  29 +--
 ...> otbSARFFTCorrelationGridImageFilter.txx} |  36 ++--
 python_src/diapOTB.py                         |   4 -
 python_src/diapOTB_S1IW.py                    |   2 -
 8 files changed, 86 insertions(+), 290 deletions(-)
 delete mode 100644 app/otbSARCorrelationPrecise.cxx
 rename include/{otbSARCorrelationGridImageFilter.h => otbSARFFTCorrelationGridImageFilter.h} (91%)
 rename include/{otbSARCorrelationGridImageFilter.txx => otbSARFFTCorrelationGridImageFilter.txx} (96%)

diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 220370d..dd339f5 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -104,7 +104,3 @@ OTB_CREATE_APPLICATION(NAME SARCorrelationRough
                        LINK_LIBRARIES ${${otb-module}_LIBRARIES}
 )
 
-OTB_CREATE_APPLICATION(NAME SARCorrelationPrecise
-                       SOURCES otbSARCorrelationPrecise.cxx
-                       LINK_LIBRARIES ${${otb-module}_LIBRARIES}
-)
diff --git a/app/otbSARCorrelationGrid.cxx b/app/otbSARCorrelationGrid.cxx
index b908e29..7976294 100644
--- a/app/otbSARCorrelationGrid.cxx
+++ b/app/otbSARCorrelationGrid.cxx
@@ -21,7 +21,10 @@
 #include "otbWrapperApplication.h"
 #include "otbWrapperApplicationFactory.h"
 
-#include "otbSARCorrelationGridImageFilter.h"
+#include "itkFFTNormalizedCorrelationImageFilter.h"
+#include "itkMinimumMaximumImageCalculator.h"
+
+#include "otbSARTemporalCorrelationGridImageFilter.h"
 
 #include <iostream>
 #include <string>
@@ -42,22 +45,23 @@ public:
   itkTypeMacro(SARCorrelationGrid, otb::Wrapper::Application);
 
   // Filters
-  typedef otb::SARCorrelationGridImageFilter<FloatImageType, FloatVectorImageType> CorGridFilterType;
+  typedef itk::FFTNormalizedCorrelationImageFilter<FloatImageType, FloatImageType>          CorFilterType;
+  typedef itk::MinimumMaximumImageCalculator< FloatImageType>			            MinMaxCalculatorType;
+  typedef otb::SARTemporalCorrelationGridImageFilter<FloatImageType, FloatVectorImageType>  CorGridFilterType;
   
 
 private:
   void DoInit() override
   {
     SetName("SARCorrelationGrid");
-    SetDescription("Computes SAR correlation grid.");
+    SetDescription("Computes SAR correlation shift (into temporal domain).");
 
-    SetDocLongDescription("This application creates a deformation grid based "
-      "on correlation estimation.\nThe output grid is a VectorImage composed of"
-      " three values : shift in range, shift in azimut and a correlation rate. "
-      "The inputs of this application are MultiLooked images (real images).");
+    SetDocLongDescription("This application computes correlation shifts between two images : "
+    "shift in range and shift in azimut. "
+    "The inputs of this application are MultiLooked images (real images).");
 
     //Optional descriptors
-    SetDocLimitations("Only Sentinel 1 products are supported for now.");
+    SetDocLimitations("Only Sentinel 1 products and Cosmo are supported for now.");
     SetDocAuthors("OTB-Team");
     SetDocSeeAlso(" ");
     AddDocTag(Tags::SAR);
@@ -69,13 +73,6 @@ private:
     AddParameter(ParameterType_InputImage,  "inslave",   "Input Slave image (real image)");
     SetParameterDescription("inslave", "Slave Image (real image).");
 
-    AddParameter(ParameterType_InputFilename,  "indem",   "Input DEM directory");
-    SetParameterDescription("indem", "Input DEM directory to help projection.");
-    MandatoryOff("indem");
-    
-    AddParameter(ParameterType_OutputImage, "out", "Output Correlation grid (Vector Image)");
-    SetParameterDescription("out","Output Correlation Grid Vector Image (Shift_ran, Shift_azi, Correlation_rate).");
-
     AddParameter(ParameterType_Int, "mlran", "MultiLook factor on distance");
     SetParameterDescription("mlran","MultiLook factor on distance.");
     SetDefaultParameterInt("mlran", 3);
@@ -87,12 +84,6 @@ private:
     SetDefaultParameterInt("mlazi", 3);
     SetMinimumParameterIntValue("mlazi", 1);
     MandatoryOff("mlazi");
-    
-    AddParameter(ParameterType_Int, "patchsize", "Size of patch into each dimension for correlation estimation");
-    SetParameterDescription("patchsize","Size of patch into each dimension for correlation estimation.");
-    SetDefaultParameterInt("patchsize", 20);
-    SetMinimumParameterIntValue("patchsize", 1);
-    MandatoryOff("patchsize");
 
     AddParameter(ParameterType_Int, "gridsteprange", "Grid step for range dimension (into SLC/SAR geometry)");
     SetParameterDescription("gridsteprange","Grid step for range dimension (into SLC/SAR geometry).");
@@ -106,18 +97,21 @@ private:
     SetMinimumParameterIntValue("gridstepazimut", 1);
     MandatoryOff("gridstepazimut");
 
-    AddParameter(ParameterType_Int,"subpixel","Subpixel measure");
-    SetParameterDescription("subpixel", "Subpixel measure.");
-    SetDefaultParameterInt("subpixel", 10);
-    SetMinimumParameterIntValue("subpixel", 1);
-    MandatoryOff("subpixel");
+    AddParameter(ParameterType_Int, "nooffset", "Set 0 to offset of first Line and Colunm of output grid");
+    SetParameterDescription("nooffset", "If 1, then no offset for the first L/C if output grid.");
+    SetDefaultParameterInt("nooffset", 0);
+    SetMinimumParameterIntValue("nooffset", 0);
+    MandatoryOff("nooffset");
 
+    // Parameter Output
+    AddParameter(ParameterType_OutputImage, "out", "Output Correlation grid (Vector Image)");
+    SetParameterDescription("out","Output Correlation Grid Vector Image (Shift_ran, Shift_azi, Correlation_rate).");
+    
     AddRAMParameter();
 
-    SetDocExampleParameterValue("indem","./DEMDir");
     SetDocExampleParameterValue("inmaster","s1a-s4-slc-vv-20160818t014650-20160818t014715-012648-013db1-002_ML.tiff");
     SetDocExampleParameterValue("inslave","s1b-s4-slc-vv-20160929t014610-20160929t014634-002277-003d71-002_ML.tiff");
-    SetDocExampleParameterValue("out","corGrid.tif");
+    SetDocExampleParameterValue("out", "out_CorrelationGrid.tiff");
   }
 
   void DoUpdateParameters() override
@@ -132,38 +126,57 @@ void DoExecute() override
   int factorML_ran = GetParameterInt("mlran");
   int grid_step_azi = GetParameterInt("gridstepazimut");
   int grid_step_ran = GetParameterInt("gridsteprange");
-  int patch_size = GetParameterInt("patchsize");
-  int subpixel = GetParameterInt("subpixel");
+  int nooffset = GetParameterInt("nooffset");
 
   // Log information
   otbAppLogINFO(<<"ML Factor on azimut :"<<factorML_azi);
   otbAppLogINFO(<<"ML Factor on range : "<<factorML_ran);
   otbAppLogINFO(<<"Grid Step for range : "<<grid_step_ran);
   otbAppLogINFO(<<"Grid Step for azimut : "<<grid_step_azi);
-  otbAppLogINFO(<<"Patch Size : "<<patch_size);
-  otbAppLogINFO(<<"SubPixel Measure : "<<subpixel);
 
   // Get master and slave image
   FloatImageType::Pointer MasterPtr = GetParameterFloatImage("inmaster");
   FloatImageType::Pointer SlavePtr = GetParameterFloatImage("inslave");
+   
   
-  // CorrelationGrid Filter
+  // Correlation Filter
+  CorFilterType::Pointer correlationFilter = CorFilterType::New();
+  m_Ref.push_back(correlationFilter.GetPointer());
+  correlationFilter->SetFixedImage(MasterPtr);
+  correlationFilter->SetMovingImage(SlavePtr);
+  correlationFilter->Update();
+
+  // Min/Max calculator
+  MinMaxCalculatorType::Pointer minMaxFilter = MinMaxCalculatorType::New();
+  minMaxFilter->SetImage(correlationFilter->GetOutput());
+  minMaxFilter->ComputeMaximum();
+
+  float shiftSLC_range = ((correlationFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[0]/2.)-
+		       minMaxFilter->GetIndexOfMaximum()[0]) * static_cast<float>(factorML_ran);
+  float shiftSLC_azimut = ((correlationFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[1]/2.)
+			-minMaxFilter->GetIndexOfMaximum()[1]) * static_cast<float>(factorML_azi);
+
+  float shiftML_range = ((correlationFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[0]/2.)-
+			  minMaxFilter->GetIndexOfMaximum()[0]);
+  float shiftML_azimut = ((correlationFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[1]/2.)
+  -minMaxFilter->GetIndexOfMaximum()[1]);
+
+  // Correlation Grid Filter 
   CorGridFilterType::Pointer filterCorrelationGrid = CorGridFilterType::New();
   m_Ref.push_back(filterCorrelationGrid.GetPointer());
 
   // Configure CorrelationGrid Filter
   filterCorrelationGrid->SetMLran(factorML_ran);
   filterCorrelationGrid->SetMLazi(factorML_azi);
-  filterCorrelationGrid->SetPatchSizePerDim(patch_size);
   filterCorrelationGrid->SetGridStep(grid_step_ran, grid_step_azi);
-  filterCorrelationGrid->SetSubPixelAccuracy(subpixel);
-  // Set DEM Directory if required
-  if (GetParameterByKey("indem")->HasValue())
+  filterCorrelationGrid->SetRoughShift_ran(shiftML_range);
+  filterCorrelationGrid->SetRoughShift_azi(shiftML_azimut);
+  if (nooffset)
     {
-      std::string demDir = GetParameterString("indem");
-      filterCorrelationGrid->activateDEM(demDir);
+      filterCorrelationGrid->SetFirstLCOffset(false);
     }
 
+  
   // Define the main pipeline 
   filterCorrelationGrid->SetMasterInput(MasterPtr);
   filterCorrelationGrid->SetSlaveInput(SlavePtr);
diff --git a/app/otbSARCorrelationPrecise.cxx b/app/otbSARCorrelationPrecise.cxx
deleted file mode 100644
index 0e1a4e0..0000000
--- a/app/otbSARCorrelationPrecise.cxx
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (C) 2005-2018 Centre National d'Etudes Spatiales (CNES)
- *
- * This file is part of Orfeo Toolbox
- *
- *     https://www.orfeo-toolbox.org/
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "otbWrapperApplication.h"
-#include "otbWrapperApplicationFactory.h"
-
-#include "itkFFTNormalizedCorrelationImageFilter.h"
-#include "itkMinimumMaximumImageCalculator.h"
-
-#include "otbSARTemporalCorrelationGridImageFilter.h"
-
-#include <iostream>
-#include <string>
-#include <fstream>
-
-namespace otb
-{
-namespace Wrapper
-{
-
-class SARCorrelationPrecise : public Application
-{
-public:
-  typedef SARCorrelationPrecise Self;
-  typedef itk::SmartPointer<Self> Pointer; 
-
-  itkNewMacro(Self);
-  itkTypeMacro(SARCorrelationPrecise, otb::Wrapper::Application);
-
-  // Filters
-  typedef itk::FFTNormalizedCorrelationImageFilter<FloatImageType, FloatImageType>          CorFilterType;
-  typedef itk::MinimumMaximumImageCalculator< FloatImageType>			            MinMaxCalculatorType;
-  typedef otb::SARTemporalCorrelationGridImageFilter<FloatImageType, FloatVectorImageType>  CorGridFilterType;
-  
-
-private:
-  void DoInit() override
-  {
-    SetName("SARCorrelationPrecise");
-    SetDescription("Computes SAR correlation shift (into temporal domain).");
-
-    SetDocLongDescription("This application computes correlation shifts between two images : "
-    "shift in range and shift in azimut. "
-    "The inputs of this application are MultiLooked images (real images).");
-
-    //Optional descriptors
-    SetDocLimitations("Only Sentinel 1 products and Cosmo are supported for now.");
-    SetDocAuthors("OTB-Team");
-    SetDocSeeAlso(" ");
-    AddDocTag(Tags::SAR);
-
-    //Parameter declarations
-    AddParameter(ParameterType_InputImage,  "inmaster",   "Input Master image (real image)");
-    SetParameterDescription("inmaster", "Master Image (real image).");
-
-    AddParameter(ParameterType_InputImage,  "inslave",   "Input Slave image (real image)");
-    SetParameterDescription("inslave", "Slave Image (real image).");
-
-    AddParameter(ParameterType_Int, "mlran", "MultiLook factor on distance");
-    SetParameterDescription("mlran","MultiLook factor on distance.");
-    SetDefaultParameterInt("mlran", 3);
-    SetMinimumParameterIntValue("mlran", 1);
-    MandatoryOff("mlran");
-    
-    AddParameter(ParameterType_Int, "mlazi", "MultiLook factor on azimut");
-    SetParameterDescription("mlazi","MultiLook factor on azimut.");
-    SetDefaultParameterInt("mlazi", 3);
-    SetMinimumParameterIntValue("mlazi", 1);
-    MandatoryOff("mlazi");
-
-    AddParameter(ParameterType_Int, "gridsteprange", "Grid step for range dimension (into SLC/SAR geometry)");
-    SetParameterDescription("gridsteprange","Grid step for range dimension (into SLC/SAR geometry).");
-    SetDefaultParameterInt("gridsteprange", 150);
-    SetMinimumParameterIntValue("gridsteprange", 1);
-    MandatoryOff("gridsteprange");
-
-    AddParameter(ParameterType_Int, "gridstepazimut", "Grid step for azimut dimension (into SLC/SAR geometry)");
-    SetParameterDescription("gridstepazimut","Grid step for azimut dimension (into SLC/SAR geometry).");
-    SetDefaultParameterInt("gridstepazimut", 150);
-    SetMinimumParameterIntValue("gridstepazimut", 1);
-    MandatoryOff("gridstepazimut");
-
-    AddParameter(ParameterType_Int, "nooffset", "Set 0 to offset of first Line and Colunm of output grid");
-    SetParameterDescription("nooffset", "If 1, then no offset for the first L/C if output grid.");
-    SetDefaultParameterInt("nooffset", 0);
-    SetMinimumParameterIntValue("nooffset", 0);
-    MandatoryOff("nooffset");
-
-    // Parameter Output
-    AddParameter(ParameterType_OutputImage, "out", "Output Correlation grid (Vector Image)");
-    SetParameterDescription("out","Output Correlation Grid Vector Image (Shift_ran, Shift_azi, Correlation_rate).");
-    
-    AddRAMParameter();
-
-    SetDocExampleParameterValue("inmaster","s1a-s4-slc-vv-20160818t014650-20160818t014715-012648-013db1-002_ML.tiff");
-    SetDocExampleParameterValue("inslave","s1b-s4-slc-vv-20160929t014610-20160929t014634-002277-003d71-002_ML.tiff");
-    SetDocExampleParameterValue("out", "out_CorrelationGrid.tiff");
-  }
-
-  void DoUpdateParameters() override
-  {
-// Nothing to do here : all parameters are independent
-  }
-
-void DoExecute() override
-{  
-  // Get numeric parameters
-  int factorML_azi = GetParameterInt("mlazi");
-  int factorML_ran = GetParameterInt("mlran");
-  int grid_step_azi = GetParameterInt("gridstepazimut");
-  int grid_step_ran = GetParameterInt("gridsteprange");
-  int nooffset = GetParameterInt("nooffset");
-
-  // Log information
-  otbAppLogINFO(<<"ML Factor on azimut :"<<factorML_azi);
-  otbAppLogINFO(<<"ML Factor on range : "<<factorML_ran);
-  otbAppLogINFO(<<"Grid Step for range : "<<grid_step_ran);
-  otbAppLogINFO(<<"Grid Step for azimut : "<<grid_step_azi);
-
-  // Get master and slave image
-  FloatImageType::Pointer MasterPtr = GetParameterFloatImage("inmaster");
-  FloatImageType::Pointer SlavePtr = GetParameterFloatImage("inslave");
-   
-  
-  // Correlation Filter
-  CorFilterType::Pointer correlationFilter = CorFilterType::New();
-  m_Ref.push_back(correlationFilter.GetPointer());
-  correlationFilter->SetFixedImage(MasterPtr);
-  correlationFilter->SetMovingImage(SlavePtr);
-  correlationFilter->Update();
-
-  // Min/Max calculator
-  MinMaxCalculatorType::Pointer minMaxFilter = MinMaxCalculatorType::New();
-  minMaxFilter->SetImage(correlationFilter->GetOutput());
-  minMaxFilter->ComputeMaximum();
-
-  float shiftSLC_range = ((correlationFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[0]/2.)-
-		       minMaxFilter->GetIndexOfMaximum()[0]) * static_cast<float>(factorML_ran);
-  float shiftSLC_azimut = ((correlationFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[1]/2.)
-			-minMaxFilter->GetIndexOfMaximum()[1]) * static_cast<float>(factorML_azi);
-
-  float shiftML_range = ((correlationFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[0]/2.)-
-			  minMaxFilter->GetIndexOfMaximum()[0]);
-  float shiftML_azimut = ((correlationFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[1]/2.)
-  -minMaxFilter->GetIndexOfMaximum()[1]);
-
-  // Correlation Grid Filter 
-  CorGridFilterType::Pointer filterCorrelationGrid = CorGridFilterType::New();
-  m_Ref.push_back(filterCorrelationGrid.GetPointer());
-
-  // Configure CorrelationGrid Filter
-  filterCorrelationGrid->SetMLran(factorML_ran);
-  filterCorrelationGrid->SetMLazi(factorML_azi);
-  filterCorrelationGrid->SetGridStep(grid_step_ran, grid_step_azi);
-  filterCorrelationGrid->SetRoughShift_ran(shiftML_range);
-  filterCorrelationGrid->SetRoughShift_azi(shiftML_azimut);
-  if (nooffset)
-    {
-      filterCorrelationGrid->SetFirstLCOffset(false);
-    }
-
-  
-  // Define the main pipeline 
-  filterCorrelationGrid->SetMasterInput(MasterPtr);
-  filterCorrelationGrid->SetSlaveInput(SlavePtr);
-  SetParameterOutputImage("out", filterCorrelationGrid->GetOutput());
-}
-   // Vector for filters 
-  std::vector<itk::ProcessObject::Pointer> m_Ref;
-};
-
-
-}
-
-}
-
-OTB_APPLICATION_EXPORT(otb::Wrapper::SARCorrelationPrecise)
diff --git a/app/otbSARFineDeformationGrid.cxx b/app/otbSARFineDeformationGrid.cxx
index ba6ffdd..4686a1e 100644
--- a/app/otbSARFineDeformationGrid.cxx
+++ b/app/otbSARFineDeformationGrid.cxx
@@ -46,7 +46,7 @@ private:
     ClearApplications(); 	
        
     // Add the three internal applications
-    AddApplication("SARCorrelationPrecise", "CorGridApp", "Application for correlation grid creation");
+    AddApplication("SARCorrelationGrid", "CorGridApp", "Application for correlation grid creation");
     AddApplication("SARDEMGrid", "DEMGridApp", "Application for DEM grid creation");
     AddApplication("SARCorrectionGrid", "CorrectionGridApp", "Application for DEM grid correction by correlation grid");
      
@@ -107,12 +107,6 @@ private:
     SetMinimumParameterIntValue("mlazi", 1);
     MandatoryOff("mlazi");
     
-    AddParameter(ParameterType_Int, "patchsize", "Size of patch into each dimension for correlation estimation");
-    SetParameterDescription("patchsize","Size of patch into each dimension for correlation estimation.");
-    SetDefaultParameterInt("patchsize", 20);
-    SetMinimumParameterIntValue("patchsize", 1);
-    MandatoryOff("patchsize");
-
     AddParameter(ParameterType_Int, "gridsteprange", "Grid step for range dimension (into SLC/SAR geometry)");
     SetParameterDescription("gridsteprange","Grid step for range dimension (into SLC/SAR geometry).");
     SetDefaultParameterInt("gridsteprange", 150);
@@ -125,12 +119,6 @@ private:
     SetMinimumParameterIntValue("gridstepazimut", 1);
     MandatoryOff("gridstepazimut");
 
-    AddParameter(ParameterType_Int,"subpixel","Subpixel measure");
-    SetParameterDescription("subpixel", "Subpixel measure.");
-    SetDefaultParameterInt("subpixel", 10);
-    SetMinimumParameterIntValue("subpixel", 1);
-    MandatoryOff("subpixel");
-
     AddParameter(ParameterType_Float, "threshold", "Threshold for correlation rate");
     SetParameterDescription("threshold","Threshold for correlation rate.");
     SetDefaultParameterFloat("threshold", 0.3);
@@ -175,8 +163,6 @@ private:
     int factor_ran = GetParameterInt("mlran");
     int grid_step_azi = GetParameterInt("gridstepazimut");
     int grid_step_ran = GetParameterInt("gridsteprange");
-    int patch_size = GetParameterInt("patchsize");
-    int subpixel = GetParameterInt("subpixel");
     float threshold = GetParameterFloat("threshold");
     float gap = GetParameterFloat("gap");
 
diff --git a/include/otbSARCorrelationGridImageFilter.h b/include/otbSARFFTCorrelationGridImageFilter.h
similarity index 91%
rename from include/otbSARCorrelationGridImageFilter.h
rename to include/otbSARFFTCorrelationGridImageFilter.h
index 2beff82..35533c5 100644
--- a/include/otbSARCorrelationGridImageFilter.h
+++ b/include/otbSARFFTCorrelationGridImageFilter.h
@@ -18,8 +18,8 @@
  * limitations under the License.
  */
 
-#ifndef otbSARCorrelationGridImageFilter_h
-#define otbSARCorrelationGridImageFilter_h
+#ifndef otbSARFFTCorrelationGridImageFilter_h
+#define otbSARFFTCorrelationGridImageFilter_h
 
 #include "itkImageToImageFilter.h"
 #include "itkSmartPointer.h"
@@ -35,22 +35,23 @@
 
 namespace otb
 {
-  /** \class SARCorrelationGridImageFilter 
+  /** \class SARFFTCorrelationGridImageFilter 
    * \brief Estimates a deformation grid between two images (master and slave) for the azimut and range 
    * dimension. A correlation rate is also calculated. The DEM can be used. 
    * 
-   * This filter performs the estimation of deformations between two images (the images are reals).
+   * This filter performs the estimation of deformations between two images (the images are reals) in spectral 
+   * domain.
    * 
    * \ingroup DiapOTBModule
    */
 
-  template <typename TImageIn,  typename TImageOut> class ITK_EXPORT SARCorrelationGridImageFilter :
+  template <typename TImageIn,  typename TImageOut> class ITK_EXPORT SARFFTCorrelationGridImageFilter :
     public itk::ImageToImageFilter<TImageIn,TImageOut>
   {
   public:
 
     // Standard class typedefs
-    typedef SARCorrelationGridImageFilter                    Self;
+    typedef SARFFTCorrelationGridImageFilter                    Self;
     typedef itk::ImageToImageFilter<TImageIn,TImageOut>    Superclass;
     typedef itk::SmartPointer<Self>                        Pointer;
     typedef itk::SmartPointer<const Self>                  ConstPointer;
@@ -169,23 +170,23 @@ namespace otb
   
   protected:
     // Constructor
-    SARCorrelationGridImageFilter();
+    SARFFTCorrelationGridImageFilter();
 
     // Destructor
-    virtual ~SARCorrelationGridImageFilter() ITK_OVERRIDE {};
+    virtual ~SARFFTCorrelationGridImageFilter() ITK_OVERRIDE {};
 
     // Print
     void PrintSelf(std::ostream & os, itk::Indent indent) const ITK_OVERRIDE;
   
-    /** SARCorrelationGridImageFilter produces an vector image to indicate the deformation for the two dimensions 
+    /** SARFFTCorrelationGridImageFilter produces an vector image to indicate the deformation for the two dimensions 
      * and the correlation rate. The differences between output and input images are the size of images and the 
      * dimensions. The input images a classic images and the output is a otb::VectorImage with three components.
-     * As such, SARCorrelationGridImageFilter needs to provide an implementation for 
+     * As such, SARFFTCorrelationGridImageFilter needs to provide an implementation for 
      * GenerateOutputInformation() in order to inform the pipeline execution model. 
      */ 
     virtual void GenerateOutputInformation() ITK_OVERRIDE;
 
-    /** SARCorrelationGridImageFilter needs input requested regions (for master and slave images) that 
+    /** SARFFTCorrelationGridImageFilter needs input requested regions (for master and slave images) that 
      * corresponds to the projection into the requested region of the deformation grid (our output requested 
      * region).  
      * As such, SARQuadraticAveragingImageFilter needs to provide an implementation for 
@@ -198,7 +199,7 @@ namespace otb
      */
     void OutputRegionToInputRegion(const ImageOutRegionType& outputRegion) const;
 
-    /** SARCorrelationGridImageFilter can be implemented as a multithreaded filter.
+    /** SARFFTCorrelationGridImageFilter can be implemented as a multithreaded filter.
      * Therefore, this implementation provides a ThreadedGenerateData() routine
      * which is called for each processing thread. The output image data is
      * allocated automatically by the superclass prior to calling
@@ -218,7 +219,7 @@ namespace otb
 
 
   private:
-    SARCorrelationGridImageFilter(const Self&); // purposely not implemented
+    SARFFTCorrelationGridImageFilter(const Self&); // purposely not implemented
     void operator=(const Self &); // purposely not 
     
     /** Coarse correlation threshold */
@@ -268,7 +269,7 @@ namespace otb
 } // End namespace otb
 
 #ifndef OTB_MANUAL_INSTANTIATION
-#include "otbSARCorrelationGridImageFilter.txx"
+#include "otbSARFFTCorrelationGridImageFilter.txx"
 #endif
 
 
diff --git a/include/otbSARCorrelationGridImageFilter.txx b/include/otbSARFFTCorrelationGridImageFilter.txx
similarity index 96%
rename from include/otbSARCorrelationGridImageFilter.txx
rename to include/otbSARFFTCorrelationGridImageFilter.txx
index 9ec289c..9b064c1 100644
--- a/include/otbSARCorrelationGridImageFilter.txx
+++ b/include/otbSARFFTCorrelationGridImageFilter.txx
@@ -18,10 +18,10 @@
  * limitations under the License.
  */
 
-#ifndef otbSARCorrelationGridImageFilter_txx
-#define otbSARCorrelationGridImageFilter_txx
+#ifndef otbSARFFTCorrelationGridImageFilter_txx
+#define otbSARFFTCorrelationGridImageFilter_txx
 
-#include "otbSARCorrelationGridImageFilter.h"
+#include "otbSARFFTCorrelationGridImageFilter.h"
 
 #include "itkImageScanlineConstIterator.h"
 #include "itkImageRegionIterator.h"
@@ -45,7 +45,7 @@ namespace otb
    * Constructor with default initialization
    */
   template <class TImageIn, class TImageOut> 
-  SARCorrelationGridImageFilter< TImageIn ,TImageOut >::SARCorrelationGridImageFilter()
+  SARFFTCorrelationGridImageFilter< TImageIn ,TImageOut >::SARFFTCorrelationGridImageFilter()
   {
     this->SetNumberOfRequiredInputs(2);
  
@@ -70,7 +70,7 @@ namespace otb
    */ 
   template <class TImageIn, class TImageOut> 
   void
-  SARCorrelationGridImageFilter< TImageIn ,TImageOut >
+  SARFFTCorrelationGridImageFilter< TImageIn ,TImageOut >
   ::SetMasterInput(const ImageInType* image )
   {
     // Process object is not const-correct so the const casting is required.
@@ -82,7 +82,7 @@ namespace otb
    */ 
   template <class TImageIn, class TImageOut> 
   void
-  SARCorrelationGridImageFilter< TImageIn ,TImageOut >
+  SARFFTCorrelationGridImageFilter< TImageIn ,TImageOut >
   ::SetSlaveInput(const ImageInType* image)
   {
     // Process object is not const-correct so the const casting is required.
@@ -93,8 +93,8 @@ namespace otb
    * Get Master Image
    */ 
   template <class TImageIn, class TImageOut> 
-  const typename SARCorrelationGridImageFilter< TImageIn ,TImageOut>::ImageInType *
-  SARCorrelationGridImageFilter< TImageIn ,TImageOut >
+  const typename SARFFTCorrelationGridImageFilter< TImageIn ,TImageOut>::ImageInType *
+  SARFFTCorrelationGridImageFilter< TImageIn ,TImageOut >
   ::GetMasterInput() const
   {
     if (this->GetNumberOfInputs()<1)
@@ -108,8 +108,8 @@ namespace otb
    * Get Slave Image
    */ 
   template <class TImageIn, class TImageOut> 
-  const typename SARCorrelationGridImageFilter< TImageIn ,TImageOut>::ImageInType *
-  SARCorrelationGridImageFilter< TImageIn ,TImageOut >
+  const typename SARFFTCorrelationGridImageFilter< TImageIn ,TImageOut>::ImageInType *
+  SARFFTCorrelationGridImageFilter< TImageIn ,TImageOut >
   ::GetSlaveInput() const
   {
     if (this->GetNumberOfInputs()<2)
@@ -124,7 +124,7 @@ namespace otb
    */
   template<class TImageIn, class TImageOut>
   void
-  SARCorrelationGridImageFilter< TImageIn, TImageOut >
+  SARFFTCorrelationGridImageFilter< TImageIn, TImageOut >
   ::PrintSelf(std::ostream & os, itk::Indent indent) const
   {
     Superclass::PrintSelf(os, indent);
@@ -140,7 +140,7 @@ namespace otb
    */
   template<class TImageIn, class TImageOut>
   void
-  SARCorrelationGridImageFilter< TImageIn, TImageOut >
+  SARFFTCorrelationGridImageFilter< TImageIn, TImageOut >
   ::activateDEM(const std::string DEMDirectory)
   {
     DEMHandlerPointerType DEMHandler = DEMHandler::Instance();
@@ -153,7 +153,7 @@ namespace otb
    **/
   template<class TImageIn, class TImageOut>
   void
-  SARCorrelationGridImageFilter< TImageIn, TImageOut >
+  SARFFTCorrelationGridImageFilter< TImageIn, TImageOut >
   ::GenerateOutputInformation()
   {    
     // Call superclass implementation
@@ -269,7 +269,7 @@ namespace otb
    */
   template<class TImageIn, class TImageOut>
   void
-  SARCorrelationGridImageFilter< TImageIn, TImageOut >
+  SARFFTCorrelationGridImageFilter< TImageIn, TImageOut >
   ::OutputRegionToInputRegion(const ImageOutRegionType& outputRegion) const
   {
     // Get pointers to inputs
@@ -400,7 +400,7 @@ namespace otb
    */
   template<class TImageIn, class TImageOut>
   void
-  SARCorrelationGridImageFilter< TImageIn, TImageOut >
+  SARFFTCorrelationGridImageFilter< TImageIn, TImageOut >
   ::GenerateInputRequestedRegion()
   {
     // Call the superclass' implementation of this method
@@ -416,7 +416,7 @@ namespace otb
    */
   template<class TImageIn, class TImageOut>
   void
-  SARCorrelationGridImageFilter< TImageIn, TImageOut >
+  SARFFTCorrelationGridImageFilter< TImageIn, TImageOut >
   ::BeforeThreadedGenerateData()
   { 
     // Get the number of threads
@@ -519,7 +519,7 @@ namespace otb
    */
   template<class TImageIn, class TImageOut>
   void
-  SARCorrelationGridImageFilter< TImageIn, TImageOut >
+  SARFFTCorrelationGridImageFilter< TImageIn, TImageOut >
   ::AfterThreadedGenerateData()
   {
    // Get the number of threads
@@ -559,7 +559,7 @@ namespace otb
    */
   template<class TImageIn, class TImageOut>
   void
-  SARCorrelationGridImageFilter< TImageIn, TImageOut >
+  SARFFTCorrelationGridImageFilter< TImageIn, TImageOut >
   ::ThreadedGenerateData(const ImageOutRegionType& outputRegionForThread,
 			 itk::ThreadIdType threadId)
   {
diff --git a/python_src/diapOTB.py b/python_src/diapOTB.py
index f0aab9d..e59c71d 100644
--- a/python_src/diapOTB.py
+++ b/python_src/diapOTB.py
@@ -301,8 +301,6 @@ if __name__ == "__main__":
         appCorGrid.SetParameterInt("mlazi",ml_correlSimu_azimut)
         appCorGrid.SetParameterInt("gridsteprange", correlSimu_gridstep_range)
         appCorGrid.SetParameterInt("gridstepazimut", correlSimu_gridstep_azimut)
-        appCorGrid.SetParameterInt("patchsize", 20)
-        appCorGrid.SetParameterInt("subpixel", 10)
         appCorGrid.SetParameterString("ram", "4000")
         #appCorGrid.Execute()
         appCorGrid.ExecuteAndWriteOutput()
@@ -366,8 +364,6 @@ if __name__ == "__main__":
     appFineDeformationGrid.SetParameterInt("mlazi", ml_geoGrid_azimut)
     appFineDeformationGrid.SetParameterInt("gridsteprange", geoGrid_gridstep_range)
     appFineDeformationGrid.SetParameterInt("gridstepazimut", geoGrid_gridstep_azimut)
-    appFineDeformationGrid.SetParameterInt("patchsize", 20)
-    appFineDeformationGrid.SetParameterInt("subpixel", 10)
     appFineDeformationGrid.SetParameterFloat("threshold", geoGrid_threshold)
     appFineDeformationGrid.SetParameterFloat("gap", geoGrid_gap)
     appFineDeformationGrid.SetParameterString("out", os.path.join(output_dir, fine_grid))
diff --git a/python_src/diapOTB_S1IW.py b/python_src/diapOTB_S1IW.py
index 2dee6f1..7639b60 100644
--- a/python_src/diapOTB_S1IW.py
+++ b/python_src/diapOTB_S1IW.py
@@ -449,8 +449,6 @@ if __name__ == "__main__":
         appFineDeformationGrid.SetParameterInt("mlazi", ml_geoGrid_azimut)
         appFineDeformationGrid.SetParameterInt("gridsteprange", geoGrid_gridstep_range)
         appFineDeformationGrid.SetParameterInt("gridstepazimut", geoGrid_gridstep_azimut)
-        appFineDeformationGrid.SetParameterInt("patchsize", 20)
-        appFineDeformationGrid.SetParameterInt("subpixel", 10)
         appFineDeformationGrid.SetParameterFloat("threshold", geoGrid_threshold)
         appFineDeformationGrid.SetParameterFloat("gap", geoGrid_gap)
         appFineDeformationGrid.SetParameterString("out", os.path.join(burst_dir, fine_grid))
-- 
GitLab