From 778e6d6cf702f989aec06e02b99d0e9943835d5c Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@orfeo-toolbox.org>
Date: Thu, 21 Jan 2010 11:48:06 +0100
Subject: [PATCH] BUG: Trying to fix monteverdi bug 134 (seems to work)

---
 Code/Common/otbImageList.txx | 40 ++++++++++++++----------------------
 1 file changed, 15 insertions(+), 25 deletions(-)

diff --git a/Code/Common/otbImageList.txx b/Code/Common/otbImageList.txx
index c83357d594..ae031df8b7 100755
--- a/Code/Common/otbImageList.txx
+++ b/Code/Common/otbImageList.txx
@@ -37,7 +37,21 @@ ImageList<TImage>
     {
       if (it.Get()->GetSource())
       {
-        it.Get()->GetSource()->UpdateOutputData(it.Get());
+      it.Get()->GetSource()->PropagateRequestedRegion(it.Get());
+
+      // Check that the requested region lies within the largest possible region
+      if ( ! it.Get()->VerifyRequestedRegion() )
+	{
+	// invalid requested region, throw an exception
+	itk::InvalidRequestedRegionError e(__FILE__, __LINE__);
+	e.SetLocation(ITK_LOCATION);
+	e.SetDataObject(it.Get());
+	e.SetDescription("Requested region is (at least partially) outside the largest possible region.");
+	
+	throw e;
+	}
+
+      it.Get()->GetSource()->UpdateOutputData(it.Get());
       }
     }
   }
@@ -49,30 +63,6 @@ ImageList<TImage>
 ::PropagateRequestedRegion() throw (itk::InvalidRequestedRegionError)
 {
   Superclass::PropagateRequestedRegion();
-  for (ConstIterator it = this->Begin(); it!=this->End();++it)
-  {
-    if (it.Get()->GetUpdateMTime() < it.Get()->GetPipelineMTime()
-        || it.Get()->GetDataReleased()
-        || it.Get()->RequestedRegionIsOutsideOfTheBufferedRegion())
-    {
-      if (it.Get()->GetSource())
-      {
-        it.Get()->GetSource()->PropagateRequestedRegion(it.Get());
-      }
-    }
-
-    // Check that the requested region lies within the largest possible region
-    if ( ! it.Get()->VerifyRequestedRegion() )
-    {
-      // invalid requested region, throw an exception
-      itk::InvalidRequestedRegionError e(__FILE__, __LINE__);
-      e.SetLocation(ITK_LOCATION);
-      e.SetDataObject(it.Get());
-      e.SetDescription("Requested region is (at least partially) outside the largest possible region.");
-
-      throw e;
-    }
-  }
 }
 
 template <class TImage>
-- 
GitLab