From 89d500250963c3b1f5c9ff8f3bb87d54642617a2 Mon Sep 17 00:00:00 2001
From: Otmane Lahlou <otmane.lahlou@c-s.fr>
Date: Thu, 9 Sep 2010 15:44:36 +0200
Subject: [PATCH] ENH : add option to use rpc estimation in the test

---
 Testing/Code/Projections/CMakeLists.txt                |  1 +
 .../Projections/otbGenericRSResampleImageFilter.cxx    | 10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/Testing/Code/Projections/CMakeLists.txt b/Testing/Code/Projections/CMakeLists.txt
index cd9f63456e..8383145fc7 100644
--- a/Testing/Code/Projections/CMakeLists.txt
+++ b/Testing/Code/Projections/CMakeLists.txt
@@ -620,6 +620,7 @@ ADD_TEST(prTvotbGenericRSResampleImageFilter ${PROJECTIONS_TESTS4}
   ${LARGEINPUT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF
   1000
   15
+  0
   ${TEMP}/prTvotbGenericRSResampleImageFilterOutput.tif
   )
 ENDIF(OTB_DATA_USE_LARGEINPUT)
diff --git a/Testing/Code/Projections/otbGenericRSResampleImageFilter.cxx b/Testing/Code/Projections/otbGenericRSResampleImageFilter.cxx
index 47956e0cb2..3008cbba84 100644
--- a/Testing/Code/Projections/otbGenericRSResampleImageFilter.cxx
+++ b/Testing/Code/Projections/otbGenericRSResampleImageFilter.cxx
@@ -29,9 +29,10 @@
 int otbGenericRSResampleImageFilter(int argc, char* argv[])
 {
   const char * infname = argv[1];
-  const char * outfname = argv[4];
+  const char * outfname = argv[5];
   unsigned int isize    = atoi(argv[2]);
   double iGridSpacing    = atof(argv[3]);
+  int    useRpc          = atoi(argv[4]);
   
   // Images definition
   const unsigned int Dimension = 2;
@@ -89,13 +90,16 @@ int otbGenericRSResampleImageFilter(int argc, char* argv[])
   resampler->SetOutputProjectionRef(utmRef);
   resampler->SetInputProjectionRef(reader->GetOutput()->GetProjectionRef());
   resampler->SetInputKeywordList(reader->GetOutput()->GetImageKeywordlist());
-  
+  if (useRpc)
+    {
+    resampler->SetGridSpacing(1000);
+    resampler->EstimateInputRpcModelOn();
+    }
   
   // Write the resampled image
   typedef otb::StreamingImageFileWriter<ImageType>    WriterType;
   WriterType::Pointer writer= WriterType::New();
   writer->SetTilingStreamDivisions(4);
-  writer->WriteGeomFileOn();
   writer->SetFileName(outfname);
   writer->SetInput(resampler->GetOutput());
   writer->Update();
-- 
GitLab