18 #ifndef itkCompositeValleyFunction_h
19 #define itkCompositeValleyFunction_h
22 #include "ITKBiasCorrectionExport.h"
77 TargetClass(
double mean,
double sigma)
84 void SetMean(
double mean) { m_Mean = mean; }
85 double GetMean() {
return m_Mean; }
89 void SetSigma(
double sigma) { m_Sigma = sigma; }
90 double GetSigma() {
return m_Sigma; }
98 class ITKBiasCorrection_EXPORT CompositeValleyFunction:
public CacheableScalarFunction
103 using Superclass = CacheableScalarFunction;
106 using MeasureType = Superclass::MeasureType;
107 using MeasureArrayType = Superclass::MeasureArrayType;
110 CompositeValleyFunction(
const MeasureArrayType & classMeans,
111 const MeasureArrayType & classSigmas);
114 ~CompositeValleyFunction()
override;
117 double GetUpperBound() {
return m_UpperBound; }
120 double GetLowerBound() {
return m_LowerBound; }
124 MeasureType operator()(MeasureType x)
126 if ( x > m_UpperBound || x < m_LowerBound )
131 if ( !this->IsCacheAvailable() )
133 return this->Evaluate(x);
137 return GetCachedValue(x);
142 MeasureType Evaluate(MeasureType x)
override;
145 inline MeasureType valley(MeasureType d)
147 return 1 - 1 / ( 1 + d * d / 3 );
151 void AddNewClass(
double mean,
double sigma)
153 TargetClass aClass(mean, sigma);
155 m_Targets.push_back(aClass);
163 std::vector< TargetClass > m_Targets;