Skip to content
Snippets Groups Projects
Commit d405ccb9 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

ENH: add theshold and bv parameters to SpectralAngleClassification

parent 69ef64ed
No related branches found
No related tags found
No related merge requests found
......@@ -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");
SetParameterDescription("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.");
MandatoryOff("threshold");
AddParameter(ParameterType_Int, "bv", "Background value");
SetParameterDescription("bv",
"Value of unclassified pixels in the classification image "
"(this parameter is only used if threshold is set).");
MandatoryOff("bv");
SetDefaultParameterInt("bv", -1);
AddRAMParameter();
SetMultiWriting(true);
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment