Commit d405ccb9 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

ENH: add theshold and bv parameters to SpectralAngleClassification

parent 69ef64ed
......@@ -97,6 +97,20 @@ private:
AddChoice("mode.sid", "Spectral information divergence");
SetParameterDescription("mode.sid", "Spectral information divergence (SID) measure.");
AddParameter(ParameterType_Float, "threshold", "Classification threshold");
"Pixel with a measurement greater than this threshold relatively to "
"a reference pixel are not classified. The same threshold is used for all classes.");
AddParameter(ParameterType_Int, "bv", "Background value");
"Value of unclassified pixels in the classification image "
"(this parameter is only used if threshold is set).");
SetDefaultParameterInt("bv", -1);
......@@ -158,11 +172,16 @@ private:
if (HasValue("out"))
// This lambda return the index of the minimum value in a pixel
auto minIndexLambda = [](PixelType const & pixel)
auto threshold = HasValue("threshold") ? GetParameterFloat("threshold")
: std::numeric_limits<ValueType>::max();
auto bv = GetParameterInt("bv");
// This lambda return the index of the minimum value in a pixel, values above threshold are not classified.
auto minIndexLambda = [threshold, bv](PixelType const & pixel)
auto min = std::numeric_limits<ValueType>::max();
unsigned int res = 0;
auto min = threshold;
int res = bv;
for (unsigned int i = 0; i < pixel.Size(); i++)
if (pixel[i] < min)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment