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: ...@@ -97,6 +97,20 @@ private:
AddChoice("mode.sid", "Spectral information divergence"); AddChoice("mode.sid", "Spectral information divergence");
SetParameterDescription("mode.sid", "Spectral information divergence (SID) measure."); 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);
AddRAMParameter(); AddRAMParameter();
SetMultiWriting(true); SetMultiWriting(true);
...@@ -158,11 +172,16 @@ private: ...@@ -158,11 +172,16 @@ private:
if (HasValue("out")) if (HasValue("out"))
{ {
// This lambda return the index of the minimum value in a pixel auto threshold = HasValue("threshold") ? GetParameterFloat("threshold")
auto minIndexLambda = [](PixelType const & pixel) : 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(); auto min = threshold;
unsigned int res = 0; int res = bv;
for (unsigned int i = 0; i < pixel.Size(); i++) for (unsigned int i = 0; i < pixel.Size(); i++)
{ {
if (pixel[i] < min) if (pixel[i] < min)
Markdown is supported
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