18 #ifndef itkBSplineKernelFunction_h
19 #define itkBSplineKernelFunction_h
42 template<
unsigned int VSplineOrder = 3,
typename TRealValueType =
double >
62 inline TRealValueType
Evaluate(
const TRealValueType & u)
const ITK_OVERRIDE
73 os << indent <<
"Spline Order: " <<
SplineOrder << std::endl;
78 void operator=(const
Self &) ITK_DELETE_FUNCTION;
82 template<
unsigned int >
88 const TRealValueType absValue = vnl_math_abs(u);
89 if ( absValue < static_cast< TRealValueType >(0.5) )
95 return static_cast< TRealValueType
>(0.5);
107 const TRealValueType absValue = vnl_math_abs(u);
122 const TRealValueType absValue = vnl_math_abs(u);
123 if ( absValue < static_cast< TRealValueType >(0.5) )
125 const TRealValueType sqrValue = vnl_math_sqr(absValue);
126 return static_cast< TRealValueType
>(0.75) - sqrValue;
128 else if ( absValue < static_cast< TRealValueType >(1.5) )
130 const TRealValueType sqrValue = vnl_math_sqr(absValue);
132 return ( static_cast< TRealValueType >(9.0) - static_cast< TRealValueType >(12.0) * absValue
133 + static_cast< TRealValueType >(4.0) * sqrValue ) *
static_cast< TRealValueType
>(0.125);
145 const TRealValueType absValue = vnl_math_abs(u);
148 const TRealValueType sqrValue = vnl_math_sqr(absValue);
149 return ( static_cast< TRealValueType >(4.0) - static_cast< TRealValueType >(6.0) * sqrValue
150 + static_cast< TRealValueType >(3.0) * sqrValue * absValue ) /
static_cast< TRealValueType
>(6.0);
152 else if ( absValue < static_cast< TRealValueType >(2.0) )
154 const TRealValueType sqrValue = vnl_math_sqr(absValue);
155 return ( static_cast< TRealValueType >(8.0) - static_cast< TRealValueType >(12.0) * absValue + static_cast< TRealValueType >(6.0) * sqrValue
156 - sqrValue * absValue ) /
static_cast< TRealValueType
>(6.0);
168 itkExceptionMacro(
"Evaluate not implemented for spline order "
virtual ~BSplineKernelFunction()
void PrintSelf(std::ostream &os, Indent indent) const override
bool ExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Return the result of an exact comparison between two scalar values of potetially different types...
TRealValueType Evaluate(const Dispatch< 3 > &, const TRealValueType &u) const
Kernel used for density estimation and nonparameteric regression.
TRealValueType Evaluate(const Dispatch< 1 > &, const TRealValueType &u) const
BSpline kernel used for density estimation and nonparameteric regression.
BSplineKernelFunction Self
SmartPointer< Self > Pointer
TRealValueType Evaluate(const Dispatch< 0 > &, const TRealValueType &u) const
static const unsigned int SplineOrder
Superclass::RealType RealType
TRealValueType Evaluate(const TRealValueType &u) const override
void PrintSelf(std::ostream &os, Indent indent) const override
Control indentation during Print() invocation.
Define additional traits for native types such as int or float.
TRealValueType Evaluate(const DispatchBase &, const TRealValueType &) const
TRealValueType Evaluate(const Dispatch< 2 > &, const TRealValueType &u) const
KernelFunctionBase< TRealValueType > Superclass