From a42cfcb647a4e85235e3df7b66576723ce0455a0 Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@c-s.fr>
Date: Wed, 23 May 2007 15:56:06 +0000
Subject: [PATCH] =?UTF-8?q?G=C3=A9n=C3=A9ration=20de=20la=20vignette=20pou?=
 =?UTF-8?q?r=20l'exemple=20d'extraction=20de=20route.=20Modification=20des?=
 =?UTF-8?q?=20noms=20des=20applis?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../ExtractRoadByStepsExample.cxx             | 32 +++++++++++++++----
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx b/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx
index d06d05b863..5bd93e68a5 100755
--- a/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx
+++ b/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx
@@ -60,6 +60,7 @@
 #include "otbMultiToMonoChannelExtractROI.h"
 #include "itkRescaleIntensityImageFilter.h"
 #include "itkSqrtImageFilter.h"
+#include "itkVectorRescaleIntensityImageFilter.h"
 
 // Software Guide : EndCodeSnippet
 
@@ -69,7 +70,7 @@
 #include "otbPolyLineParametricPathWithValue.h"
 #include "otbImageFileReader.h"
 #include "otbImageFileWriter.h"
-
+#include "otbMultiChannelExtractROI.h"
 
 //  Software Guide : BeginCommandLineArgs
 //    INPUTS: {qb_RoadExtract.tif}
@@ -86,19 +87,35 @@ int main( int argc, char * argv[] )
   typedef otb::Image<PixelType, Dimension> InternalImageType;
   typedef otb::VectorImage<PixelType, Dimension> MultiSpectralImageType;
   typedef otb::Image<unsigned char, Dimension> OutputImageType;
-
   typedef otb::Image<VectorPixelType, Dimension > VectorImageType;
 
   typedef otb::PolyLineParametricPathWithValue< double, Dimension >       PathType;
   
-  
+  typedef otb::ImageFileWriter<OutputImageType> FileWriterType;
   typedef otb::ImageFileReader< MultiSpectralImageType > MultispectralReaderType;
+
   MultispectralReaderType::Pointer multispectralReader =  MultispectralReaderType::New();
   multispectralReader->SetFileName(argv[1]);
-  
-  typedef otb::ImageFileWriter< OutputImageType > FileWriterType;
-  FileWriterType::Pointer writer =  FileWriterType::New();
-  
+
+  /// Create an 3 band image for the software guide 
+  typedef itk::Vector<double,4> InPType;
+  typedef itk::Vector<unsigned short, 3> OutPType;
+  typedef otb::Image<OutPType,2> InImType;
+  typedef otb::Image<OutPType,2> OutImType;
+  typedef otb::ImageFileReader<InImType> ReadType;
+ //  typedef itk::VectorRescaleIntensityImageFilter<InImType,OutImType> RescType;
+  typedef otb::ImageFileWriter<OutImType> WriteType;
+
+  ReadType::Pointer r = ReadType::New();
+  // RescType::Pointer f = RescType::New();
+  WriteType::Pointer w = WriteType::New();
+  r->SetFileName(argv[1]);
+ //  f->SetInput(r->GetOutput());
+//   f->SetOutputMaximumMagnitude(511);
+  w->SetFileName("qb_ExtractRoad_pretty.png");
+  w->SetInput(r->GetOutput());
+  w->Update();
+
   // NB: There might be a better way to pass this parameter (coordinate of the reference ?)
   // plan combination with the viewer
   // possibility to give 2 parameters (just in future use)
@@ -342,6 +359,7 @@ int main( int argc, char * argv[] )
   //  Software Guide : EndLatex 
   
   // Software Guide : BeginCodeSnippet
+  FileWriterType::Pointer writer = FileWriterType::New();
   writer->SetInput( drawPathListFilter->GetOutput() );
   writer->SetFileName( argv[2] );
   writer->Update();
-- 
GitLab