Commit d8e3bcc5 authored by Julien Michel's avatar Julien Michel

STY: clang-format-diff

parent 28a4725d
Pipeline #1113 passed with stages
in 56 minutes and 34 seconds
......@@ -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> > 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().SetBandIndex(CommonBandNames::RED,3);
ndviImageFilter->GetFunctor().SetBandIndex(CommonBandNames::NIR,4);
ndviImageFilter->GetFunctor().SetBandIndex(CommonBandNames::RED, 3);
ndviImageFilter->GetFunctor().SetBandIndex(CommonBandNames::NIR, 4);
ndviImageFilter->SetInput(vreader->GetOutput());
ImageToVectorImageCastFilterType::Pointer ndviVectorImageFilter = ImageToVectorImageCastFilterType::New();
......
......@@ -26,7 +26,7 @@
Output/pretty_ARVIMultiChannelRAndBAndNIRVegetationIndex.png \
1 \
3 \
2
2
*/
......@@ -133,9 +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().SetBandIndex(CommonBandNames::RED,::atoi(argv[5]));
filter->GetFunctor().SetBandIndex(CommonBandNames::BLUE,::atoi(argv[6]));
filter->GetFunctor().SetBandIndex(CommonBandNames::NIR,::atoi(argv[7]));
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.
......
......@@ -77,7 +77,7 @@ int main(int argc, char* argv[])
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " inputImage , outputImage , prettyInput , prettyOutput , redChannel , greenChannel , nirChannel ,"<<std::endl;
std::cerr << " inputImage , outputImage , prettyInput , prettyOutput , redChannel , greenChannel , nirChannel ," << std::endl;
return 1;
}
......@@ -119,9 +119,9 @@ int main(int argc, char* argv[])
// The three used index bands (red, green and NIR) are declared.
filter->GetFunctor().SetBandIndex(CommonBandNames::RED,::atoi(argv[5]));
filter->GetFunctor().SetBandIndex(CommonBandNames::GREEN,::atoi(argv[6]));
filter->GetFunctor().SetBandIndex(CommonBandNames::NIR,::atoi(argv[7]));
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.
......
......@@ -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, 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().SetBandIndex(CommonBandNames::RED,redChannel);
filter->GetFunctor().SetBandIndex(CommonBandNames::NIR,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.
......
......@@ -51,19 +51,25 @@ template<class TInput, class TOutput = double>
class RadiometricNonWaterNonVegetationIndexFunctor
{
public:
typedef Functor::NDVI<double, double> VegetationFunctorType;
typedef Functor::NDWI2<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.SetBandIndex(CommonBandNames::RED,id); }
void SetGreenIndex(int id){ m_WaterFunctor.SetBandIndex(CommonBandNames::GREEN,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.SetBandIndex(CommonBandNames::NIR,id);
m_WaterFunctor.SetBandIndex(CommonBandNames::NIR,id);
m_VegetationFunctor.SetBandIndex(CommonBandNames::NIR, id);
m_WaterFunctor.SetBandIndex(CommonBandNames::NIR, id);
}
RadiometricNonWaterNonVegetationIndexFunctor(){}
......
......@@ -27,11 +27,30 @@ namespace BandName
{
/**
* 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};
* 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
......@@ -38,22 +38,24 @@ namespace Functor
* \ingroup OTBIndices
*/
template <class TInput, class TOutput>
class ISU : public RadiometricIndex<TInput,TOutput>
class ISU : public RadiometricIndex<TInput, TOutput>
{
public:
ISU() : RadiometricIndex<TInput,TOutput>({CommonBandNames::RED, CommonBandNames::NIR}) {}
ISU() : RadiometricIndex<TInput, TOutput>({CommonBandNames::RED, CommonBandNames::NIR})
{
}
TOutput operator()(const itk::VariableLengthVector<TInput> & input) const override
TOutput operator()(const itk::VariableLengthVector<TInput>& input) const override
{
auto red = this->Value(CommonBandNames::RED,input);
auto nir = this->Value(CommonBandNames::NIR,input);
auto red = this->Value(CommonBandNames::RED, input);
auto nir = this->Value(CommonBandNames::NIR, input);
if (nir == 0)
{
{
return static_cast<TOutput>(0.);
}
return (static_cast<TOutput>(A - (B * red) / nir));
return (static_cast<TOutput>(A - (B * red) / nir));
}
static constexpr double A = 100.;
......
......@@ -24,20 +24,22 @@
#include <vector>
#include <stdexcept>
namespace otb {
namespace otb
{
namespace Functor {
namespace Functor
{
/**
* \class IndicesStackFunctor
* \brief A class to compute a stack of radiometric indices
*
*
* This functor can be built from a vector of TIndice*. its operator()
* will apply each functor of this vector to the input pixel, and
* return a VariableLengthVector containing the list resulting
* values. It can be used with otb::FunctorImageFilter
*
* \sa FunctorImageFilter
*
*
* \ingroup OTBIndices
*/
template <typename TIndice>
......@@ -56,37 +58,36 @@ public:
* the indice stack
* \throw std::runtime_error if indices is empty
*/
IndicesStackFunctor(const std::vector<IndiceType*> & indices)
: m_Indices(std::move(indices))
IndicesStackFunctor(const std::vector<IndiceType*>& indices) : m_Indices(std::move(indices))
{
if(indices.empty())
{
if (indices.empty())
{
throw std::runtime_error("Can not build IndicesStackFunctor from an empty list of indices.");
}
}
}
/**
/**
* \param input A itk::VariableLengthVector<TInput> holding the
* pixel values for each band
* \return A VariableLengthVector<TInput::OutputType> holding all
* the indices values
*/
void operator()(OutputType & out, const PixelType & in) const
void operator()(OutputType& out, const PixelType& in) const
{
size_t idx = 0;
for(auto indice : m_Indices)
{
for (auto indice : m_Indices)
{
out[idx] = (*indice)(in);
++idx;
}
}
}
/**
* \return the size of the indices list (to be used by FunctorImgeFilter)
* \return the size of the indices list (to be used by FunctorImgeFilter)
*/
size_t OutputSize(...) const
{
return m_Indices.size();
}
}
private:
/// The list of indices to use
......
......@@ -83,8 +83,7 @@ public:
typedef PolyLineImageConstIterator<InputImageType, LineType>
ImageLineIteratorType;
typedef Functor::NDVI<ScalarRealType, ScalarRealType>
NDVIFunctorType;
typedef Functor::NDVI<ScalarRealType, ScalarRealType> NDVIFunctorType;
typedef std::vector<PrecisionType> OutputType;
......@@ -102,7 +101,7 @@ public:
void SetREDChannelIndex(unsigned int id)
{
m_NDVIFunctor.SetBandIndex(CommonBandNames::RED,id);
m_NDVIFunctor.SetBandIndex(CommonBandNames::RED, id);
}
unsigned int GetNIRChannelIndex() const
......@@ -112,7 +111,7 @@ public:
void SetNIRChannelIndex(unsigned int id)
{
m_NDVIFunctor.SetBandIndex(CommonBandNames::NIR,id);
m_NDVIFunctor.SetBandIndex(CommonBandNames::NIR, id);
}
protected:
......
......@@ -38,23 +38,23 @@ namespace Functor
/**
* \class RadiometricIndex
* \brief Base class for all radiometric indices
*
*
* This class is the base class for all radiometric indices.
*
*
* It offers services to:
* - Indicate which band are required among the list provided by
* TBandNameEnum
* - Set indices of each required band
* - Compute the indice response to a pixel by subclassing the pure
* virtual operator()
*
*
* This class is designed for performance on the critical path. For
* best performances use the Value() method when implementing
* operator() to avoid branches.
*
*
* TBandName enum should end with a MAX value that will be used to
* derive the number of bands.
*
*
* \ingroup OTBIndices
*/
template <typename TInput, typename TOutput, typename TBandNameEnum = CommonBandNames>
......@@ -62,8 +62,8 @@ class RadiometricIndex
{
public:
/// Types for input/output
using InputType = TInput;
using PixelType = itk::VariableLengthVector<InputType>;
using InputType = TInput;
using PixelType = itk::VariableLengthVector<InputType>;
using OutputType = TOutput;
/// Enum Among which bands are used
......@@ -74,27 +74,25 @@ public:
static constexpr double Epsilon = 0.0000001;
/**
* \param requiredBands the set<TBandNameEnum> of required bands
/**
* \param requiredBands the set<TBandNameEnum> of required bands
* \throw runtime_error if requiredBands contains TBandNameEnum::MAX
*/
RadiometricIndex(const std::set<BandNameType>& requiredBands)
: m_RequiredBands(),
m_BandIndices()
RadiometricIndex(const std::set<BandNameType>& requiredBands) : m_RequiredBands(), m_BandIndices()
{
if(requiredBands.find(BandNameType::MAX) != requiredBands.end())
{
if (requiredBands.find(BandNameType::MAX) != requiredBands.end())
{
throw std::runtime_error("TBandNameEnum::MAX can not be used as a required band");
}
}
// Fill the required bands array
m_RequiredBands.fill(false);
m_BandIndices.fill(0);
for(auto b : requiredBands)
{
m_RequiredBands[static_cast<size_t>(b)]=true;
}
for (auto b : requiredBands)
{
m_RequiredBands[static_cast<size_t>(b)] = true;
}
}
/**
......@@ -104,13 +102,13 @@ public:
std::set<BandNameType> GetRequiredBands() const
{
std::set<BandNameType> resp;
for(size_t i = 0; i < NumberOfBands; ++i)
for (size_t i = 0; i < NumberOfBands; ++i)
{
if (m_RequiredBands[i])
{
if(m_RequiredBands[i])
{
resp.insert(static_cast<BandNameType>(i));
}
}
}
return resp;
}
......@@ -122,11 +120,11 @@ public:
*/
void SetBandIndex(BandNameType band, size_t index)
{
if(band == BandNameType::MAX)
{
if (band == BandNameType::MAX)
{
throw std::runtime_error("Can not set index for TBandNameEnum::MAX");
}
m_BandIndices[static_cast<size_t>(band)]=index;
}
m_BandIndices[static_cast<size_t>(band)] = index;
}
/**
......@@ -134,12 +132,12 @@ public:
* bands indices to set (starts at 1 for first band)
* \throw runtime_error if indicesMap contains TBandNameEnum::MAX
*/
void SetBandsIndices(const std::map<BandNameType,size_t> & indicesMap)
void SetBandsIndices(const std::map<BandNameType, size_t>& indicesMap)
{
for(auto it: indicesMap)
{
SetBandIndex(it.first,it.second);
}
for (auto it : indicesMap)
{
SetBandIndex(it.first, it.second);
}
}
/**
......@@ -149,10 +147,10 @@ public:
*/
size_t GetBandIndex(BandNameType band) const
{
if(band == BandNameType::MAX)
{
if (band == BandNameType::MAX)
{
throw std::runtime_error("Can not get index for TBandNameEnum::MAX");
}
}
return m_BandIndices[static_cast<size_t>(band)];
}
......@@ -162,7 +160,7 @@ public:
* pixel values for each band
* \return The indice value as TOutput (starts at 1 for first band)
*/
virtual TOutput operator()(const itk::VariableLengthVector<TInput> & input) const = 0;
virtual TOutput operator()(const itk::VariableLengthVector<TInput>& input) const = 0;
protected:
/**
......@@ -181,11 +179,11 @@ protected:
assert(band != BandNameType::MAX && "Can not retrieve index for band TBandNameEnum::MAX");
return m_BandIndices[static_cast<size_t>(band)];
}
/**
* Helper method to parse input itk::VariableLengthVector<TInput>
* and get the corresponding band value.
* For instance:
* For instance:
* \snippet auto red = this->Value(CommonBandNames::RED,input);
*
* As this function is on the critical performance path, no checks
......@@ -197,11 +195,11 @@ protected:
* pixel values for each band
* \return The value of the band as double
*
*/
double Value(BandNameType band, const itk::VariableLengthVector<TInput> & input) const
*/
double Value(BandNameType band, const itk::VariableLengthVector<TInput>& input) const
{
assert(m_RequiredBands[band] && "Retrieving value for a band that is not in the required bands list");
return static_cast<double>(input[UncheckedBandIndex(band)-1]);
return static_cast<double>(input[UncheckedBandIndex(band) - 1]);
}
private:
......@@ -209,15 +207,15 @@ private:
RadiometricIndex() = delete;
/// An array storing the required status for each band
using RequiredBandsContainer = std::array<bool,NumberOfBands>;
using RequiredBandsContainer = std::array<bool, NumberOfBands>;
RequiredBandsContainer m_RequiredBands;
/// An array storing the indice for each band
using BandIndicesContainer = std::array<size_t,NumberOfBands>;
BandIndicesContainer m_BandIndices;
using BandIndicesContainer = std::array<size_t, NumberOfBands>;
BandIndicesContainer m_BandIndices;
};
} // End namespace Indices
} // namespace Functor
} // End namespace otb
#endif
......@@ -43,22 +43,24 @@ namespace Functor
* \ingroup OTBIndices
*/
template <class TInput, class TOutput>
class RI : public RadiometricIndex<TInput,TOutput>
class RI : public RadiometricIndex<TInput, TOutput>
{
public:
RI() : RadiometricIndex<TInput,TOutput>({CommonBandNames::RED, CommonBandNames::GREEN}) {}
RI() : RadiometricIndex<TInput, TOutput>({CommonBandNames::RED, CommonBandNames::GREEN})
{
}
TOutput operator()(const itk::VariableLengthVector<TInput> & input) const override
TOutput operator()(const itk::VariableLengthVector<TInput>& input) const override
{
auto green = this->Value(CommonBandNames::GREEN,input);
auto red = this->Value(CommonBandNames::RED,input);
if (std::abs(green) < RadiometricIndex<TInput,TOutput>::Epsilon)
{
auto green = this->Value(CommonBandNames::GREEN, input);
auto red = this->Value(CommonBandNames::RED, input);
if (std::abs(green) < RadiometricIndex<TInput, TOutput>::Epsilon)
{
return static_cast<TOutput>(0.);
}
return static_cast<TOutput>(red * red / (green * green * green));
return static_cast<TOutput>(red * red / (green * green * green));
}
};
......@@ -77,22 +79,24 @@ public:
* \ingroup OTBIndices
*/
template <class TInput, class TOutput>
class CI : public RadiometricIndex<TInput,TOutput>
class CI : public RadiometricIndex<TInput, TOutput>
{
public:
CI() : RadiometricIndex<TInput,TOutput>({CommonBandNames::RED, CommonBandNames::GREEN}) {}
CI() : RadiometricIndex<TInput, TOutput>({CommonBandNames::RED, CommonBandNames::GREEN})
{
}
TOutput operator()(const itk::VariableLengthVector<TInput> & input) const override
TOutput operator()(const itk::VariableLengthVector<TInput>& input) const override
{
auto green = this->Value(CommonBandNames::GREEN,input);
auto red = this->Value(CommonBandNames::RED,input);
auto green = this->Value(CommonBandNames::GREEN, input);
auto red = this->Value(CommonBandNames::RED, input);
if (std::abs(green + red) < RadiometricIndex<TInput,TOutput>::Epsilon)
{
if (std::abs(green + red) < RadiometricIndex<TInput, TOutput>::Epsilon)
{
return static_cast<TOutput>(0.);
}
return (static_cast<TOutput>((red - green) / (red + green)));
return (static_cast<TOutput>((red - green) / (red + green)));
}
};
......@@ -107,15 +111,17 @@ public:
* \ingroup OTBIndices
*/
template <class TInput, class TOutput>
class BI : public RadiometricIndex<TInput,TOutput>
class BI : public RadiometricIndex<TInput, TOutput>
{
public:
BI() : RadiometricIndex<TInput,TOutput>({CommonBandNames::RED, CommonBandNames::GREEN}) {}
BI() : RadiometricIndex<TInput, TOutput>({CommonBandNames::RED, CommonBandNames::GREEN})
{
}
TOutput operator()(const itk::VariableLengthVector<TInput> & input) const override
TOutput operator()(const itk::VariableLengthVector<TInput>& input) const override
{
auto green = this->Value(CommonBandNames::GREEN,input);
auto red = this->Value(CommonBandNames::RED,input);
auto green = this->Value(CommonBandNames::GREEN, input);
auto red = this->Value(CommonBandNames::RED, input);
return (static_cast<TOutput>(std::sqrt((red * red + green * green) / 2.)));
}
......@@ -132,17 +138,18 @@ public:
* \ingroup OTBIndices
*/
template <class TInput, class TOutput>
class BI2 : public RadiometricIndex<TInput,TOutput>
class BI2 : public RadiometricIndex<TInput, TOutput>
{
public:
BI2() : RadiometricIndex<TInput,TOutput>({CommonBandNames::RED, CommonBandNames::GREEN, CommonBandNames::NIR}) {}
TOutput operator()(const itk::VariableLengthVector<TInput> & input) const override
BI2() : RadiometricIndex<TInput, TOutput>({CommonBandNames::RED, CommonBandNames::GREEN, CommonBandNames::NIR})
{
}
TOutput operator()(const itk::VariableLengthVector<TInput>& input) const override
{
auto green = this->Value(CommonBandNames::GREEN,input);
auto red = this->Value(CommonBandNames::RED,input);
auto nir = this->Value(CommonBandNames::NIR,input);
auto green = this->Value(CommonBandNames::GREEN, input);
auto red = this->Value(CommonBandNames::RED, input);
auto nir = this->Value(CommonBandNames::NIR, input);
return (static_cast<TOutput>(std::sqrt((red * red + green * green + nir * nir) / 3.)));
}
......
......@@ -43,23 +43,24 @@ namespace Functor
* \ingroup OTBIndices
*/
template <class TInput, class TOutput>
class NDWI : public RadiometricIndex<TInput,TOutput>
class NDWI : public RadiometricIndex<TInput, TOutput>
{
public:
NDWI() : RadiometricIndex<TInput, TOutput>({CommonBandNames::NIR, CommonBandNames::MIR})
{
}
NDWI(): RadiometricIndex<TInput,TOutput>({CommonBandNames::NIR, CommonBandNames::MIR}) {}
TOutput operator()(const itk::VariableLengthVector<TInput> & input) const override
TOutput operator()(const itk::VariableLengthVector<TInput>& input) const override
{
auto mir = this->Value(CommonBandNames::MIR,input);
auto nir = this->Value(CommonBandNames::NIR,input);
auto mir = this->Value(CommonBandNames::MIR, input);
auto nir = this->Value(CommonBandNames::NIR, input);
if (std::abs(nir + mir) < RadiometricIndex<TInput,TOutput>::Epsilon)
{
if (std::abs(nir + mir) < RadiometricIndex<TInput, TOutput>::Epsilon)
{
return 0.;
}
return (nir - mir) / (nir + mir);
return (nir - mir) / (nir + mir);
}
};
......@@ -74,23 +75,24 @@ public:
* \ingroup OTBIndices
*/
template <class TInput, class TOutput>
class NDWI2 : public RadiometricIndex<TInput,TOutput>
class NDWI2 : public RadiometricIndex<TInput, TOutput>
{
public:
NDWI2() : RadiometricIndex<TInput, TOutput>({CommonBandNames::NIR, CommonBandNames::GREEN})
{
}
NDWI2() : RadiometricIndex<TInput,TOutput>({CommonBandNames::NIR, CommonBandNames::GREEN}) {}
TOutput operator()(const itk::VariableLengthVector<TInput> & input) const override
TOutput operator()(const itk::VariableLengthVector<TInput>& input) const override
{
auto green = this->Value(CommonBandNames::GREEN,input);
auto nir = this->Value(CommonBandNames::NIR,input);
auto green = this->Value(CommonBandNames::GREEN, input);
auto nir = this->Value(CommonBandNames::NIR, input);
if (std::abs(nir + green) < RadiometricIndex<TInput,TOutput>::Epsilon)
{
if (std::abs(nir + green) < RadiometricIndex<TInput, TOutput>::Epsilon)
{
return 0.;
}
return (green - nir) / (green + nir);