From 5936ed4ffb5050ca5c4647fb35a6eedaa86a5a00 Mon Sep 17 00:00:00 2001
From: Manuel Grizonnet <manuel.grizonnet@gmail.com>
Date: Wed, 20 Jan 2010 15:41:45 +0100
Subject: [PATCH] DOC:update examples

---
 Examples/OBIA/CMakeLists.txt                  |  7 ++--
 Examples/OBIA/ImageToLabelToImage.cxx         |  5 ++-
 ...ometricAttributesLabelMapFilterExample.cxx | 35 ++++++++++++-------
 3 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/Examples/OBIA/CMakeLists.txt b/Examples/OBIA/CMakeLists.txt
index cf41d6ba3b..d92b0ad0c3 100755
--- a/Examples/OBIA/CMakeLists.txt
+++ b/Examples/OBIA/CMakeLists.txt
@@ -39,8 +39,8 @@ ADD_TEST( trTeOBIAImageToLabelToImageTest ${EXE_TESTS}
         OBIAImageToLabelToImageTest
         ${INPUTDATA}/MSLabeledOutput.tif
         ${TEMP}/OBIAI2L2IOutput.tif
-	${TEMP}/OBIAI2L2IInPretty.tif
-	${TEMP}/OBIAI2L2IOutPretty.tif
+	${TEMP}/OBIAI2L2IInPretty.png
+	${TEMP}/OBIAI2L2IOutPretty.png
 	1 1108 0
         )
 
@@ -56,8 +56,9 @@ ADD_TEST(trTeOBIARadiometricAttributesLabelMapFilterTest ${EXE_TESTS}
 	--compare-image ${TOL}	${BASELINE}/OBIARadiometricAttributes.tif
 	                        ${TEMP}/OBIARadiometricAttributes.tif
 	RadiometricAttributesLabelMapFilterExample
-	${INPUTDATA}/qb_RoadExtract2.tif  
+	${INPUTDATA}/qb_RoadExtract.tif 
 	${TEMP}/OBIARadiometricAttributes.tif
+	${TEMP}/qb_RoadExtract_Radiometry_pretty.png
 	STATS::Ndvi::Mean
 	1
 	-0.3
diff --git a/Examples/OBIA/ImageToLabelToImage.cxx b/Examples/OBIA/ImageToLabelToImage.cxx
index 74de8989a9..4dd826e628 100755
--- a/Examples/OBIA/ImageToLabelToImage.cxx
+++ b/Examples/OBIA/ImageToLabelToImage.cxx
@@ -18,8 +18,8 @@
 
 
 //  Software Guide : BeginCommandLineArgs
-//    INPUTS: {MSLabeledOutput16bits.tif}
-//    OUTPUTS: {OBIAI2L2IOutput.tif}, {OBIAI2L2IInputPretty.tif}, {OBIAI2L2IOutputPretty.tif}
+//    INPUTS: {MSLabeledOutput.tif}
+//    OUTPUTS: {OBIAI2L2IOutput.tif}, {OBIAI2L2IInputPretty.png}, {OBIAI2L2IOutputPretty.png}
 //    1 1108 0
 //  Software Guide : EndCommandLineArgs
 
@@ -164,7 +164,6 @@ int main(int argc, char * argv[])
   //
   // \begin{figure}
   // \center
-  // \includegraphics[width=0.44\textwidth]{MSLabeledOutput16bits.eps}
   // \includegraphics[width=0.44\textwidth]{OBIAI2L2IInputPretty.eps}
   // \includegraphics[width=0.44\textwidth]{OBIAI2L2IOutputPretty.eps}
   // \itkcaption[Image to Label Object Map]{Transforming an
diff --git a/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx b/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx
index 8bf4bb749a..96793dca9b 100755
--- a/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx
+++ b/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx
@@ -18,8 +18,8 @@
 
 //  Software Guide : BeginCommandLineArgs
 //    INPUTS: {qb_RoadExtract.tif}
-//    OUTPUTS: {OBIARadiometricAttribute1.tif}
-//    STATS::Ndvi::Mean 0 -0.3 16 16 100 1.0
+//    OUTPUTS: {OBIARadiometricAttribute1.png}, {qb_ExtractRoad_Radiometry_pretty.tif}
+//    STATS::Ndvi::Mean 0 -0.3 16 16 10 1.0
 //  Software Guide : EndCommandLineArgs
 
 //  Software Guide : BeginLatex
@@ -65,22 +65,23 @@
 
 int main(int argc, char * argv[])
 {
-  if(argc != 10)
+  if(argc != 11)
     {
-      std::cerr<<"Usage: "<<argv[0]<<" reffname outfname attribute_name lowerThan tresh spatialRadius rangeRadius minregionsize scale"<<std::endl;
+      std::cerr<<"Usage: "<<argv[0]<<" reffname outfname outprettyfname attribute_name lowerThan tresh spatialRadius rangeRadius minregionsize scale"<<std::endl;
       return EXIT_FAILURE;
     }
 
   const char * reffname = argv[1];
   const char * outfname = argv[2];
-  const char * attr     = argv[3];
-  bool  lowerThan       = atoi(argv[4]);
-  double thresh         = atof(argv[5]);
+  const char * outprettyfname = argv[3];
+  const char * attr     = argv[4];
+  bool  lowerThan       = atoi(argv[5]);
+  double thresh         = atof(argv[6]);
   
-  const unsigned int spatialRadius          = atoi(argv[6]);
-  const double       rangeRadius            = atof(argv[7]);
-  const unsigned int minRegionSize          = atoi(argv[8]);
-  const double       scale                  = atoi(argv[9]);
+  const unsigned int spatialRadius          = atoi(argv[7]);
+  const double       rangeRadius            = atof(argv[8]);
+  const unsigned int minRegionSize          = atoi(argv[9]);
+  const double       scale                  = atoi(argv[10]);
 
   const unsigned int Dimension = 2;
 
@@ -108,6 +109,9 @@ int main(int argc, char * argv[])
   ReaderType::Pointer reader = ReaderType::New();
   reader->SetFileName(reffname);
 
+  LabeledReaderType::Pointer lreader = LabeledReaderType::New();
+  lreader->SetFileName(reffname);
+  
   VectorReaderType::Pointer vreader = VectorReaderType::New();
   vreader->SetFileName(reffname);
     //  Software Guide : BeginLatex
@@ -232,6 +236,11 @@ int main(int argc, char * argv[])
   writer->Update();
   // Software Guide : EndCodeSnippet
 
+  WriterType::Pointer lwriter = WriterType::New();
+  lwriter->SetFileName(outprettyfname);
+  lwriter->SetInput(lreader->GetOutput());
+  lwriter->Update();
+  
   return EXIT_SUCCESS;
 }
 
@@ -240,9 +249,9 @@ int main(int argc, char * argv[])
   // Figure~\ref{fig:RADIOMETRIC_LABEL_MAP_FILTER} shows the result of applying
   // the object selection based on radiometric attributes. 
   // \begin{figure} \center
-  // \includegraphics[width=0.44\textwidth]{qb_RoadExtract.eps}
+  // \includegraphics[width=0.44\textwidth]{qb_ExtractRoad_Radiometry_pretty.eps}
   // \includegraphics[width=0.44\textwidth]{OBIARadiometricAttribute1.eps}
-  // \itkcaption[Object based extraction based on ]{From left to right: original image, vegetation mask resulting from processing.}
+  // \itkcaption[Object based extraction based on ]{Vegetation mask resulting from processing.}
   // \label{fig:RADIOMETRIC_LABEL_MAP_FILTER}
   // \end{figure}
   //
-- 
GitLab