From 247c74e569230c4398ce5ccb422f75cca309959a Mon Sep 17 00:00:00 2001 From: Victor Poughon <victor.poughon@cnes.fr> Date: Wed, 24 Apr 2019 17:21:42 +0200 Subject: [PATCH] DOC: review ScalingFilterExample --- Data/Output/QB_Toulouse_Ortho_PAN_casted.png | 3 +++ .../Output/QB_Toulouse_Ortho_PAN_rescaled.png | 3 +++ .../BasicFilters/ScalingFilterExample.cxx | 26 +------------------ .../BasicFilters/ScalingFilterExample.rst | 17 ++++++++++++ 4 files changed, 24 insertions(+), 25 deletions(-) create mode 100644 Data/Output/QB_Toulouse_Ortho_PAN_casted.png create mode 100644 Data/Output/QB_Toulouse_Ortho_PAN_rescaled.png create mode 100644 Examples/BasicFilters/ScalingFilterExample.rst diff --git a/Data/Output/QB_Toulouse_Ortho_PAN_casted.png b/Data/Output/QB_Toulouse_Ortho_PAN_casted.png new file mode 100644 index 0000000000..23aee06b35 --- /dev/null +++ b/Data/Output/QB_Toulouse_Ortho_PAN_casted.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca5363df6bf1a9fd48d17b033cd507ece65605bce33a8f3da8e3ba4af5f5e705 +size 182862 diff --git a/Data/Output/QB_Toulouse_Ortho_PAN_rescaled.png b/Data/Output/QB_Toulouse_Ortho_PAN_rescaled.png new file mode 100644 index 0000000000..6a70131af5 --- /dev/null +++ b/Data/Output/QB_Toulouse_Ortho_PAN_rescaled.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e333f7abd77db1ab2158975e767ed1ea94ff547747584be07f54a01eae0bb3fa +size 108051 diff --git a/Examples/BasicFilters/ScalingFilterExample.cxx b/Examples/BasicFilters/ScalingFilterExample.cxx index 174fa6699c..feef4ec723 100644 --- a/Examples/BasicFilters/ScalingFilterExample.cxx +++ b/Examples/BasicFilters/ScalingFilterExample.cxx @@ -23,13 +23,6 @@ ./ScalingFilterExample Input/QB_Toulouse_Ortho_PAN.tif Output/QB_Toulouse_Ortho_PAN_rescaled.png Output/QB_Toulouse_Ortho_PAN_casted.png */ - -// On one hand, satellite images are commonly coded on more than 8 bits to provide -// the dynamic range required from shadows to clouds. On the other hand, image formats -// in use for printing and display are usually limited to 8 bits. We need to convert the value -// to enable a proper display. This is usually done using linear scaling. Of course, you have -// to be aware that some information is lost in the process. - #include "otbImage.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" @@ -56,8 +49,7 @@ int main(int argc, char* argv[]) ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); - // The \doxygen{itk}{RescaleIntensityImageFilter} is used to rescale the value: - + // The RescaleIntensityImageFilter is used to rescale the value typedef itk::RescaleIntensityImageFilter<InputImageType, OutputImageType> RescalerType; RescalerType::Pointer rescaler = RescalerType::New(); rescaler->SetInput(reader->GetOutput()); @@ -75,20 +67,4 @@ int main(int argc, char* argv[]) writer->SetFileName(argv[3]); writer->SetInput(caster->GetOutput()); writer->Update(); - - // Figure~\ref{fig:SCALING_FILTER} illustrates the difference between a proper scaling and - // a simple truncation of the value and demonstrates why it is - // important to keep this in mind. - // \begin{figure} - // \center - // \includegraphics[width=0.44\textwidth]{QB_Toulouse_Ortho_PAN_casted.eps} - // \includegraphics[width=0.44\textwidth]{QB_Toulouse_Ortho_PAN_rescaled.eps} - // \itkcaption[Scaling images]{On the left, the image obtained by truncated pixel values - // at the dynamic acceptable for a png file (between 0 and 255). On the right, - // the same image with - // a proper rescaling} - // \label{fig:SCALING_FILTER} - // \end{figure} - - return EXIT_SUCCESS; } diff --git a/Examples/BasicFilters/ScalingFilterExample.rst b/Examples/BasicFilters/ScalingFilterExample.rst new file mode 100644 index 0000000000..a284ff97ab --- /dev/null +++ b/Examples/BasicFilters/ScalingFilterExample.rst @@ -0,0 +1,17 @@ +On one hand, satellite images are commonly coded on more than 8 bits to provide +the dynamic range required from shadows to clouds. On the other hand, image formats +in use for printing and display are usually limited to 8 bits. We need to convert the value +to enable a proper display. This is usually done using linear scaling. Of course, you have +to be aware that some information is lost in the process. + +.. |image1| image:: /Output/QB_Toulouse_Ortho_PAN_casted.png + +.. |image2| image:: /Output/QB_Toulouse_Ortho_PAN_rescaled.png + +.. _Figure1: + ++--------------------------+-------------------------+ +| |image1| | |image2| | ++--------------------------+-------------------------+ + + On the left, the image obtained by truncated pixel values at the dynamic acceptable for a png file (between 0 and 255). On the right, the same image with a proper rescaling. -- GitLab