From f39d57d3f81d695a5145220c2a1208ae36260d6c Mon Sep 17 00:00:00 2001
From: Otmane Lahlou <otmane.lahlou@c-s.fr>
Date: Wed, 15 Sep 2010 18:17:18 +0200
Subject: [PATCH] ENH : force user to set spacing in the method used to set
 automatically the output parameters

---
 Code/Projections/otbGenericRSResampleImageFilter.h           | 2 +-
 Code/Projections/otbGenericRSResampleImageFilter.txx         | 3 ++-
 Testing/Code/Projections/otbGenericRSResampleImageFilter.cxx | 3 +--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Code/Projections/otbGenericRSResampleImageFilter.h b/Code/Projections/otbGenericRSResampleImageFilter.h
index 8e030bfbc1..2063f98153 100644
--- a/Code/Projections/otbGenericRSResampleImageFilter.h
+++ b/Code/Projections/otbGenericRSResampleImageFilter.h
@@ -219,7 +219,7 @@ public:
   void SetOutputParametersFromImage(const ImageBaseType * image);
 
   /** Useful to set the output parameters from an existing image*/
-  void SetOutputParametersFromMap(const std::string map);
+  void SetOutputParametersFromMap(const std::string map, const SpacingType& spacing);
   
   /** Set/Get the grid size for rpc estimator*/
   void SetInputRpcGridSize(const SizeType& gridSize)
diff --git a/Code/Projections/otbGenericRSResampleImageFilter.txx b/Code/Projections/otbGenericRSResampleImageFilter.txx
index 1f983440ce..589a2e0f67 100644
--- a/Code/Projections/otbGenericRSResampleImageFilter.txx
+++ b/Code/Projections/otbGenericRSResampleImageFilter.txx
@@ -241,7 +241,7 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage>
 template <class TInputImage, class TOutputImage>
 void
 GenericRSResampleImageFilter<TInputImage, TOutputImage>
-::SetOutputParametersFromMap(const std::string map)
+::SetOutputParametersFromMap(const std::string map, const SpacingType& spacing)
 {
   // Get the input Image
   const InputImageType* input = this->GetInput();
@@ -291,6 +291,7 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage>
     
   // Update the transform
   this->SetOutputProjectionRef(utmRef);
+  this->SetOutputSpacing(spacing);
   this->UpdateTransform();
 
   // Get the inverse transform again : used later
diff --git a/Testing/Code/Projections/otbGenericRSResampleImageFilter.cxx b/Testing/Code/Projections/otbGenericRSResampleImageFilter.cxx
index 572d9ade99..d18c3ee225 100644
--- a/Testing/Code/Projections/otbGenericRSResampleImageFilter.cxx
+++ b/Testing/Code/Projections/otbGenericRSResampleImageFilter.cxx
@@ -186,8 +186,7 @@ int otbGenericRSResampleImageFilterFromMap(int argc, char* argv[])
   // Set the Resampler Parameters
   resampler->SetInput(extractor->GetOutput());
   resampler->SetDeformationFieldSpacing(gridSpacing); 
-  resampler->SetOutputSpacing(spacing);
-  resampler->SetOutputParametersFromMap("UTM");
+  resampler->SetOutputParametersFromMap("UTM",spacing);
   
   if (useInRpc)
     {
-- 
GitLab