diff --git a/Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx b/Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx index 4c89da6e583a17af53c7494811f5aeb3126bafd7..b08bf30a92a395cabaf7e707520541010b4450b5 100644 --- a/Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx +++ b/Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx @@ -122,7 +122,6 @@ private: "* Water:NDWI - Normalized difference water index (Gao 1996) (NIR, MIR)\n" "* Water:NDWI2 - Normalized difference water index (Mc Feeters 1996) (Green, NIR)\n" "* Water:MNDWI - Modified normalized difference water index (Xu 2006) (Green, MIR)\n" - "* Water:NDPI - Normalized difference pond index (Lacaux et al.) (MIR, Green)\n" "* Water:NDTI - Normalized difference turbidity index (Lacaux et al.) (Red, Green)\n" "* Soil:RI - Redness index (Red, Green)\n" "* Soil:CI - Color index (Red, Green)\n" @@ -155,8 +154,7 @@ private: m_Map.push_back({"list.ndwi","Water:NDWI",new otb::Functor::NDWI<InputType,OutputType>()}); m_Map.push_back({"list.ndwi2","Water:NDWI2",new otb::Functor::NDWI2<InputType,OutputType>()}); m_Map.push_back({"list.mndwi","Water:MNDWI",new otb::Functor::MNDWI<InputType,OutputType>()}); - m_Map.push_back({"list.ndpi","Water:NDPI",new otb::Functor::NDPI<InputType,OutputType>()}); - m_Map.push_back({"list.ndpi","Water:NDTI",new otb::Functor::NDTI<InputType,OutputType>()}); + m_Map.push_back({"list.ndti","Water:NDTI",new otb::Functor::NDTI<InputType,OutputType>()}); m_Map.push_back({"list.si","Soil:RI",new otb::Functor::RI<InputType,OutputType>()}); m_Map.push_back({"list.ci","Soil:CI",new otb::Functor::CI<InputType,OutputType>()}); m_Map.push_back({"list.bi","Soil:BI",new otb::Functor::BI<InputType,OutputType>()}); diff --git a/Modules/Radiometry/Indices/include/otbBandName.h b/Modules/Radiometry/Indices/include/otbBandName.h index cecd2312b4f45805645cee1656eb5e9eb709d1a9..9be686fe3f72fb302dfd0d2b1b0156ba6f6f4da6 100644 --- a/Modules/Radiometry/Indices/include/otbBandName.h +++ b/Modules/Radiometry/Indices/include/otbBandName.h @@ -31,7 +31,6 @@ namespace BandName * to the radiometric functors.* */ enum class CommonBandNames {BLUE, GREEN, RED, NIR, MIR, MAX}; -enum class ModisBandNames {M860, M1240,MAX}; enum LandsatTMBandNames {TM1, TM2, TM3, TM4, TM5, TM60, TM61, TM62, TM7, MAX}; // Note for landsat equivalence diff --git a/Modules/Radiometry/Indices/include/otbBuiltUpIndicesFunctor.h b/Modules/Radiometry/Indices/include/otbBuiltUpIndicesFunctor.h index 5fd29a5756c7a9e8d2ba241351ab1985ed2a3316..b2a6ae8eb7c40f623bbd5709e04897affe061241 100644 --- a/Modules/Radiometry/Indices/include/otbBuiltUpIndicesFunctor.h +++ b/Modules/Radiometry/Indices/include/otbBuiltUpIndicesFunctor.h @@ -27,39 +27,6 @@ namespace otb { namespace Functor { -/** \class NDBI - * \brief This functor computes the Normalized Difference Built Up Index (NDBI) - * Band mapping with respect to paper: - * TM4 = red - * TM5 = nir - * [Zha 2003] - * - * \ingroup Functor - * \ingroup Radiometry - * - * \ingroup OTBIndices - */ -template <class TInput, class TOutput> -class NDBI : public RadiometricIndice<TInput,TOutput> -{ -public: - NDBI() : RadiometricIndice<TInput,TOutput>({CommonBandNames::RED, CommonBandNames::NIR}) {} - - TOutput operator()(const itk::VariableLengthVector<TInput> & input) const override - { - auto red = this->Value(CommonBandNames::RED,input); - auto nir = this->Value(CommonBandNames::NIR,input); - - if (std::abs(red+nir) < RadiometricIndice<TInput,TOutput>::Epsilon) - { - return static_cast<TOutput>(0.); - } - - // TODO: Completely equivalent to NDVI ? - return (static_cast<TOutput>((nir - red) / (nir + red))); - } -}; - /** \class ISU * \brief This functor computes the Index surfaces built (ISU) * diff --git a/Modules/Radiometry/Indices/include/otbVegetationIndicesFunctor.h b/Modules/Radiometry/Indices/include/otbVegetationIndicesFunctor.h index fb7308b52c5490221f044584b3e4569a10b3ec56..3e7fc70ddeb5686cbfe4ae50fb06f7990bf443b5 100644 --- a/Modules/Radiometry/Indices/include/otbVegetationIndicesFunctor.h +++ b/Modules/Radiometry/Indices/include/otbVegetationIndicesFunctor.h @@ -451,49 +451,6 @@ public: static constexpr double Gamma = 0.5; }; -/** \class TSARVI - * \brief This functor computes the Transformed Soil Atmospherical Resistant Vegetation Index (TSARVI) - * - * [Yoram J. Kaufman and Didier Tanre, 1992] - * - * \ingroup Functor - * \ingroup Radiometry - * - * \ingroup OTBIndices - */ -// TODO: Default parameter of this indice always return 0 -template <class TInput,class TOutput> -class TSARVI : public RadiometricIndice<TInput,TOutput> -{ -public: - - TSARVI() : RadiometricIndice<TInput,TOutput>({CommonBandNames::BLUE, CommonBandNames::RED, CommonBandNames::NIR}) {} - - TOutput operator()(const itk::VariableLengthVector<TInput> & input) const override - { - auto blue = this->Value(CommonBandNames::BLUE,input); - auto red = this->Value(CommonBandNames::RED,input); - auto nir = this->Value(CommonBandNames::NIR,input); - - double dRB = red - Gamma * (blue - red); - double denominator = dRB + A * nir - A * B + X * (1. + A * A); - if (std::abs(denominator) < RadiometricIndice<TInput,TOutput>::Epsilon) - { - return static_cast<TOutput>(0.); - } - return (static_cast<TOutput>((A * (nir - A * dRB - B)) / denominator)); - } - - /** A and B parameters */ - static constexpr double A = 0.0; - static constexpr double B = 0.0; - /** X parameter */ - static constexpr double X = 0.08; - /** Gamma parameter */ - static constexpr double Gamma = 0.5; - -}; - /** \class EVI * \brief This functor computes the Enhanced Vegetation Index (EVI) * diff --git a/Modules/Radiometry/Indices/include/otbWaterIndicesFunctor.h b/Modules/Radiometry/Indices/include/otbWaterIndicesFunctor.h index 7d94f9525014eacef5dabd5475b46dcb56e60bcb..e16dca15fac2414d43aae59205bbeb953cd31a2e 100644 --- a/Modules/Radiometry/Indices/include/otbWaterIndicesFunctor.h +++ b/Modules/Radiometry/Indices/include/otbWaterIndicesFunctor.h @@ -28,37 +28,6 @@ namespace otb { namespace Functor { - -/** \class SRWI - * \brief This functor computes the Simple Ratio Water Index (SRWI) - * \brief For MODIS bands 860 & 1240 - * - * [Zarco-Tejada 2001] - * - * \ingroup Functor - * \ingroup Radiometry - * - * \ingroup OTBIndices - */ -template <class TInput, class TOutput> -class SRWI : public RadiometricIndice<TInput,TOutput,ModisBandNames> -{ -public: - - SRWI() : RadiometricIndice<TInput,TOutput>({ModisBandNames::M860, ModisBandNames::M1240}) {} - - TOutput operator()(const itk::VariableLengthVector<TInput> & input) const override - { - double rho860 = this->Value(ModisBandNames::M860,input); - double rho1240 = this->Value(ModisBandNames::M1240,input); - if (std::abs(rho1240) < RadiometricIndice<TInput,TOutput>::Epsilon) - { - return static_cast<TOutput>(0.); - } - return (static_cast<TOutput>(rho860 / rho1240)); - } -}; - /** \class NDWI * \brief This functor computes the Normalized Difference Water Index (NDWI) * \brief Also called : @@ -130,6 +99,10 @@ public: * * [Xu & al., 2006 ] * + * Similar to Normalized Difference Pond Index (NDPI) + * + * [J.P Lacaux & al., 2006 ] + * * \ingroup Functor * \ingroup Radiometry * @@ -155,36 +128,6 @@ public: } }; -/** \class NDPI - * \brief This functor computes the Normalized Difference Pond Index (NDPI) - * - * [J.P Lacaux & al., 2006 ] - * - * \ingroup Functor - * \ingroup Radiometry - * - * \ingroup OTBIndices - */ -template <class TInput, class TOutput> -class NDPI : public RadiometricIndice<TInput,TOutput> -{ -public: - NDPI() : RadiometricIndice<TInput,TOutput>({CommonBandNames::MIR, CommonBandNames::GREEN}) {} - - TOutput operator()(const itk::VariableLengthVector<TInput> & input) const override - { - auto green = this->Value(CommonBandNames::GREEN,input); - auto mir = this->Value(CommonBandNames::MIR,input); - - if (std::abs(mir + green) < RadiometricIndice<TInput,TOutput>::Epsilon) - { - return 0.; - } - // TODO: Completely equivalent to MNDWI ? - return (mir -green) / (green + mir); - } -}; - /** \class NDTI * \brief This functor computes the Normalized Difference Turbidity Index (NDTI) * diff --git a/Modules/Radiometry/Indices/test/otbRadiometricIndicesTest.cxx b/Modules/Radiometry/Indices/test/otbRadiometricIndicesTest.cxx index fb463c4e97249d5869f19721242f452194a4623a..8465614c4725d4e70d7e0c1fb679a42409f12fb3 100644 --- a/Modules/Radiometry/Indices/test/otbRadiometricIndicesTest.cxx +++ b/Modules/Radiometry/Indices/test/otbRadiometricIndicesTest.cxx @@ -86,8 +86,6 @@ int otbVegetationIndicesTest(int, char**) res = res & CheckResult< GEMI<int,double> >("gemi_pixel",bandMap,{1,4,3,2},2.0625); res = res & CheckResult< AVI<int,double> >("avi_pixel",bandMap,{0,0,1,2},0.1017245527); res = res & CheckResult< ARVI<int,double> >("arvi_pixel",bandMap,{0,0,1,2},0.1428571429); - /// TODO: TSARVI always returns 0, remove it? - res = res & CheckResult< TSARVI<int,double> >("tsarvi_pixel",bandMap,{1,4,3,2},0.); res = res & CheckResult< EVI<int,double> >("evi_pixel",bandMap,{0,0,1,2},0.2777777778); res = res & CheckResult< IPVI<int,double> >("ipvi_pixel",bandMap,{0,0,1,2},0.6666666667); res = res & CheckResult< LAIFromNDVILogarithmic<int,double> >("lailog_pixel",bandMap,{0,0,1,2},0.4930511672); @@ -115,16 +113,9 @@ int otbWaterIndicesTest(int, char**) res = res & CheckResult< NDWI2<int,double> >("ndwi2_pixel",bandMap,{1,2,3,4,5},-0.3333333333); res = res & CheckResult< MNDWI<int,double> >("mndwi_null",bandMap,{0,0,0,0,0},0.); res = res & CheckResult< MNDWI<int,double> >("mndwi_pixel",bandMap,{1,2,3,4,5},-0.4285714286); - res = res & CheckResult< NDPI<int,double> >("ndpi_null",bandMap,{0,0,0,0,0},0.); - res = res & CheckResult< NDPI<int,double> >("ndpi_pixel",bandMap,{1,2,3,4,5},0.4285714286); res = res & CheckResult< NDTI<int,double> >("ndti_null",bandMap,{0,0,0,0,0},0.); res = res & CheckResult< NDTI<int,double> >("ndti_pixel",bandMap,{1,2,3,4,5},0.2); - const std::map<ModisBandNames,size_t> bandMapModis = {{ModisBandNames::M860,0},{ModisBandNames::M1240,1}}; - - res = res & CheckResult< NDWI2<int,double> >("srwi_null",bandMap,{0,0},0.5); - res = res & CheckResult< NDWI2<int,double> >("srwi_pixel",bandMap,{1,2},0.5); - if(res) { return EXIT_SUCCESS; @@ -160,9 +151,7 @@ int otbBuiltUpIndicesTest(int, char**) const std::map<CommonBandNames,size_t> bandMap = {{CommonBandNames::BLUE,0},{CommonBandNames::GREEN,1},{CommonBandNames::RED,2},{CommonBandNames::NIR,3}, {CommonBandNames::MIR,4}}; // Syntax: CheckResult<Indice Class>("test_name",bandMap,{red_value,nir_value},expected_result) - bool res = CheckResult< NDBI<int,double> >("ndbi_null ",bandMap,{0,0,0,0,0},0.); - res = res & CheckResult< NDBI<int,double> >("ndbi_pixel",bandMap,{1,2,3,4,5},0.1428571429); - res = res & CheckResult< ISU<int,double> >("isu_null",bandMap,{0,0,0,0,0},0.); + bool res = CheckResult< ISU<int,double> >("isu_null",bandMap,{0,0,0,0,0},0.); res = res & CheckResult< ISU<int,double> >("isu_pixel",bandMap,{1,2,3,4,5},81.25); if(res)