From ca09c4ede0d3f74e694a676378f24a841bbb97e2 Mon Sep 17 00:00:00 2001
From: Guillaume Pasero <guillaume.pasero@c-s.fr>
Date: Tue, 26 Aug 2014 17:56:31 +0200
Subject: [PATCH] BUG: Mantis-957 :give input metadata to drawing filter

---
 Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx   | 6 ++----
 Examples/FeatureExtraction/ExtractRoadExample.cxx          | 3 ++-
 Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx | 3 ++-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx b/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx
index ea3abe7ed6..dd66a2e9bc 100644
--- a/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx
+++ b/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx
@@ -383,12 +383,10 @@ int main(int itkNotUsed(argc), char * argv[])
 
   // Software Guide : BeginCodeSnippet
   InternalImageType::Pointer output = InternalImageType::New();
-  output->SetRegions(multispectralReader->GetOutput()
-                     ->GetLargestPossibleRegion());
+  output->CopyInformation(multispectralReader->GetOutput());
+  output->SetRegions(output->GetLargestPossibleRegion());
   output->Allocate();
   output->FillBuffer(0.0);
-  output->SetOrigin(multispectralReader->GetOutput()->GetOrigin());
-  output->SetSpacing(multispectralReader->GetOutput()->GetSpacing());
   // Software Guide : EndCodeSnippet
 
   // Software Guide : BeginLatex
diff --git a/Examples/FeatureExtraction/ExtractRoadExample.cxx b/Examples/FeatureExtraction/ExtractRoadExample.cxx
index 29c670809c..d35ac2a924 100644
--- a/Examples/FeatureExtraction/ExtractRoadExample.cxx
+++ b/Examples/FeatureExtraction/ExtractRoadExample.cxx
@@ -286,7 +286,8 @@ int main(int argc, char * argv[])
   // Software Guide : BeginCodeSnippet
   reader->GenerateOutputInformation();
   InputImageType::Pointer blackBackground = InputImageType::New();
-  blackBackground->SetRegions(reader->GetOutput()->GetLargestPossibleRegion());
+  blackBackground->CopyInformation(reader->GetOutput());
+  blackBackground->SetRegions(blackBackground->GetLargestPossibleRegion());
   blackBackground->Allocate();
   blackBackground->FillBuffer(0);
   // Software Guide : EndCodeSnippet
diff --git a/Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx b/Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx
index 34bde25905..44781be9b5 100644
--- a/Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx
+++ b/Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx
@@ -80,7 +80,8 @@ int otbRoadExtractionFilter(int itkNotUsed(argc), char * argv[])
 
   reader->GenerateOutputInformation();
   OutputImageType::Pointer image = OutputImageType::New();
-  image->SetRegions(reader->GetOutput()->GetLargestPossibleRegion());
+  image->CopyInformation(reader->GetOutput());
+  image->SetRegions(image->GetLargestPossibleRegion());
   image->Allocate();
   image->FillBuffer(0);
 
-- 
GitLab