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

ENH: add background value handling for stat estimation in pca

parent cb1d969d
No related branches found
No related tags found
No related merge requests found
......@@ -183,6 +183,10 @@ private:
MandatoryOff("outmatrix");
DisableParameter("outmatrix");
AddParameter(ParameterType_Float, "bv", "Background Value");
SetParameterDescription( "bv", "Background value to ignore in computation of the transformation matrix. Note that all pixels will still be processed when applying the transformation." );
MandatoryOff("bv");
AddRAMParameter();
// Doc example parameter settings
......@@ -276,6 +280,11 @@ private:
filter->SetUseVarianceForNormalization(false);
}
if( HasValue( "bv" ) )
{
filter->SetStatisticsUserIgnoredValue(GetParameterFloat("bv"));
}
m_ForwardFilter->GetOutput()->UpdateOutputInformation();
// Write eigenvalues
......
......@@ -161,7 +161,17 @@ public:
m_StdDevValues = vec;
this->Modified();
}
void SetStatisticsUserIgnoredValue ( RealType value )
{
/** User ignored value for the normalizer */
m_Normalizer->GetCovarianceEstimator()->SetUserIgnoredValue(value);
m_Normalizer->GetCovarianceEstimator()->SetIgnoreUserDefinedValue(true);
/** User ignored value for the covariance estimator */
m_CovarianceEstimator->SetUserIgnoredValue(value);
m_CovarianceEstimator->SetIgnoreUserDefinedValue(true);
}
protected:
PCAImageFilter();
~PCAImageFilter() override { }
......
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