Commit 76d8f44c authored by Victor Poughon's avatar Victor Poughon
Browse files

DOC: review DEMToRainbowExample

No related merge requests found
Showing with 35 additions and 45 deletions
+35 -45
Data/Output/DEMToHotImageGenerator.png

131 Bytes

Data/Output/DEMToRainbowImageGenerator.png

131 Bytes

Data/Output/DEMToReliefImageGenerator.png

131 Bytes

...@@ -33,19 +33,6 @@ ...@@ -33,19 +33,6 @@
./DEMToRainbowExample Output/DEMToReliefImageGenerator.png 6.5 45.5 500 500 0.002 -0.002 Input/DEM_srtm relief ./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 "otbImageFileReader.h"
#include "otbImageFileWriter.h" #include "otbImageFileWriter.h"
...@@ -103,9 +90,9 @@ int main(int argc, char* argv[]) ...@@ -103,9 +90,9 @@ int main(int argc, char* argv[])
demToImage->SetOutputSpacing(spacing); 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 // 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; typedef itk::ScalarToRGBColormapImageFilter<ImageType, RGBImageType> ColorMapFilterType;
ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New(); ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New();
...@@ -146,34 +133,5 @@ int main(int argc, char* argv[]) ...@@ -146,34 +133,5 @@ int main(int argc, char* argv[])
writer->SetInput(colormapper->GetOutput()); writer->SetInput(colormapper->GetOutput());
try writer->Update();
{
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;
} }
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| |
+--------------------------+-------------------------+-------------------------+
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment