From 27dcf550532d8e87dfdaab8708aa541da10d293c Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@c-s.fr>
Date: Tue, 10 Apr 2007 09:32:22 +0000
Subject: [PATCH] =?UTF-8?q?Ajout=20de=20l'estimation=20de=20la=20d=C3=A9fo?=
 =?UTF-8?q?rmation=20par=20plus=20proche=20transformation=20locale.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ...earestTransformDeformationFieldGenerator.h |  81 +++++++++++
 ...restTransformDeformationFieldGenerator.txx |  79 ++++++++++
 ...WithTransformToDeformationFieldGenerator.h |  98 +++++++++++++
 ...thTransformToDeformationFieldGenerator.txx |  47 ++++++
 Testing/Code/DisparityMap/CMakeLists.txt      |  24 +++-
 .../DisparityMap/otbDisparityMapTests.cxx     |   3 +
 ...restTransformDeformationFieldGenerator.cxx | 135 ++++++++++++++++++
 ...tTransformDeformationFieldGeneratorNew.cxx |  51 +++++++
 ...ransformToDeformationFieldGeneratorNew.cxx |  51 +++++++
 9 files changed, 568 insertions(+), 1 deletion(-)
 create mode 100644 Code/DisparityMap/otbNearestTransformDeformationFieldGenerator.h
 create mode 100644 Code/DisparityMap/otbNearestTransformDeformationFieldGenerator.txx
 create mode 100644 Code/DisparityMap/otbPointSetWithTransformToDeformationFieldGenerator.h
 create mode 100644 Code/DisparityMap/otbPointSetWithTransformToDeformationFieldGenerator.txx
 create mode 100644 Testing/Code/DisparityMap/otbNearestTransformDeformationFieldGenerator.cxx
 create mode 100644 Testing/Code/DisparityMap/otbNearestTransformDeformationFieldGeneratorNew.cxx
 create mode 100644 Testing/Code/DisparityMap/otbPointSetWithTransformToDeformationFieldGeneratorNew.cxx

diff --git a/Code/DisparityMap/otbNearestTransformDeformationFieldGenerator.h b/Code/DisparityMap/otbNearestTransformDeformationFieldGenerator.h
new file mode 100644
index 0000000000..6ccaefc713
--- /dev/null
+++ b/Code/DisparityMap/otbNearestTransformDeformationFieldGenerator.h
@@ -0,0 +1,81 @@
+/*=========================================================================
+
+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 _otbNearestTransformDeformationFieldGenerator_h
+#define _otbNearestTransformDeformationFieldGenerator_h
+
+#include "otbPointSetWithTransformToDeformationFieldGenerator.h"
+
+namespace otb
+{
+/** \class NearestTransformDeformationFieldGenerator
+ *  \brief This class implements deformation field generation by taking into account the local transform of the
+ *  nearest point in pointset.
+ * 
+ * \ingroup 
+ * \ingroup
+ */
+template <class TPointSet, class TDeformationField>
+class ITK_EXPORT NearestTransformDeformationFieldGenerator
+  : public PointSetWithTransformToDeformationFieldGenerator<TPointSet, TDeformationField>
+{
+ public:
+  /** Standard typedefs */
+  typedef NearestTransformDeformationFieldGenerator Self;
+  typedef PointSetWithTransformToDeformationFieldGenerator<TPointSet,TDeformationField> Superclass;
+  typedef itk::SmartPointer<Self>        Pointer;
+  typedef itk::SmartPointer<const Self>  ConstPointer;
+  
+  /** Type macro */
+  itkNewMacro(Self);
+  
+  /** Creation through object factory macro */
+  itkTypeMacro(NearestTransformDeformationFieldGenerator,PointSetWithTransformToDeformationFieldGenerator);
+  
+  /** Template parameters typedefs */
+  typedef typename Superclass::PointSetType PointSetType;
+  typedef typename Superclass::PointSetPointerType PointSetPointerType;
+  typedef typename Superclass::DeformationFieldType DeformationFieldType;
+  typedef typename Superclass::DeformationFieldPointerType DeformationFieldPointerType;
+  typedef typename Superclass::IndexType IndexType;
+  typedef typename Superclass::PointType PointType;
+  typedef typename DeformationFieldType::PixelType PixelType;
+  typedef typename Superclass::ValueType ValueType;
+  typedef typename Superclass::IndexVectorType IndexVectorType;
+  typedef typename Superclass::TransformType TransformType;
+  typedef typename TransformType::ParametersType ParametersType;
+
+protected:
+  /** Constructor */
+  NearestTransformDeformationFieldGenerator() {};
+  /** Destructor */
+  virtual ~NearestTransformDeformationFieldGenerator() {};
+ /**PrintSelf method */
+  virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
+  /** Main computation method */
+  virtual void GenerateData();
+
+private:
+  NearestTransformDeformationFieldGenerator(const Self&); //purposely not implemented
+  void operator=(const Self&); //purposely not implemented
+};
+}// End namespace otb
+#ifndef OTB_MANUAL_INSTANTIATION
+#include "otbNearestTransformDeformationFieldGenerator.txx"
+#endif
+
+#endif
diff --git a/Code/DisparityMap/otbNearestTransformDeformationFieldGenerator.txx b/Code/DisparityMap/otbNearestTransformDeformationFieldGenerator.txx
new file mode 100644
index 0000000000..d48353e75c
--- /dev/null
+++ b/Code/DisparityMap/otbNearestTransformDeformationFieldGenerator.txx
@@ -0,0 +1,79 @@
+/*=========================================================================
+
+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 _otbNearestTransformDeformationFieldGenerator_txx
+#define _otbNearestTransformDeformationFieldGenerator_txx
+
+#include "otbNearestTransformDeformationFieldGenerator.h"
+#include "itkImageRegionIteratorWithIndex.h"
+#include "otbMacro.h"
+
+namespace otb
+{
+/** Main computation method */
+template <class TPointSet,class TDeformationField>
+void
+NearestTransformDeformationFieldGenerator<TPointSet, TDeformationField>
+::GenerateData(void)
+{
+  DeformationFieldPointerType outputPtr = this->GetOutput();
+  PixelType defaultValue(2);
+  defaultValue.Fill(this->GetDefaultValue());
+  outputPtr->Allocate();
+  outputPtr->FillBuffer(defaultValue);
+
+  typedef itk::ImageRegionIteratorWithIndex<DeformationFieldType> IteratorType;
+  IteratorType it(outputPtr,outputPtr->GetRequestedRegion());
+  
+  for(it.GoToBegin();!it.IsAtEnd();++it)
+    {
+       IndexVectorType indexVector = this->GenerateNearestValidPointsPointSet(it.GetIndex(),1);
+       PixelType pixel(2);
+       if(indexVector.size()>=1)
+ 	{
+	  ParametersType params(this->GetTransform()->GetNumberOfParameters());
+	  for(unsigned int  i = 0; i<this->GetTransform()->GetNumberOfParameters();++i)
+	    {
+	      params[i] = this->GetPointSet()->GetPointData()->GetElement(indexVector[0])[i+3];
+	    }
+	  this->GetTransform()->SetParameters(params);
+	  PointType sourcePoint,targetPoint;
+	  
+	  outputPtr->TransformIndexToPhysicalPoint(it.GetIndex(),sourcePoint);
+	  targetPoint = this->GetTransform()->TransformPoint(sourcePoint);
+ 	  pixel[0] = static_cast<ValueType>(targetPoint[0]-sourcePoint[0]);
+ 	  pixel[1] = static_cast<ValueType>(targetPoint[1]-sourcePoint[1]);
+ 	}
+       else
+ 	{
+	  pixel=defaultValue;
+ 	}
+      it.Set(pixel);
+    }
+}
+/**
+ * PrintSelf Method
+ */
+template <class TPointSet,class TDeformationField>
+void
+NearestTransformDeformationFieldGenerator<TPointSet, TDeformationField>
+::PrintSelf(std::ostream& os, itk::Indent indent) const
+{
+  Superclass::PrintSelf(os, indent);
+}
+} // End namespace otb
+#endif
diff --git a/Code/DisparityMap/otbPointSetWithTransformToDeformationFieldGenerator.h b/Code/DisparityMap/otbPointSetWithTransformToDeformationFieldGenerator.h
new file mode 100644
index 0000000000..6126e56079
--- /dev/null
+++ b/Code/DisparityMap/otbPointSetWithTransformToDeformationFieldGenerator.h
@@ -0,0 +1,98 @@
+/*=========================================================================
+
+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 _otbPointSetWithTransformToDeformationFieldGenerator_h
+#define _otbPointSetWithTransformToDeformationFieldGenerator_h
+
+#include "otbPointSetToDeformationFieldGenerator.h"
+#include "itkTransform.h"
+
+namespace otb
+{
+/** \class PointSetWithTransformToDeformationFieldGenerator
+ *  \brief Base class for filters generating a deformation field from a point set enriched with local transform information.
+ *  The output of the filters deriving from this base class can be passed to the itk::WarpImageFilter for image resampling.
+ *  \sa DisparityMapEstimationMethod
+ *   \sa itk::WarpImageFilter
+ *  \ingroup 
+ */
+template <class TPointSet, class TDeformationField>
+class ITK_EXPORT PointSetWithTransformToDeformationFieldGenerator
+  : public PointSetToDeformationFieldGenerator<TPointSet,TDeformationField>
+{
+ public:
+  /** Standard typedefs */
+  typedef PointSetWithTransformToDeformationFieldGenerator Self;
+  typedef PointSetToDeformationFieldGenerator<TPointSet,TDeformationField> Superclass;
+  typedef itk::SmartPointer<Self>             Pointer;
+  typedef itk::SmartPointer<const Self>       ConstPointer;
+  
+  /** Type macro */
+  itkNewMacro(Self);
+  
+  /** Creation through object factory macro */
+  itkTypeMacro(PointSetWithTransformToDeformationFieldGenerator,PointSetToDeformationFieldGenerator);
+  
+  /** Template parameters typedefs */
+  typedef TPointSet PointSetType;
+  typedef typename PointSetType::Pointer PointSetPointerType;
+
+  typedef TDeformationField DeformationFieldType;
+  typedef typename DeformationFieldType::Pointer DeformationFieldPointerType;
+  typedef typename DeformationFieldType::IndexType IndexType;
+  typedef typename DeformationFieldType::SizeType SizeType;
+  typedef typename DeformationFieldType::SpacingType SpacingType;
+  typedef typename DeformationFieldType::PointType PointType;
+  typedef typename DeformationFieldType::ValueType ValueType;
+
+  /** More typedefs */
+  typedef typename Superclass::DistanceVectorType DistanceVectorType;
+  typedef typename Superclass::IndexVectorType IndexVectorType;
+
+  /** Transform typedefs */
+  typedef itk::Transform<double,2,2> TransformType;
+  typedef typename TransformType::Pointer TransformPointerType;
+  typedef typename TransformType::ParametersType ParametersType;
+
+  /** Set/Get the Transfrom. */
+  itkSetObjectMacro(Transform,TransformType);
+  itkGetObjectMacro(Transform,TransformType);
+  
+protected:
+  /** Constructor */
+  PointSetWithTransformToDeformationFieldGenerator();
+  /** Destructor */
+  virtual ~PointSetWithTransformToDeformationFieldGenerator() {};
+ /**PrintSelf method */
+  virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
+
+private:
+  PointSetWithTransformToDeformationFieldGenerator(const Self&); //purposely not implemented
+  void operator=(const Self&); //purposely not implemented
+
+  /**
+   * The transform used for local registration.
+   */
+  TransformPointerType m_Transform;
+  
+};
+}// End namespace otb
+#ifndef OTB_MANUAL_INSTANTIATION
+#include "otbPointSetWithTransformToDeformationFieldGenerator.txx"
+#endif
+
+#endif
diff --git a/Code/DisparityMap/otbPointSetWithTransformToDeformationFieldGenerator.txx b/Code/DisparityMap/otbPointSetWithTransformToDeformationFieldGenerator.txx
new file mode 100644
index 0000000000..1662f97a8e
--- /dev/null
+++ b/Code/DisparityMap/otbPointSetWithTransformToDeformationFieldGenerator.txx
@@ -0,0 +1,47 @@
+/*=========================================================================
+
+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 _otbPointSetWithTransformToDeformationFieldGenerator_txx
+#define _otbPointSetWithTransformToDeformationFieldGenerator_txx
+
+#include "otbPointSetWithTransformToDeformationFieldGenerator.h"
+
+#include "otbMacro.h"
+
+namespace otb
+{
+/**
+ * Constructor
+ */
+template <class TPointSet, class TDeformationField>
+PointSetWithTransformToDeformationFieldGenerator<TPointSet, TDeformationField>
+::PointSetWithTransformToDeformationFieldGenerator()
+{
+ m_Transform = 0;    // has to be provided by the user
+}
+/**
+ * PrintSelf Method
+ */
+template <class TPointSet, class TDeformationField>
+void
+PointSetWithTransformToDeformationFieldGenerator<TPointSet, TDeformationField>
+::PrintSelf(std::ostream& os, itk::Indent indent) const
+{
+  Superclass::PrintSelf(os, indent);
+}
+} // End namespace otb
+#endif
diff --git a/Testing/Code/DisparityMap/CMakeLists.txt b/Testing/Code/DisparityMap/CMakeLists.txt
index 6103a95bc0..7891d13b5a 100644
--- a/Testing/Code/DisparityMap/CMakeLists.txt
+++ b/Testing/Code/DisparityMap/CMakeLists.txt
@@ -77,6 +77,26 @@ ADD_TEST(dmTvBSplinesInterpolateDeformationFieldGenerator ${DISPARITYMAP_TESTS}
 	 ${TEMP}/dmTvBSplinesInterpolateDeformationField.hdr
 )
 
