From 7103fc8fde68ca0e4725afe51731607aee14a13f Mon Sep 17 00:00:00 2001
From: Arnaud Jaen <arnaud.jaen@c-s.fr>
Date: Wed, 6 Jun 2012 09:41:15 +0200
Subject: [PATCH] BUG: StreamSize was not correctly initialized in
 otbPersistentImageToOGRDataFilter.

---
 Code/OBIA/otbPersistentImageToOGRDataFilter.h |  2 --
 .../otbPersistentImageToOGRDataFilter.txx     | 19 ++++++-------------
 .../otbStreamingVectorizedSegmentationOGR.h   |  1 -
 .../otbStreamingVectorizedSegmentationOGR.txx |  7 -------
 4 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/Code/OBIA/otbPersistentImageToOGRDataFilter.h b/Code/OBIA/otbPersistentImageToOGRDataFilter.h
index 38fbfbf9cf..2cf9a695a2 100644
--- a/Code/OBIA/otbPersistentImageToOGRDataFilter.h
+++ b/Code/OBIA/otbPersistentImageToOGRDataFilter.h
@@ -112,8 +112,6 @@ protected:
   void PrintSelf(std::ostream& os, itk::Indent indent) const;
 
   virtual void GenerateData();
-  
-  void GenerateInputRequestedRegion();
 
 
 private:
diff --git a/Code/OBIA/otbPersistentImageToOGRDataFilter.txx b/Code/OBIA/otbPersistentImageToOGRDataFilter.txx
index 1b17482ab7..352fe540a8 100644
--- a/Code/OBIA/otbPersistentImageToOGRDataFilter.txx
+++ b/Code/OBIA/otbPersistentImageToOGRDataFilter.txx
@@ -62,19 +62,6 @@ PersistentImageToOGRDataFilter<TImage>
 }
 
 
-template<class TImage>
-void
-PersistentImageToOGRDataFilter<TImage>
-::GenerateInputRequestedRegion()
-{
-   Superclass::GenerateInputRequestedRegion();
-   if (this->m_StreamSize[0]==0 && this->m_StreamSize[1]==0)
-   {
-      this->m_StreamSize = this->GetInput()->GetRequestedRegion().GetSize();
-   }
-}
-
-
 template<class TImage>
 void
 PersistentImageToOGRDataFilter<TImage>
@@ -143,6 +130,12 @@ void
 PersistentImageToOGRDataFilter<TImage>
 ::GenerateData()
 {
+  
+  if (this->GetStreamSize()[0]==0 && this->GetStreamSize()[1]==0)
+  {
+     this->m_StreamSize = this->GetInput()->GetRequestedRegion().GetSize();
+  }
+  
   // call the processing function for this tile
   OGRDataSourcePointerType currentTileVD = this->ProcessTile();
   OGRLayerType srcLayer = currentTileVD->GetLayerChecked(0);
diff --git a/Code/OBIA/otbStreamingVectorizedSegmentationOGR.h b/Code/OBIA/otbStreamingVectorizedSegmentationOGR.h
index e6485acda2..ea6487374b 100644
--- a/Code/OBIA/otbStreamingVectorizedSegmentationOGR.h
+++ b/Code/OBIA/otbStreamingVectorizedSegmentationOGR.h
@@ -182,7 +182,6 @@ protected:
 
   virtual ~PersistentStreamingLabelImageToOGRDataFilter();
 
-  void GenerateInputRequestedRegion();
 
 private:
   PersistentStreamingLabelImageToOGRDataFilter(const Self &); //purposely not implemented
diff --git a/Code/OBIA/otbStreamingVectorizedSegmentationOGR.txx b/Code/OBIA/otbStreamingVectorizedSegmentationOGR.txx
index dff46f97ff..2153acde43 100644
--- a/Code/OBIA/otbStreamingVectorizedSegmentationOGR.txx
+++ b/Code/OBIA/otbStreamingVectorizedSegmentationOGR.txx
@@ -67,13 +67,6 @@ PersistentStreamingLabelImageToOGRDataFilter<TImageType, TSegmentationFilter>
   return static_cast<const LabelImageType *>(this->itk::ProcessObject::GetInput(2));
 }
 
-template <class TImageType, class TSegmentationFilter>
-void
-PersistentStreamingLabelImageToOGRDataFilter<TImageType, TSegmentationFilter>
-::GenerateInputRequestedRegion()
-{
-  Superclass::GenerateInputRequestedRegion();
-}
 
 template <class TImageType, class TSegmentationFilter>
 typename PersistentStreamingLabelImageToOGRDataFilter<TImageType, TSegmentationFilter>::OGRDataSourcePointerType
-- 
GitLab