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

ENH: added parameters for maximum error and maximum kernel width in Smoothing

parent 89ab63f2
No related branches found
No related tags found
No related merge requests found
......@@ -90,8 +90,17 @@ private:
SetParameterDescription("type.gaussian.stdev", "Standard deviation of the gaussian kernel used to filter the image");
SetDefaultParameterFloat("type.gaussian.stdev", 2.0);
AddChoice("type.anidif", "Anisotropic Diffusion");
AddParameter(ParameterType_Float, "type.gaussian.maxerror", "Maximum error");
SetParameterDescription("type.gaussian.stdev", "The algorithm will size the discrete kernel so that the error "
"resulting from truncation of the kernel is no greater than maxerror.");
SetDefaultParameterFloat("type.gaussian.maxerror", 0.01);
AddParameter(ParameterType_Int, "type.gaussian.maxwidth", "Maximum kernel width");
SetParameterDescription("type.gaussian.maxwidth", "Set the kernel to be no wider than maxwidth pixels, "
"even if type.gaussian.maxerror demands it.");
SetDefaultParameterInt("type.gaussian.maxwidth", 32);
AddChoice("type.anidif", "Anisotropic Diffusion");
AddParameter(ParameterType_Float, "type.anidif.timestep", "Time Step");
SetParameterDescription("type.anidif.timestep", "Time step that will be used to discretize the diffusion equation");
......@@ -175,8 +184,12 @@ private:
const double stdev = GetParameterFloat("type.gaussian.stdev");
double variance = stdev * stdev;
perBand->GetFilter()->SetVariance(variance);
perBand->GetFilter()->SetUseImageSpacing(false);
perBand->GetFilter()->SetMaximumError(GetParameterFloat("type.gaussian.maxerror"));
perBand->GetFilter()->SetMaximumKernelWidth(GetParameterInt("type.gaussian.maxwidth"));
perBand->UpdateOutputInformation();
m_FilterRef = perBand;
SetParameterOutputImage("out", perBand->GetOutput());
......
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