+
+# -------            otb::PointSetToDeformationFieldGenerator   ----------
+
+ADD_TEST(dmTuPointSetWithTransformToDeformationFieldGeneratorNew ${DISPARITYMAP_TESTS} 
+	 otbPointSetWithTransformToDeformationFieldGeneratorNew)
+
+
+# -------            otb::NearestPointDeformationFieldGenerator   ----------
+
+ADD_TEST(dmTuNearestTransformDeformationFieldGeneratorNew ${DISPARITYMAP_TESTS} 
+	 otbNearestTransformDeformationFieldGeneratorNew)
+
+ADD_TEST(dmTvNearestTransformDeformationFieldGenerator ${DISPARITYMAP_TESTS} 
+              --compare-image ${TOL}
+		${BASELINE}/dmTvNearestTransformDeformationField.hdr
+		${TEMP}/dmTvNearestTransformDeformationField.hdr	
+	 otbNearestTransformDeformationFieldGenerator
+	 ${TEMP}/dmTvNearestTransformDeformationField.hdr
+)
+
 # -------       Fichiers sources CXX -----------------------------------
 SET(BasicDisparityMap_SRCS
 otbDisparityMapEstimationMethodNew.cxx
@@ -88,7 +108,9 @@ otbNNearestPointsLinearInterpolateDeformationFieldGeneratorNew.cxx
 otbNNearestPointsLinearInterpolateDeformationFieldGenerator.cxx
 otbBSplinesInterpolateDeformationFieldGeneratorNew.cxx
 otbBSplinesInterpolateDeformationFieldGenerator.cxx
-
+otbPointSetWithTransformToDeformationFieldGeneratorNew.cxx
+otbNearestTransformDeformationFieldGeneratorNew.cxx
+otbNearestTransformDeformationFieldGenerator.cxx
 )
 
 INCLUDE_DIRECTORIES("${OTBTesting_BINARY_DIR}")
