From b55274463dc18afc3459c5ea388e65f2ec1bb8b6 Mon Sep 17 00:00:00 2001 From: Victor Poughon <victor.poughon@cnes.fr> Date: Wed, 24 Apr 2019 16:22:51 +0200 Subject: [PATCH] DOC: review HillShadingExample --- Data/Output/HillShadingColorExample.png | 3 ++ Data/Output/HillShadingExample.png | 3 ++ Examples/BasicFilters/HillShadingExample.cxx | 43 +------------------- Examples/BasicFilters/HillShadingExample.rst | 23 +++++++++++ 4 files changed, 31 insertions(+), 41 deletions(-) create mode 100644 Data/Output/HillShadingColorExample.png create mode 100644 Data/Output/HillShadingExample.png create mode 100644 Examples/BasicFilters/HillShadingExample.rst diff --git a/Data/Output/HillShadingColorExample.png b/Data/Output/HillShadingColorExample.png new file mode 100644 index 0000000000..ef71ef6168 --- /dev/null +++ b/Data/Output/HillShadingColorExample.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba2f71579dafa1317e7f036223d1d849f3dfd8eb3a3e699c6fa91d5226372ab2 +size 484983 diff --git a/Data/Output/HillShadingExample.png b/Data/Output/HillShadingExample.png new file mode 100644 index 0000000000..d86e845d68 --- /dev/null +++ b/Data/Output/HillShadingExample.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11d6eb5b30a7a0507a0c2b15275a69d583ae89c49da1ecb1fd29eb7e4aabbb5b +size 183418 diff --git a/Examples/BasicFilters/HillShadingExample.cxx b/Examples/BasicFilters/HillShadingExample.cxx index 1d58ca2f68..a281e9aef8 100644 --- a/Examples/BasicFilters/HillShadingExample.cxx +++ b/Examples/BasicFilters/HillShadingExample.cxx @@ -24,18 +24,6 @@ */ -// Visualization of digital elevation models (DEM) is often more intuitive by simulating a -// lighting source and generating the corresponding shadows. This principle is called -// hill shading. -// -// Using a simple functor \doxygen{otb}{HillShadingFunctor} and the DEM image generated -// using the \doxygen{otb}{DEMToImageGenerator} (refer to \ref{sec:ReadDEM}), you can easily -// obtain a representation of the DEM. Better yet, using the -// \doxygen{otb}{ScalarToRainbowRGBPixelFunctor}, combined with the -// \doxygen{otb}{ReliefColormapFunctor} you can easily generate the classic elevation maps. -// -// This example will focus on the shading itself. - #include "otbImageFileReader.h" #include "otbImageFileWriter.h" @@ -50,7 +38,6 @@ int main(int argc, char* argv[]) { - if (argc < 10) { std::cout << argv[0] << " <output_filename> <output_color_filename> " @@ -162,21 +149,8 @@ int main(int argc, char* argv[]) writer2->SetInput(multiply->GetOutput()); - try - { - writer->Update(); - writer2->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; - } + writer->Update(); + writer2->Update(); otb::WorldFile::Pointer worldFile = otb::WorldFile::New(); worldFile->SetLonOrigin(origin[0]); @@ -188,17 +162,4 @@ int main(int argc, char* argv[]) worldFile->Update(); worldFile->SetImageFilename(argv[2]); worldFile->Update(); - - // Figure~\ref{fig:HILL_SHADING} shows the hill shading result from SRTM data. - // - // \begin{figure} - // \center - // \includegraphics[width=0.44\textwidth]{HillShadingExample.eps} - // \includegraphics[width=0.44\textwidth]{HillShadingColorExample.eps} - // \itkcaption[Hill shading]{Hill shading obtained from SRTM data (left) and combined with - // the color representation (right)} - // \label{fig:HILL_SHADING} - // \end{figure} - - return EXIT_SUCCESS; } diff --git a/Examples/BasicFilters/HillShadingExample.rst b/Examples/BasicFilters/HillShadingExample.rst new file mode 100644 index 0000000000..98e95d368c --- /dev/null +++ b/Examples/BasicFilters/HillShadingExample.rst @@ -0,0 +1,23 @@ +Visualization of digital elevation models (DEM) is often more intuitive by +simulating a lighting source and generating the corresponding shadows. This +principle is called hill shading. + +Using :doxygen:`HillShadingFilter` and the DEM image generated +using the :doxygen:`DEMToImageGenerator`, you can easily obtain a representation +of the DEM. Better yet, using the :doxygen-itk:`ScalarToRGBColormapImageFilter` +combined with the ``ReliefColormapFunctor`` you can easily generate the +classic elevation maps. + +This example will focus on the shading itself. + +.. |image1| image:: /Output/HillShadingExample.png + +.. |image2| image:: /Output/HillShadingColorExample.png + +.. _Figure1: + ++--------------------------+-------------------------+ +| |image1| | |image2| | ++--------------------------+-------------------------+ + + Hill shading obtained from SRTM data (left) and combined with the color representation (right) -- GitLab