From 0ece64669efb7268103e565c906f73761fdc160d Mon Sep 17 00:00:00 2001
From: Victor Poughon <victor.poughon@cnes.fr>
Date: Wed, 24 Apr 2019 16:31:53 +0200
Subject: [PATCH] DOC: review IndexedToRGBExample

---
 .../buildingExtractionIndexed_scaled.png      |  3 ++
 Data/Output/buildingExtractionRGB.png         |  3 ++
 Examples/BasicFilters/IndexedToRGBExample.cxx | 33 ++-----------------
 Examples/BasicFilters/IndexedToRGBExample.rst | 24 ++++++++++++++
 4 files changed, 32 insertions(+), 31 deletions(-)
 create mode 100644 Data/Output/buildingExtractionIndexed_scaled.png
 create mode 100644 Data/Output/buildingExtractionRGB.png
 create mode 100644 Examples/BasicFilters/IndexedToRGBExample.rst

diff --git a/Data/Output/buildingExtractionIndexed_scaled.png b/Data/Output/buildingExtractionIndexed_scaled.png
new file mode 100644
index 0000000000..f5c8ecd318
--- /dev/null
+++ b/Data/Output/buildingExtractionIndexed_scaled.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:90304742fc7c5d8d88cff5abc627954337856160799856adb5dcb352db484ddd
+size 17406
diff --git a/Data/Output/buildingExtractionRGB.png b/Data/Output/buildingExtractionRGB.png
new file mode 100644
index 0000000000..0dbdd3d556
--- /dev/null
+++ b/Data/Output/buildingExtractionRGB.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a91156558f5de2353efe3d8e3b17ef2284e74200a0bd1fed5d36bffcf720fc7a
+size 26026
diff --git a/Examples/BasicFilters/IndexedToRGBExample.cxx b/Examples/BasicFilters/IndexedToRGBExample.cxx
index adba63456d..d7a8226949 100644
--- a/Examples/BasicFilters/IndexedToRGBExample.cxx
+++ b/Examples/BasicFilters/IndexedToRGBExample.cxx
@@ -24,25 +24,11 @@
 */
 
 
-//  Some algorithms produce an indexed image as output. In such images,
-// each pixel is given a value according to the region number it belongs to.
-// This value starting at 0 or 1 is usually an integer value.
-// Often, such images are produced by segmentation or classification algorithms.
-//
-// If such regions are easy to manipulate -- it is easier and faster to compare two integers
-// than a RGB value -- it is different when it comes to displaying the results.
-//
-// Here we present a convient way to convert such indexed image to a color image. In
-// such conversion, it is important to ensure that neighborhood region, which are
-// likely to have consecutive number have easily dicernable colors. This is done
-// randomly using a hash function by the \doxygen{itk}{ScalarToRGBPixelFunctor}.
-
 #include "otbImage.h"
 #include "otbImageFileReader.h"
 #include "otbImageFileWriter.h"
 #include "itkUnaryFunctorImageFilter.h"
 #include "itkScalarToRGBPixelFunctor.h"
-
 #include "itkRescaleIntensityImageFilter.h"
 
 int main(int argc, char* argv[])
@@ -65,10 +51,8 @@ int main(int argc, char* argv[])
 
   reader->SetFileName(inputFilename);
 
-  //  The \doxygen{itk}{UnaryFunctorImageFilter} is the filter in charge of
-  // calling the functor we specify to do the work for each pixel. Here it is the
-  // \doxygen{itk}{ScalarToRGBPixelFunctor}.
-
+  // The UnaryFunctorImageFilter is the filter in charge of calling the functor
+  // we specify to do the work for each pixel. Here it is the ScalarToRGBPixelFunctor
   typedef itk::Functor::ScalarToRGBPixelFunctor<unsigned long>                       ColorMapFunctorType;
   typedef itk::UnaryFunctorImageFilter<ImageType, RGBImageType, ColorMapFunctorType> ColorMapFilterType;
   ColorMapFilterType::Pointer                                                        colormapper = ColorMapFilterType::New();
@@ -93,17 +77,4 @@ int main(int argc, char* argv[])
   writer2->SetFileName(outputScaledFilename);
   writer2->SetInput(rescaler->GetOutput());
   writer2->Update();
-
-  // Figure~\ref{fig:INDEXTORGB_FILTER} shows the result of the conversion
-  // from an indexed image to a color image.
-  // \begin{figure}
-  // \center
-  // \includegraphics[width=0.44\textwidth]{buildingExtractionIndexed_scaled.eps}
-  // \includegraphics[width=0.44\textwidth]{buildingExtractionRGB.eps}
-  // \itkcaption[Scaling images]{The original indexed image (left) and the
-  // conversion to color image.}
-  // \label{fig:INDEXTORGB_FILTER}
-  // \end{figure}
-
-  return EXIT_SUCCESS;
 }
diff --git a/Examples/BasicFilters/IndexedToRGBExample.rst b/Examples/BasicFilters/IndexedToRGBExample.rst
new file mode 100644
index 0000000000..a99740c8b7
--- /dev/null
+++ b/Examples/BasicFilters/IndexedToRGBExample.rst
@@ -0,0 +1,24 @@
+Some algorithms produce an indexed image as output. In such images,
+each pixel is given a value according to the region number it belongs to.
+This value starting at 0 or 1 is usually an integer value.
+Often, such images are produced by segmentation or classification algorithms.
+
+If such regions are easy to manipulate -- it is easier and faster to compare two integers
+than a RGB value -- it is different when it comes to displaying the results.
+
+Here we present a convient way to convert such indexed image to a color image. In
+such conversion, it is important to ensure that neighborhood region, which are
+likely to have consecutive number have easily dicernable colors. This is done
+randomly using a hash function by ``ScalarToRGBPixelFunctor``.
+
+.. |image1| image:: /Output/buildingExtractionIndexed_scaled.png
+
+.. |image2| image:: /Output/buildingExtractionRGB.png
+
+.. _Figure1:
+
++--------------------------+-------------------------+
+|        |image1|          |         |image2|        |
++--------------------------+-------------------------+
+
+    The original indexed image (left) and the conversion to color image.
-- 
GitLab