diff --git a/Testing/Code/DisparityMap/otbDisparityMapTests.cxx b/Testing/Code/DisparityMap/otbDisparityMapTests.cxx
index 308d0fad3c..5dc0cf155f 100644
--- a/Testing/Code/DisparityMap/otbDisparityMapTests.cxx
+++ b/Testing/Code/DisparityMap/otbDisparityMapTests.cxx
@@ -35,4 +35,7 @@ REGISTER_TEST(otbNNearestPointsLinearInterpolateDeformationFieldGeneratorNew);
 REGISTER_TEST(otbNNearestPointsLinearInterpolateDeformationFieldGenerator);
 REGISTER_TEST(otbBSplinesInterpolateDeformationFieldGeneratorNew);
 REGISTER_TEST(otbBSplinesInterpolateDeformationFieldGenerator);
+REGISTER_TEST(otbPointSetWithTransformToDeformationFieldGeneratorNew);
+REGISTER_TEST(otbNearestTransformDeformationFieldGeneratorNew);
+REGISTER_TEST(otbNearestTransformDeformationFieldGenerator);
 }
diff --git a/Testing/Code/DisparityMap/otbNearestTransformDeformationFieldGenerator.cxx b/Testing/Code/DisparityMap/otbNearestTransformDeformationFieldGenerator.cxx
new file mode 100644
index 0000000000..a8e63c4276
--- /dev/null
+++ b/Testing/Code/DisparityMap/otbNearestTransformDeformationFieldGenerator.cxx
@@ -0,0 +1,135 @@
+/*=========================================================================
+
+  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.
+
+=========================================================================*/
+#include "itkExceptionObject.h"
+#include "itkPointSet.h"
+#include "otbVectorImage.h"
+#include "otbNearestTransformDeformationFieldGenerator.h"
+#include "otbImageFileWriter.h"
+#include "itkEuler2DTransform.h"
+
+int otbNearestTransformDeformationFieldGenerator(int argc, char * argv[])
+{
+  try
+    {
+      const unsigned int Dimension = 2;
+      const char * outfname = argv[1];
+      typedef double PixelType;
+      typedef otb::VectorImage<PixelType,Dimension> ImageType;
+      typedef itk::Array<double> ParamType;
+      typedef itk::PointSet<ParamType,Dimension> PointSetType;
+      typedef PointSetType::PointType PointType;
+      typedef otb::NearestTransformDeformationFieldGenerator<PointSetType,ImageType> FilterType;
+      typedef otb::ImageFileWriter<ImageType> WriterType;
+      typedef itk::Euler2DTransform<double> TransformType;      
+
+      ImageType::SizeType size;
+      size.Fill(100);
+      double thresh = 0.9;
+
+      // Preparing point set
+      PointSetType::Pointer  ps = PointSetType::New();
+      PointType p1,p2,p3,p4,p5;
+      ParamType pd1(6),pd2(6),pd3(6),pd4(6),pd5(6);
+      itk::Point<double,2> center;
+
+      p1[0] = 10;
+      p1[1] = 10;
+      p2[0] = 75;
+      p2[1] = 10;
+      p3[0] = 50;
+      p3[1] = 50;
+      p4[0] = 10;
+      p4[1] = 60;
+      p5[0] = 85;
+      p5[1] = 70;
+      center.Fill(0);
+      
+      pd1[0] = 0.95;
+      pd1[1] = 0;
+      pd1[2] = 0;
+      pd1[3] = 5;
+      pd1[4] = 5; 
+      pd1[5] = 0.1769;
+      pd2[0] = 0.98;
+      pd2[1] = 0;
+      pd2[2] = 0;
+      pd2[3] = -5;
+      pd2[4] = 5; 
+      pd2[5] = -0.1769;
+      pd3[0] = 0.5;
+      pd3[1] = 0;
+      pd3[2] = 0;
+      pd3[3] = 0;
+      pd3[4] = 0; 
+      pd3[5] = 0;
+      pd4[0] = 0.91;
+      pd4[1] = 0;
+      pd4[2] = 0;
+      pd4[3] = 5;
+      pd4[4] = -5; 
+      pd4[5] = 0.1769;
+      pd5[0] = 0.91;
+      pd5[1] = 0;
+      pd5[2] = 0;
+      pd5[3] = -5;
+      pd5[4] = -5; 
+      pd5[5] = -0.1769;
+
+      ps->SetPoint(0,p1);
+      ps->SetPointData(0,pd1);
+      ps->SetPoint(1,p2);
+      ps->SetPointData(1,pd2);
+      ps->SetPoint(2,p3);
+      ps->SetPointData(2,pd3);
+      ps->SetPoint(3,p4);
+      ps->SetPointData(3,pd4);
+      ps->SetPoint(4,p5);
+      ps->SetPointData(4,pd5);
+
+
+      TransformType::Pointer transform = TransformType::New();
+      transform->SetCenter(center);
+      
+
+      // Instantiating object
+      FilterType::Pointer filter = FilterType::New();
+      filter->SetOutputSize(size);
+      filter->SetMetricThreshold(thresh);
+      filter->SetPointSet(ps);
+      filter->SetTransform(transform);
+
+      WriterType::Pointer writer = WriterType::New();
+      writer->SetInput(filter->GetOutput());
+      writer->SetFileName(outfname);
+      writer->Update();
+    }
+
+  catch( itk::ExceptionObject & err ) 
+    { 
+    std::cout << "Exception itk::ExceptionObject thrown !" << std::endl; 
+    std::cout << err << std::endl; 
+    return EXIT_FAILURE;
+    } 
+
+  catch( ... ) 
+    { 
+    std::cout << "Unknown exception thrown !" << std::endl; 
+    return EXIT_FAILURE;
+    } 
+  return EXIT_SUCCESS;
+}
diff --git a/Testing/Code/DisparityMap/otbNearestTransformDeformationFieldGeneratorNew.cxx b/Testing/Code/DisparityMap/otbNearestTransformDeformationFieldGeneratorNew.cxx
new file mode 100644
index 0000000000..ffd6f40393
--- /dev/null
+++ b/Testing/Code/DisparityMap/otbNearestTransformDeformationFieldGeneratorNew.cxx
@@ -0,0 +1,51 @@
+/*=========================================================================
+
+  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.
+
+=========================================================================*/
+#include "itkExceptionObject.h"
+#include "itkPointSet.h"
+#include "otbVectorImage.h"
+#include "otbNearestTransformDeformationFieldGenerator.h"
+
+int otbNearestTransformDeformationFieldGeneratorNew(int argc, char * argv[])
+{
+  try
+    {
+      const unsigned int Dimension = 2;
+      typedef double PixelType;
+      typedef otb::VectorImage<PixelType,Dimension> ImageType;
+      typedef ImageType::PointType PointType;
+      typedef itk::PointSet<PointType,Dimension> PointSetType;
+      typedef otb::NearestTransformDeformationFieldGenerator<PointSetType,ImageType> FilterType;
+
+      // Instantiating object
+      FilterType::Pointer filter = FilterType::New();
+    }
+
+  catch( itk::ExceptionObject & err ) 
+    { 
+    std::cout << "Exception itk::ExceptionObject thrown !" << std::endl; 
+    std::cout << err << std::endl; 
+    return EXIT_FAILURE;
+    } 
+
+  catch( ... ) 
+    { 
+    std::cout << "Unknown exception thrown !" << std::endl; 
+    return EXIT_FAILURE;
+    } 
+  return EXIT_SUCCESS;
+}
diff --git a/Testing/Code/DisparityMap/otbPointSetWithTransformToDeformationFieldGeneratorNew.cxx b/Testing/Code/DisparityMap/otbPointSetWithTransformToDeformationFieldGeneratorNew.cxx
new file mode 100644
index 0000000000..2b15d793c8
--- /dev/null
+++ b/Testing/Code/DisparityMap/otbPointSetWithTransformToDeformationFieldGeneratorNew.cxx
@@ -0,0 +1,51 @@
+/*=========================================================================
+
+  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.
+
+=========================================================================*/
+#include "itkExceptionObject.h"
+#include "itkPointSet.h"
+#include "otbVectorImage.h"
+#include "otbPointSetWithTransformToDeformationFieldGenerator.h"
+
+int otbPointSetWithTransformToDeformationFieldGeneratorNew(int argc, char * argv[])
+{
+  try
+    {
+      const unsigned int Dimension = 2;
+      typedef double PixelType;
+      typedef otb::VectorImage<PixelType,Dimension> ImageType;
+      typedef ImageType::PointType PointType;
+      typedef itk::PointSet<PointType,Dimension> PointSetType;
+      typedef otb::PointSetWithTransformToDeformationFieldGenerator<PointSetType,ImageType> FilterType;
+
+      // Instantiating object
+      FilterType::Pointer filter = FilterType::New();
+    }
+
+  catch( itk::ExceptionObject & err ) 
+    { 
+    std::cout << "Exception itk::ExceptionObject thrown !" << std::endl; 
+    std::cout << err << std::endl; 
+    return EXIT_FAILURE;
+    } 
+
+  catch( ... ) 
+    { 
+    std::cout << "Unknown exception thrown !" << std::endl; 
+    return EXIT_FAILURE;
+    } 
+  return EXIT_SUCCESS;
+}
-- 
GitLab