diff --git a/Data/Output/HillShadingColorExample.png b/Data/Output/HillShadingColorExample.png new file mode 100644 index 0000000000000000000000000000000000000000..ef71ef616873d212669e28f78d1ce307fed60284 --- /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 0000000000000000000000000000000000000000..d86e845d681b010064d24657bfc5cb93bf2f23e1 --- /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 1d58ca2f68482dc62bdfe16e8fca5e4a9ce76668..a281e9aef85d86116d5ca7c35b719cbd832e9e19 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 0000000000000000000000000000000000000000..98e95d368c9306e06501e696483d743a41c01700 --- /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)