18#ifndef itkCacheableScalarFunction_h
19#define itkCacheableScalarFunction_h
23#include "ITKBiasCorrectionExport.h"
60class ITKBiasCorrection_EXPORT CacheableScalarFunction
65 CacheableScalarFunction();
68 virtual ~CacheableScalarFunction();
71 using MeasureType = double;
72 using MeasureArrayType = Array<MeasureType>;
77 GetNumberOfSamples()
const
79 return m_NumberOfSamples;
84 IsCacheAvailable()
const
86 return m_CacheAvailable;
91 GetCacheUpperBound()
const
93 return m_CacheUpperBound;
98 GetCacheLowerBound()
const
100 return m_CacheLowerBound;
107 Evaluate(MeasureType x);
122 GetCachedValue(MeasureType x)
124 if (x > m_CacheUpperBound || x < m_CacheLowerBound)
126 throw ExceptionObject(__FILE__, __LINE__);
129 auto index =
static_cast<int>((x - m_CacheLowerBound) / m_TableInc);
130 return m_CacheTable[index];
138 CreateCache(
double lowerBound,
double upperBound,
SizeValueType sampleSize);
146 MeasureArrayType m_CacheTable{};
149 double m_CacheUpperBound{ 0.0 };
152 double m_CacheLowerBound{ 0.0 };
155 double m_TableInc{ 0.0 };
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType