From 486b3d8ba5c46ffdf3830d91df6ce1c241cd261b Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@orfeo-toolbox.org>
Date: Tue, 29 Jun 2010 17:48:20 +0200
Subject: [PATCH] DOC: Pretty output

---
 Examples/FeatureExtraction/TextureExample.cxx | 38 ++++++++++++-------
 1 file changed, 24 insertions(+), 14 deletions(-)

diff --git a/Examples/FeatureExtraction/TextureExample.cxx b/Examples/FeatureExtraction/TextureExample.cxx
index 1f5797a4d0..d678bbc6e2 100644
--- a/Examples/FeatureExtraction/TextureExample.cxx
+++ b/Examples/FeatureExtraction/TextureExample.cxx
@@ -33,7 +33,11 @@
 #include "otbImage.h"
 #include "otbImageFileReader.h"
 #include "otbImageFileWriter.h"
-#include "itkRescaleIntensityImageFilter.h"
+
+// Pretty RGB output
+#include "otbVectorImage.h"
+#include "otbImageToVectorImageCastFilter.h"
+#include "otbVectorRescaleIntensityImageFilter.h"
 
 // Software Guide : BeginLatex
 //
@@ -192,17 +196,14 @@ int main(int argc, char * argv[])
 
     // Software Guide : BeginLatex
     //
-    // We can now plug the pipeline and trigger the execution by calling
-    // the \code{Update} method of the writer.
+    // We can now plug the pipeline.
     //
     // Software Guide : EndLatex
     // Software Guide : BeginCodeSnippet
     texturesFilter->SetInput(reader->GetOutput());
-    // Software Guide : EndCodeSnippet
 
     writer->SetInput(texturesFilter->GetInertiaOutput());
     writer->Update();
-
     // Software Guide : EndCodeSnippet
 
     //  Software Guide : BeginLatex
@@ -222,21 +223,30 @@ int main(int argc, char * argv[])
 
     // Pretty image creation for printing
 
-    typedef otb::Image<unsigned char,
-                     Dimension>
-    OutputPrettyImageType;
-    typedef otb::ImageFileWriter<OutputPrettyImageType>
+    typedef otb::VectorImage<double,2> VectorImageType;
+    typedef otb::VectorImage<unsigned char,2 > PrettyVectorImageType;
+    typedef otb::ImageFileWriter<PrettyVectorImageType>
     WriterPrettyOutputType;
-    typedef itk::RescaleIntensityImageFilter<ImageType,
-                                           OutputPrettyImageType>
+
+    typedef otb::ImageToVectorImageCastFilter<ImageType,VectorImageType> VectorCastFilterType;
+    typedef otb::VectorRescaleIntensityImageFilter<VectorImageType,PrettyVectorImageType>
     RescalerOutputType;
 
+    VectorCastFilterType::Pointer   vectorCast         = VectorCastFilterType::New();
     RescalerOutputType::Pointer     outputRescaler     = RescalerOutputType::New();
     WriterPrettyOutputType::Pointer prettyOutputWriter =
     WriterPrettyOutputType::New();
-    outputRescaler->SetInput(texturesFilter->GetInertiaOutput());
-    outputRescaler->SetOutputMinimum(0);
-    outputRescaler->SetOutputMaximum(255);
+    VectorCastFilterType::Pointer vectorCastFilter = VectorCastFilterType::New();
+    vectorCastFilter->SetInput(texturesFilter->GetInertiaOutput());
+    outputRescaler->SetInput(vectorCastFilter->GetOutput());
+
+    PrettyVectorImageType::PixelType min(1),max(1);
+    min.Fill(0);
+    max.Fill(255);
+
+    outputRescaler->SetOutputMinimum(min);
+    outputRescaler->SetOutputMaximum(max);
+
     prettyOutputWriter->SetFileName(outprettyfname);
     prettyOutputWriter->SetInput(outputRescaler->GetOutput());
 
-- 
GitLab