Commit 994d5366 authored by Cédric Traizet's avatar Cédric Traizet

Merge branch 'develop' into regression_refactoring

parents 5f6a9bdb eb92becf
......@@ -9,7 +9,7 @@
# GIT_STRATEGY=fetch (https://gitlab.com/gitlab-org/gitlab-runner/issues/3318)
variables:
BUILD_IMAGE_REGISTRY: $CI_REGISTRY/gbonnefille/otb-build-env
BUILD_IMAGE_REGISTRY: $CI_REGISTRY/orfeotoolbox/otb-build-env
DOCKER_DRIVER: overlay2
GIT_DEPTH: "3"
# Disable automatic checkout to let us fetch LFS before
......@@ -44,7 +44,7 @@ fast-build:
extends: .general
only: [merge_requests, branches]
stage: precheck
image: $CI_REGISTRY/gpasero/otb/otb-install-ubuntu-native
image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-native-develop:latest
before_script:
- export GIT_LFS_SKIP_SMUDGE=1
- git checkout $CI_COMMIT_REF_NAME
......
......@@ -45,3 +45,4 @@ The copyright owner is *COPYRIGHT OWNER (OR OWNER'S AGENT)* and has signed the O
- The feature branch is (reasonably) up-to-date with the base branch
- Dashboard is green
- Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
- Optionally, run `git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i` on latest changes and commit
......@@ -618,8 +618,6 @@ vegetation had been demonstrated, users tended to also use the NDVI to
quantify the photosynthetic capacity of plant canopies. This, however,
can be a rather more complex undertaking if not done properly.
* NDVI. See example :ref:`NDVIRAndNIRVegetationIndexImageFilter.cxx`.
* ARVI. See example :ref:`ARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx`.
* AVI. See example :ref:`AVIMultiChannelRAndGAndNIRVegetationIndexImageFilter.cxx`.
......
......@@ -23,7 +23,6 @@ majority) are optional and can be activated or not during the build
process:
.. table:: External libraries used in OTB
:widths: 50 20 30
:align: center
+------------------------------------------------------------------+-----------------------+--------------------------+
......
......@@ -111,37 +111,62 @@ The *RadiometricIndices* application has the following input parameters:
(default value is 1)
-``-list`` the list of available radiometric indices (default value is
Vegetation:NDVI)
``Vegetation:NDVI``)
The available radiometric indices to be listed into -list with their
relevant channels in brackets are:
Note that band numbering starts at 1.
::
The available radiometric indices to be listed into ``-list`` with their
relevant channels in brackets are:
Vegetation:NDVI - Normalized difference vegetation index (Red, NIR)
Vegetation:TNDVI - Transformed normalized difference vegetation index (Red, NIR)
Vegetation:RVI - Ratio vegetation index (Red, NIR)
Vegetation:SAVI - Soil adjusted vegetation index (Red, NIR)
Vegetation:TSAVI - Transformed soil adjusted vegetation index (Red, NIR)
Vegetation:MSAVI - Modified soil adjusted vegetation index (Red, NIR)
Vegetation:MSAVI2 - Modified soil adjusted vegetation index 2 (Red, NIR)
Vegetation:GEMI - Global environment monitoring index (Red, NIR)
Vegetation:IPVI - Infrared percentage vegetation index (Red, NIR)
Water:NDWI - Normalized difference water index (Gao 1996) (NIR, MIR)
Water:NDWI2 - Normalized difference water index (Mc Feeters 1996) (Green, NIR)
Water:MNDWI - Modified normalized difference water index (Xu 2006) (Green, MIR)
Water:NDPI - Normalized difference pond index (Lacaux et al.) (MIR, Green)
Water:NDTI - Normalized difference turbidity index (Lacaux et al.) (Red, Green)
Soil:RI - Redness index (Red, Green)
Soil:CI - Color index (Red, Green)
Soil:BI - Brightness index (Red, Green)
Soil:BI2 - Brightness index 2 (NIR, Red, Green)
+------------------------------+----------------------------------------------------------+---------------+
|Index |Description |Required bands |
+==============================+==========================================================+===============+
|Vegetation:NDVI |Normalized difference vegetation index |Red, NIR |
+------------------------------+----------------------------------------------------------+---------------+
|Vegetation:TNDVI |Transformed normalized difference vegetation index |Red, NIR |
+------------------------------+----------------------------------------------------------+---------------+
|Vegetation:RVI |Ratio vegetation index |Red, NIR |
+------------------------------+----------------------------------------------------------+---------------+
|Vegetation:SAVI |Soil adjusted vegetation index |Red, NIR |
+------------------------------+----------------------------------------------------------+---------------+
|Vegetation:TSAVI |Transformed soil adjusted vegetation index |Red, NIR |
+------------------------------+----------------------------------------------------------+---------------+
|Vegetation:MSAVI |Modified soil adjusted vegetation index |Red, NIR |
+------------------------------+----------------------------------------------------------+---------------+
|Vegetation:MSAVI2 |Modified soil adjusted vegetation index 2 |Red, NIR |
+------------------------------+----------------------------------------------------------+---------------+
|Vegetation:GEMI |Global environment monitoring index |Red, NIR |
+------------------------------+----------------------------------------------------------+---------------+
|Vegetation:IPVI |Infrared percentage vegetation index |Red, NIR |
+------------------------------+----------------------------------------------------------+---------------+
|Vegetation:LAIFromNDVILog |Leaf Area Index from log NDVI |Red, NIR |
+------------------------------+----------------------------------------------------------+---------------+
|Vegetation::LAIFromReflLinear |Leaf Area Index from reflectances with linear combination |Red, NIR |
+------------------------------+----------------------------------------------------------+---------------+
|Vegetation::LAIFromNDVIFormo |Leaf Area Index from Formosat 2 TOC |Red, NIR |
+------------------------------+----------------------------------------------------------+---------------+
|Water:NDWI |Normalized difference water index (Gao 1996) |NIR, MIR |
+------------------------------+----------------------------------------------------------+---------------+
|Water:NDWI2 |Normalized difference water index (Mc Feeters 1996) |Green, NIR |
+------------------------------+----------------------------------------------------------+---------------+
|Water:MNDWI |Modified normalized difference water index (Xu 2006) |Green, MIR |
+------------------------------+----------------------------------------------------------+---------------+
|Water:NDTI |Normalized difference turbidity index (Lacaux et al.) |Green, Red |
+------------------------------+----------------------------------------------------------+---------------+
|Soil:RI |Redness index |Green, Red |
+------------------------------+----------------------------------------------------------+---------------+
|Soil:CI |Color index |Green, Red |
+------------------------------+----------------------------------------------------------+---------------+
|Soil:BI |Brightness index |Green, Red |
+------------------------------+----------------------------------------------------------+---------------+
|Soil:BI2 |Brightness index 2 |Green, Red, NIR|
+------------------------------+----------------------------------------------------------+---------------+
|BuiltUp:ISU |Built Surfaces Index |Red, NIR |
+------------------------------+----------------------------------------------------------+---------------+
The application can be used as follows, which would produce an output image
containing 3 bands, respectively with the Vegetation:NDVI, Vegetation:RVI and
Vegetation:IPVI radiometric indices in this exact order:
containing 3 bands, respectively with the ``Vegetation:NDVI``, ``Vegetation:RVI`` and
``Vegetation:IPVI`` radiometric indices in this exact order:
::
......@@ -154,7 +179,7 @@ Vegetation:IPVI radiometric indices in this exact order:
Vegetation:IPVI
or as follows, which would produce a single band output image with the
Water:NDWI2 radiometric index:
``Water:NDWI2`` radiometric index:
::
......
......@@ -107,7 +107,7 @@ int main(int argc, char* argv[])
typedef otb::BandsStatisticsAttributesLabelMapFilter<LabelMapType, VectorImageType> RadiometricLabelMapFilterType;
typedef otb::AttributesMapOpeningLabelMapFilter<LabelMapType> OpeningLabelMapFilterType;
typedef itk::LabelMapToBinaryImageFilter<LabelMapType, MaskImageType> LabelMapToBinaryImageFilterType;
typedef itk::UnaryFunctorImageFilter<VectorImageType, ImageType,otb::Functor::NDVI<PixelType,PixelType,PixelType> > NDVIImageFilterType;
typedef itk::UnaryFunctorImageFilter<VectorImageType, ImageType, otb::Functor::NDVI<PixelType, PixelType>> NDVIImageFilterType;
typedef otb::ImageToVectorImageCastFilter<ImageType, VectorImageType> ImageToVectorImageCastFilterType;
ReaderType::Pointer reader = ReaderType::New();
......@@ -166,8 +166,8 @@ int main(int argc, char* argv[])
// In our case, statistics are computed on the NDVI coefficient on each label object.
NDVIImageFilterType::Pointer ndviImageFilter = NDVIImageFilterType::New();
ndviImageFilter->GetFunctor().SetRedIndex(3);
ndviImageFilter->GetFunctor().SetNIRIndex(4);
ndviImageFilter->GetFunctor().SetBandIndex(CommonBandNames::RED, 3);
ndviImageFilter->GetFunctor().SetBandIndex(CommonBandNames::NIR, 4);
ndviImageFilter->SetInput(vreader->GetOutput());
ImageToVectorImageCastFilterType::Pointer ndviVectorImageFilter = ImageToVectorImageCastFilterType::New();
......
......@@ -26,8 +26,7 @@
Output/pretty_ARVIMultiChannelRAndBAndNIRVegetationIndex.png \
1 \
3 \
2 \
0.6
2
*/
......@@ -87,11 +86,11 @@
int main(int argc, char* argv[])
{
if (argc < 8)
if (argc < 7)
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " inputImage , outputImage , prettyInput , prettyOutput , redChannel , blueChannel , nirChannel , gama" << std::endl;
std::cerr << " inputImage , outputImage , prettyInput , prettyOutput , redChannel , blueChannel , nirChannel" << std::endl;
return 1;
}
......@@ -114,7 +113,7 @@ int main(int argc, char* argv[])
// Note that we also can use other functors which operate with the
// Red, Blue and Nir channels such as EVI, ARVI and TSARVI.
typedef otb::Functor::ARVI<InputPixelType, InputPixelType, InputPixelType, OutputPixelType> FunctorType;
typedef otb::Functor::ARVI<InputPixelType, OutputPixelType> FunctorType;
// The
// \doxygen{itk}{UnaryFunctorImageFilter}
......@@ -134,17 +133,9 @@ int main(int argc, char* argv[])
writer->SetFileName(argv[2]);
// The three used index bands (red, blue and NIR) are declared.
filter->GetFunctor().SetRedIndex(::atoi(argv[5]));
filter->GetFunctor().SetBlueIndex(::atoi(argv[6]));
filter->GetFunctor().SetNIRIndex(::atoi(argv[7]));
// The $\gamma$ parameter is set. The
// \doxygen{otb::Functor}{ARVI}
// class sets the default value of $\gamma$ to $0.5$. This parameter
// is used to reduce the atmospheric effect on a global scale.
filter->GetFunctor().SetGamma(::atof(argv[8]));
filter->GetFunctor().SetBandIndex(CommonBandNames::RED, ::atoi(argv[5]));
filter->GetFunctor().SetBandIndex(CommonBandNames::BLUE, ::atoi(argv[6]));
filter->GetFunctor().SetBandIndex(CommonBandNames::NIR, ::atoi(argv[7]));
// The filter input is linked to the reader output and
// the filter output is linked to the writer input.
......
......@@ -26,10 +26,7 @@
Output/pretty_AVIMultiChannelRAndGAndNIRVegetationIndex.png \
3 \
2 \
4 \
660 \
560 \
830
4
*/
......@@ -76,12 +73,11 @@
int main(int argc, char* argv[])
{
if (argc < 11)
if (argc < 8)
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " inputImage , outputImage , prettyInput , prettyOutput , redChannel , greenChannel , nirChannel ,";
std::cerr << " lambdaR, lambdaG, lambdaNIR " << std::endl;
std::cerr << " inputImage , outputImage , prettyInput , prettyOutput , redChannel , greenChannel , nirChannel ," << std::endl;
return 1;
}
......@@ -102,7 +98,7 @@ int main(int argc, char* argv[])
// The AVI (Angular Vegetation Index) is
// instantiated using the image pixel types as template parameters.
typedef otb::Functor::AVI<InputPixelType, InputPixelType, InputPixelType, OutputPixelType> FunctorType;
typedef otb::Functor::AVI<InputPixelType, OutputPixelType> FunctorType;
// The
// \doxygen{itk}{UnaryFunctorImageFilter}
......@@ -123,18 +119,9 @@ int main(int argc, char* argv[])
// The three used index bands (red, green and NIR) are declared.
filter->GetFunctor().SetRedIndex(::atoi(argv[5]));
filter->GetFunctor().SetGreenIndex(::atoi(argv[6]));
filter->GetFunctor().SetNIRIndex(::atoi(argv[7]));
// The $\lambda$ R, G and NIR parameters are set. The
// \doxygen{otb::Functor}{AVI}
// class sets the default values of $\lambda$ to $660$, $560$ and
// $830$.
filter->GetFunctor().SetLambdaR(::atof(argv[8]));
filter->GetFunctor().SetLambdaG(::atof(argv[9]));
filter->GetFunctor().SetLambdaNir(::atof(argv[10]));
filter->GetFunctor().SetBandIndex(CommonBandNames::RED, ::atoi(argv[5]));
filter->GetFunctor().SetBandIndex(CommonBandNames::GREEN, ::atoi(argv[6]));
filter->GetFunctor().SetBandIndex(CommonBandNames::NIR, ::atoi(argv[7]));
// The filter input is linked to the reader output and
// the filter output is linked to the writer input.
......
......@@ -32,10 +32,6 @@ endif()
add_executable(AVIMultiChannelRAndGAndNIRVegetationIndexImageFilter AVIMultiChannelRAndGAndNIRVegetationIndexImageFilter.cxx)
target_link_libraries(AVIMultiChannelRAndGAndNIRVegetationIndexImageFilter ${OTB_LIBRARIES})
add_executable(NDVIRAndNIRVegetationIndexImageFilter NDVIRAndNIRVegetationIndexImageFilter.cxx)
target_link_libraries(NDVIRAndNIRVegetationIndexImageFilter ${OTB_LIBRARIES})
if(BUILD_TESTING)
add_subdirectory(test)
endif()
/*
* Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Example usage:
./NDVIRAndNIRVegetationIndexImageFilter Input/NDVI_2.hdr \
Input/NDVI_3.hdr \
Output/NDVIRAndNIRVegetationIndex.tif \
Output/pretty_Red.png \
Output/pretty_NIR.png \
Output/pretty_NDVIRAndNIRVegetationIndex.png
*/
// \index{otb::VegetationIndicesFunctor}
// \index{otb::VegetationIndicesFunctor!header}
//
// The following example illustrates the use of the
// \doxygen{itk}{BinaryFunctorImageFilter} with the use of the Normalized
// Difference Vegatation Index (NDVI).
// NDVI computes the difference between the NIR channel, noted $L_{NIR}$, and the red channel,
// noted $L_{r}$ radiances reflected from the surface and transmitted through the atmosphere:
//
// \begin{equation}
// \mathbf{NDVI} = \frac{L_{NIR}-L_{r}}{L_{NIR}+L_{r}}
// \end{equation}
//
// \relatedClasses
// \begin{itemize}
// \item \subdoxygen{otb}{Functor}{RVI}
// \item \subdoxygen{otb}{Functor}{PVI}
// \item \subdoxygen{otb}{Functor}{SAVI}
// \item \subdoxygen{otb}{Functor}{TSAVI}
// \item \subdoxygen{otb}{Functor}{MSAVI}
// \item \subdoxygen{otb}{Functor}{GEMI}
// \item \subdoxygen{otb}{Functor}{WDVI}
// \item \subdoxygen{otb}{Functor}{IPVI}
// \item \subdoxygen{otb}{Functor}{TNDVI}
// \end{itemize}
//
// Let's look at the minimal code required to use this algorithm.
#include "itkMacro.h"
#include "otbImage.h"
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "itkBinaryFunctorImageFilter.h"
#include "otbVegetationIndicesFunctor.h"
#include "itkRescaleIntensityImageFilter.h"
int main(int argc, char* argv[])
{
if (argc < 6)
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " inputImage1 , inputImage2 , outputImage , prettyinputImage1 , prettyinputImage2 , prettyOutput" << std::endl;
return 1;
}
// The image types are now defined using pixel types the
// dimension. Input and output images are defined as \doxygen{otb}{Image}.
const unsigned int Dimension = 2;
typedef double InputPixelType;
typedef float OutputPixelType;
typedef otb::Image<InputPixelType, Dimension> InputRImageType;
typedef otb::Image<InputPixelType, Dimension> InputNIRImageType;
typedef otb::Image<OutputPixelType, Dimension> OutputImageType;
// We instantiate reader and writer types
typedef otb::ImageFileReader<InputRImageType> RReaderType;
typedef otb::ImageFileReader<InputNIRImageType> NIRReaderType;
typedef otb::ImageFileWriter<OutputImageType> WriterType;
// The NDVI (Normalized Difference Vegetation Index) is instantiated using
// the images pixel type as template parameters. It is
// implemented as a functor class which will be passed as a
// parameter to an \doxygen{itk}{BinaryFunctorImageFilter}.
typedef otb::Functor::NDVI<InputPixelType, InputPixelType, OutputPixelType> FunctorType;
// The \doxygen{itk}{BinaryFunctorImageFilter} type is instantiated using the images
// types and the NDVI functor as template parameters.
typedef itk::BinaryFunctorImageFilter<InputRImageType, InputNIRImageType, OutputImageType, FunctorType> NDVIImageFilterType;
// Instantiating object
NDVIImageFilterType::Pointer filter = NDVIImageFilterType::New();
RReaderType::Pointer readerR = RReaderType::New();
NIRReaderType::Pointer readerNIR = NIRReaderType::New();
WriterType::Pointer writer = WriterType::New();
// Now the input images are set and a name is given to the output image.
readerR->SetFileName(argv[1]);
readerNIR->SetFileName(argv[2]);
writer->SetFileName(argv[3]);
// We set the processing pipeline: filter inputs are linked to
// the reader output and the filter output is linked to the writer
// input.
filter->SetInput1(readerR->GetOutput());
filter->SetInput2(readerNIR->GetOutput());
writer->SetInput(filter->GetOutput());
// Invocation of the \code{Update()} method on the writer triggers the
// execution of the pipeline. It is recommended to place \code{update()} calls in a
// \code{try/catch} block in case errors occur and exceptions are thrown.
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;
}
// Pretty image creation for the printing
typedef otb::Image<unsigned char, Dimension> OutputPrettyImageType;
typedef otb::ImageFileWriter<OutputPrettyImageType> WriterPrettyType;
typedef itk::RescaleIntensityImageFilter<OutputImageType, OutputPrettyImageType> RescalerType;
typedef itk::RescaleIntensityImageFilter<InputRImageType, OutputPrettyImageType> RescalerRType;
typedef itk::RescaleIntensityImageFilter<InputNIRImageType, OutputPrettyImageType> RescalerNIRType;
RescalerType::Pointer rescaler = RescalerType::New();
WriterPrettyType::Pointer prettyWriter = WriterPrettyType::New();
rescaler->SetInput(filter->GetOutput());
rescaler->SetOutputMinimum(0);
rescaler->SetOutputMaximum(255);
prettyWriter->SetFileName(argv[6]);
prettyWriter->SetInput(rescaler->GetOutput());
RescalerRType::Pointer rescalerR = RescalerRType::New();
RescalerNIRType::Pointer rescalerNIR = RescalerNIRType::New();
WriterPrettyType::Pointer prettyWriterR = WriterPrettyType::New();
WriterPrettyType::Pointer prettyWriterNIR = WriterPrettyType::New();
rescalerR->SetInput(readerR->GetOutput());
rescalerR->SetOutputMinimum(0);
rescalerR->SetOutputMaximum(255);
prettyWriterR->SetFileName(argv[4]);
prettyWriterR->SetInput(rescalerR->GetOutput());
rescalerNIR->SetInput(readerNIR->GetOutput());
rescalerNIR->SetOutputMinimum(0);
rescalerNIR->SetOutputMaximum(255);
prettyWriterNIR->SetFileName(argv[5]);
prettyWriterNIR->SetInput(rescalerNIR->GetOutput());
try
{
prettyWriter->Update();
prettyWriterNIR->Update();
prettyWriterR->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;
}
// Let's now run this example using as input the images
// \code{NDVI\_3.hdr} and \code{NDVI\_4.hdr} (images kindly and free of charge given by SISA and CNES)
// provided in the directory \code{Examples/Data}.
//
//
// \begin{figure} \center
// \includegraphics[width=0.24\textwidth]{pretty_Red.eps}
// \includegraphics[width=0.24\textwidth]{pretty_NIR.eps}
// \includegraphics[width=0.24\textwidth]{pretty_NDVIRAndNIRVegetationIndex.eps}
// \itkcaption[ARVI Example]{NDVI input images on the left (Red channel and NIR channel), on the right the result of the algorithm.}
// \label{fig:NDVIRAndNIRIndex}
// \end{figure}
return EXIT_SUCCESS;
}
......@@ -35,7 +35,6 @@ otb_add_test(NAME raTeARVIMultiChannelRAndBAndNIRVegetationIndexImageFilterTest
1
2
3
0.6 # Gamma parameter
)
# ------- AVIMultiChannelRAndGAndNIRVegetationIndexImageFilterTest ------------------------------
......@@ -52,24 +51,6 @@ otb_add_test(NAME raTeAVIMultiChannelRAndGAndNIRVegetationIndexImageFilterTest C
3
2
4 # indices of the channels
660.
560.
830. # lambdaR, lambdaG, lambdaNir
)
# ------- NDVIRAndNIRVegetationIndexImageFilter ------------------------------
otb_add_test(NAME raTeNDVIRAndNIRVegetationIndexImageFilterTest COMMAND ${OTB_TEST_DRIVER}
--compare-image ${NOTOL}
${BASELINE}/NDVIRAndNIRVegetationIndex.tif
${TEMP}/NDVIRAndNIRVegetationIndex.tif
Execute $<TARGET_FILE:NDVIRAndNIRVegetationIndexImageFilter>
${INPUTDATA}/poupees_sub_c1.png
${INPUTDATA}/poupees_sub_c2.png
${TEMP}/NDVIRAndNIRVegetationIndex.tif
${TEMP}/NDVIRAndNIRVegetationIndex2.tif
${TEMP}/NDVIRAndNIRVegetationIndex3.tif
${TEMP}/NDVIRAndNIRVegetationIndex4.tif
)
if(OTBOpticalCalibration_LOADED)
......@@ -103,4 +84,4 @@ otb_add_test(NAME raTeAtmosphericCorrectionSequencementTest COMMAND ${OTB_TEST_D
2 # Radius;
0.020 # pixel spacing in kilometers
)
endif()
\ No newline at end of file
endif()
......@@ -64,8 +64,7 @@ int main(int argc, char* argv[])
// Filter type is a generic \doxygen{itk}{UnaryFunctorImageFilter} using Formosat2 specific LAI
// \doxygen{otb}{LAIFromNDVIFormosat2Functor}.
typedef otb::Functor::LAIFromNDVIFormosat2Functor<InputImageType::InternalPixelType, InputImageType::InternalPixelType, OutputImageType::PixelType>
FunctorType;
typedef otb::Functor::LAIFromNDVIFormosat2Functor<InputImageType::InternalPixelType, OutputImageType::PixelType> FunctorType;
typedef itk::UnaryFunctorImageFilter<InputImageType, OutputImageType, FunctorType> LAIFRomNDVIImageFilterType;
// Instantiating object
......@@ -96,8 +95,8 @@ int main(int argc, char* argv[])
//
unsigned int redChannel = static_cast<unsigned int>(atoi(argv[5]));
unsigned int nirChannel = static_cast<unsigned int>(atoi(argv[6]));
filter->GetFunctor().SetRedIndex(redChannel);
filter->GetFunctor().SetNIRIndex(nirChannel);
filter->GetFunctor().SetBandIndex(CommonBandNames::RED, redChannel);
filter->GetFunctor().SetBandIndex(CommonBandNames::NIR, nirChannel);
// The invocation of the \code{Update()} method triggers the
// execution of the pipeline.
......
......@@ -24,7 +24,7 @@ otb_module(OTBAppIndices
DEPENDS
OTBIndices
OTBApplicationEngine
OTBObjectList
OTBFunctor
TEST_DEPENDS
OTBTestKernel
OTBCommandLine
......
......@@ -51,19 +51,25 @@ template<class TInput, class TOutput = double>
class RadiometricNonWaterNonVegetationIndexFunctor
{
public:
typedef Functor::NDVI<double, double, double> VegetationFunctorType;
typedef Functor::NDWI2<double, double, double> WaterFunctorType;
typedef Functor::NDVI<double, double> VegetationFunctorType;
typedef Functor::NDWI2<double, double> WaterFunctorType;
typedef TOutput ValueType;
VegetationFunctorType GetVegetationFunctor(){ return m_VegetationFunctor; }
WaterFunctorType GetWaterFunctor(){ return m_WaterFunctor; }
void SetRedIndex(int id){ m_VegetationFunctor.SetRedIndex(id); }
void SetGreenIndex(int id){ m_WaterFunctor.SetGIndex(id); }
void SetRedIndex(int id)
{
m_VegetationFunctor.SetBandIndex(CommonBandNames::RED, id);
}
void SetGreenIndex(int id)
{
m_WaterFunctor.SetBandIndex(CommonBandNames::GREEN, id);
}
void SetNIRIndex(int id)
{
m_VegetationFunctor.SetNIRIndex(id);
m_WaterFunctor.SetNIRIndex(id);
m_VegetationFunctor.SetBandIndex(CommonBandNames::NIR, id);
m_WaterFunctor.SetBandIndex(CommonBandNames::NIR, id);
}
RadiometricNonWaterNonVegetationIndexFunctor(){}
......
......@@ -188,6 +188,16 @@ RAPIDEYE/level1B/2008-12-25T005918_RE3_1B-NAC_397971_12345_band3.ntf
SENTINEL1/S1A_S6_SLC__1SSV_20150619T195043/measurement/s1a-s6-slc-vv-20150619t195043-20150619t195101-006447-00887d-001.tiff
)
set(TOLERANCE_RATIO
0
0
0
0
0
0
0.0002
)
set(IMG_TYPE
"pleiades-1"
"wv2-1"
......@@ -303,6 +313,8 @@ foreach(current_img ${IMG_TEST_ORTHO})
list(GET RESOL ${IMGNB} current_resol )
list(GET GRIDSPACING ${IMGNB} current_grid_spacing)
list(GET ISCOMPLEX ${IMGNB} current_is_compex)
list(GET TOLERANCE_RATIO ${IMGNB} current_tolerance_ratio)
math(EXPR IMGNB "${IMGNB} + 1")
set( MODENB 0)
......@@ -313,6 +325,7 @@ foreach(current_img ${IMG_TEST_ORTHO})
otb_add_test(NAME prTvOrthoRectification_${current_imgtype}_${current_mode} COMMAND otbProjectionTestDriver
--compare-image ${EPSILON_4} ${BASELINE}/prTvOrthoRectification_${current_imgtype}_${current_mode}.tif
${TEMP}/prTvOrthoRectification_${current_imgtype}_${current_mode}.tif
--tolerance-ratio ${current_tolerance_ratio}
otbOrthoRectificationFilter
LARGEINPUT{${current_img}?&geom=${INPUTDATA}/${current_geomgcp}.geom}
${TEMP}/prTvOrthoRectification_${current_imgtype}_${current_mode}.tif
......
......@@ -27,11 +27,30 @@ namespace BandName
{
/**
* Provides a way to identify bands when passing the parameters
* to the radiometric functors.*
*/
enum BandName {BLUE, GREEN, RED, NIR, MIR};
enum LandsatTMBandNames {TM1, TM2, TM3, TM4, TM5, TM60, TM61, TM62, TM7};
* Provides a way to identify bands when passing the parameters
* to the radiometric functors.*
*/
enum class CommonBandNames
{
BLUE,
GREEN,
RED,
NIR,
MIR,
MAX
};
enum LandsatTMBandNames
{
TM1,
TM2,
TM3,
TM4,
TM5,
TM60,
TM61,
TM62,
TM7
};
// Note for landsat equivalence
// http://landsat.gsfc.nasa.gov/news/news-archive/sci_0017.html
......@@ -57,8 +76,8 @@ enum LandsatTMBandNames {TM1, TM2, TM3, TM4, TM5, TM60, TM61, TM62, TM7};
// 6 10.40-12.50 microm Thermal IR
// 7 2.08-2.35 microm Mid-IR
}
} // namespace BandName
}
} // namespace otb
#endif
......@@ -21,161 +21,12 @@
#ifndef otbBuiltUpIndicesFunctor_h
#define otbBuiltUpIndicesFunctor_h
#include "otbVegetationIndicesFunctor.h"
#include <string>
#include "otbRadiometricIndex.h"
namespace otb
{
namespace Functor