From 84e1bc20a4232f50e3e1c8a7737c180994309625 Mon Sep 17 00:00:00 2001
From: Otmane Lahlou <otmane.lahlou@c-s.fr>
Date: Wed, 14 Sep 2011 19:54:36 +0200
Subject: [PATCH] ENH : initialize the object (internal process) when a
 parameter is updated

---
 Applications/Util/otbRescale.cxx | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/Applications/Util/otbRescale.cxx b/Applications/Util/otbRescale.cxx
index 9fb55e999a..b2a7679e0b 100644
--- a/Applications/Util/otbRescale.cxx
+++ b/Applications/Util/otbRescale.cxx
@@ -75,15 +75,21 @@ private:
 
   void DoUpdateParameters()
   {
-    // Nothing to do here : all parameters are independent
+    // Nothing to do here for the parameters : all are independent
+    
+    // Reinitialize the object
+    m_RescaleFilter = RescaleImageFilterType::New();
+    m_MinMaxFilter = MinMaxFilterType::New();
+    this->ClearInternalProcessList();
+    this->AddInternalProcess( m_MinMaxFilter->GetStreamer(), "Min/Max computing" );
   }
 
   void DoExecute()
-  { 
+  {
     FloatVectorImageType::Pointer inImage = GetParameterImage("in");
-   
+
     m_MinMaxFilter->GetStreamer()->SetNumberOfLinesStrippedStreaming( 50 );
-   
+
     m_MinMaxFilter->SetInput( inImage );
     std::cout<<inImage->GetLargestPossibleRegion()<<std::endl;
     otb::StandardFilterWatcher watcher(m_MinMaxFilter, "Min Max Computation");
-- 
GitLab