18 #ifndef itkBSplineKernelFunction_h
19 #define itkBSplineKernelFunction_h
41 template<
unsigned int VSplineOrder = 3,
typename TRealValueType =
double >
61 inline TRealValueType
Evaluate(
const TRealValueType & u)
const ITK_OVERRIDE
72 os << indent <<
"Spline Order: " <<
SplineOrder << std::endl;
81 template<
unsigned int >
87 const TRealValueType absValue = vnl_math_abs(u);
88 if ( absValue < static_cast< TRealValueType >(0.5) )
92 else if ( absValue == static_cast< TRealValueType >(0.5) )
94 return static_cast< TRealValueType
>(0.5);
106 const TRealValueType absValue = vnl_math_abs(u);
121 const TRealValueType absValue = vnl_math_abs(u);
122 if ( absValue < static_cast< TRealValueType >(0.5) )
124 const TRealValueType sqrValue = vnl_math_sqr(absValue);
125 return static_cast< TRealValueType
>(0.75) - sqrValue;
127 else if ( absValue < static_cast< TRealValueType >(1.5) )
129 const TRealValueType sqrValue = vnl_math_sqr(absValue);
131 return ( static_cast< TRealValueType >(9.0) - static_cast< TRealValueType >(12.0) * absValue
132 + static_cast< TRealValueType >(4.0) * sqrValue ) *
static_cast< TRealValueType
>(0.125);
144 const TRealValueType absValue = vnl_math_abs(u);
147 const TRealValueType sqrValue = vnl_math_sqr(absValue);
148 return ( static_cast< TRealValueType >(4.0) - static_cast< TRealValueType >(6.0) * sqrValue
149 + static_cast< TRealValueType >(3.0) * sqrValue * absValue ) /
static_cast< TRealValueType
>(6.0);
151 else if ( absValue < static_cast< TRealValueType >(2.0) )
153 const TRealValueType sqrValue = vnl_math_sqr(absValue);
154 return ( static_cast< TRealValueType >(8.0) - static_cast< TRealValueType >(12.0) * absValue + static_cast< TRealValueType >(6.0) * sqrValue
155 - sqrValue * absValue ) /
static_cast< TRealValueType
>(6.0);
167 itkExceptionMacro(
"Evaluate not implemented for spline order "
virtual ~BSplineKernelFunction()
void operator=(const Self &)
void PrintSelf(std::ostream &os, Indent indent) const override
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