21 #ifndef otbSoilIndicesFunctor_h
22 #define otbSoilIndicesFunctor_h
45 template <
class TInput,
class TOutput>
53 TOutput
operator()(
const itk::VariableLengthVector<TInput>& input)
const override
55 auto green = this->
Value(CommonBandNames::GREEN, input);
56 auto red = this->
Value(CommonBandNames::RED, input);
60 return static_cast<TOutput
>(0.);
63 return static_cast<TOutput
>(red * red / (green * green * green));
81 template <
class TInput,
class TOutput>
89 TOutput
operator()(
const itk::VariableLengthVector<TInput>& input)
const override
91 auto green = this->
Value(CommonBandNames::GREEN, input);
92 auto red = this->
Value(CommonBandNames::RED, input);
96 return static_cast<TOutput
>(0.);
99 return (
static_cast<TOutput
>((red - green) / (red + green)));
113 template <
class TInput,
class TOutput>
121 TOutput
operator()(
const itk::VariableLengthVector<TInput>& input)
const override
123 auto green = this->
Value(CommonBandNames::GREEN, input);
124 auto red = this->
Value(CommonBandNames::RED, input);
126 return (
static_cast<TOutput
>(std::sqrt((red * red + green * green) / 2.)));
140 template <
class TInput,
class TOutput>
144 BI2() :
RadiometricIndex<TInput, TOutput>({CommonBandNames::RED, CommonBandNames::GREEN, CommonBandNames::NIR})
148 TOutput
operator()(
const itk::VariableLengthVector<TInput>& input)
const override
150 auto green = this->
Value(CommonBandNames::GREEN, input);
151 auto red = this->
Value(CommonBandNames::RED, input);
152 auto nir = this->
Value(CommonBandNames::NIR, input);
154 return (
static_cast<TOutput
>(std::sqrt((red * red + green * green + nir * nir) / 3.)));