From 76d8f44ccb5adb0b8272c630fa0021543e5756b2 Mon Sep 17 00:00:00 2001 From: Victor Poughon <victor.poughon@cnes.fr> Date: Wed, 24 Apr 2019 15:20:33 +0200 Subject: [PATCH] DOC: review DEMToRainbowExample --- Data/Output/DEMToHotImageGenerator.png | 3 ++ Data/Output/DEMToRainbowImageGenerator.png | 3 ++ Data/Output/DEMToReliefImageGenerator.png | 3 ++ Examples/BasicFilters/DEMToRainbowExample.cxx | 48 ++----------------- Examples/BasicFilters/DEMToRainbowExample.rst | 23 +++++++++ 5 files changed, 35 insertions(+), 45 deletions(-) create mode 100644 Data/Output/DEMToHotImageGenerator.png create mode 100644 Data/Output/DEMToRainbowImageGenerator.png create mode 100644 Data/Output/DEMToReliefImageGenerator.png create mode 100644 Examples/BasicFilters/DEMToRainbowExample.rst diff --git a/Data/Output/DEMToHotImageGenerator.png b/Data/Output/DEMToHotImageGenerator.png new file mode 100644 index 0000000000..12224d6f09 --- /dev/null +++ b/Data/Output/DEMToHotImageGenerator.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d36b4f16b0f0be1d4d2247de214510349da67d37ae928945940898904e5a0a85 +size 234062 diff --git a/Data/Output/DEMToRainbowImageGenerator.png b/Data/Output/DEMToRainbowImageGenerator.png new file mode 100644 index 0000000000..935878f01c --- /dev/null +++ b/Data/Output/DEMToRainbowImageGenerator.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd8b080e078549cdcfa949a31a286b30b7d6f1c96c923a977083a02855994256 +size 239121 diff --git a/Data/Output/DEMToReliefImageGenerator.png b/Data/Output/DEMToReliefImageGenerator.png new file mode 100644 index 0000000000..97820270f0 --- /dev/null +++ b/Data/Output/DEMToReliefImageGenerator.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0a9ed1706ab135a72068d49d0671e4c64c038d738928485b3721d29851c56ff1 +size 333514 diff --git a/Examples/BasicFilters/DEMToRainbowExample.cxx b/Examples/BasicFilters/DEMToRainbowExample.cxx index f1cf3e83a3..fcceeae63c 100644 --- a/Examples/BasicFilters/DEMToRainbowExample.cxx +++ b/Examples/BasicFilters/DEMToRainbowExample.cxx @@ -33,19 +33,6 @@ ./DEMToRainbowExample Output/DEMToReliefImageGenerator.png 6.5 45.5 500 500 0.002 -0.002 Input/DEM_srtm relief */ - -// In some situation, it is desirable to represent a gray scale image in color for easier -// interpretation. This is particularly the case if pixel values in the image are used -// to represent some data such as elevation, deformation map, -// interferogram. In this case, it is important to ensure that similar -// values will get similar colors. You can notice how this requirement -// differs from the previous case. -// -// The following example illustrates the use of the \doxygen{otb}{DEMToImageGenerator} class -// combined with the \doxygen{otb}{ScalarToRainbowRGBPixelFunctor}. You can refer to the -// source code or to section \ref{sec:ReadDEM} for the DEM conversion to image, -// we will focus on the color conversion part here. - #include "otbImageFileReader.h" #include "otbImageFileWriter.h" @@ -103,9 +90,9 @@ int main(int argc, char* argv[]) demToImage->SetOutputSpacing(spacing); - // As in the previous example, the \doxygen{itk}{ScalarToRGBColormapImageFilter} is + // The ScalarToRGBColormapImageFilter is // the filter in charge of calling the functor we specify to do the work for - // each pixel. Here it is the \doxygen{otb}{ScalarToRainbowRGBPixelFunctor}. + // each pixel. Here it is the ScalarToRainbowRGBPixelFunctor. typedef itk::ScalarToRGBColormapImageFilter<ImageType, RGBImageType> ColorMapFilterType; ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New(); @@ -146,34 +133,5 @@ int main(int argc, char* argv[]) writer->SetInput(colormapper->GetOutput()); - try - { - writer->Update(); - } - catch (itk::ExceptionObject& excep) - { - std::cerr << "Exception caught !" << std::endl; - std::cerr << excep << std::endl; - } - catch (...) - { - std::cout << "Unknown exception !" << std::endl; - return EXIT_FAILURE; - } - - // Figure~\ref{fig:RAINBOW_FILTER} shows the effect of applying the filter to - // a gray scale image. - // - // \begin{figure} - // \center - // \includegraphics[width=0.44\textwidth]{pretty_DEMToImageGenerator.eps} - // \includegraphics[width=0.44\textwidth]{DEMToRainbowImageGenerator.eps} - // \includegraphics[width=0.44\textwidth]{DEMToHotImageGenerator.eps} - // \includegraphics[width=0.44\textwidth]{DEMToReliefImageGenerator.eps} - // \itkcaption[Grayscale to color]{The gray level DEM extracted from SRTM - // data (top-left) and the same area represented in color.} - // \label{fig:RAINBOW_FILTER} - // \end{figure} - - return EXIT_SUCCESS; + writer->Update(); } diff --git a/Examples/BasicFilters/DEMToRainbowExample.rst b/Examples/BasicFilters/DEMToRainbowExample.rst new file mode 100644 index 0000000000..a1164c7cdf --- /dev/null +++ b/Examples/BasicFilters/DEMToRainbowExample.rst @@ -0,0 +1,23 @@ +In some situation, it is desirable to represent a gray scale image in color for easier +interpretation. This is particularly the case if pixel values in the image are used +to represent some data such as elevation, deformation map, +interferogram. In this case, it is important to ensure that similar +values will get similar colors. You can notice how this requirement +differs from the previous case. + +The following example illustrates the use of the :doxygen:`DEMToImageGenerator` +class combined with the `ScalarToRainbowRGBPixelFunctor`. You can refer to the +source code for the DEM conversion to image, we will focus on the color +conversion part here. + +.. |image1| image:: /Output/DEMToRainbowImageGenerator.png + +.. |image2| image:: /Output/DEMToHotImageGenerator.png + +.. |image3| image:: /Output/DEMToReliefImageGenerator.png + +.. _Figure1: + ++--------------------------+-------------------------+-------------------------+ +| |image1| | |image2| | |image3| | ++--------------------------+-------------------------+-------------------------+ -- GitLab