18 #ifndef itkBSplineKernelFunction_h
19 #define itkBSplineKernelFunction_h
42 template<
unsigned int VSplineOrder = 3,
typename TRealValueType =
double >
59 itkStaticConstMacro(SplineOrder,
unsigned int, VSplineOrder);
62 TRealValueType
Evaluate(
const TRealValueType & u)
const ITK_OVERRIDE
72 Superclass::PrintSelf(os, indent);
73 os << indent <<
"Spline Order: " << SplineOrder << std::endl;
81 template<
unsigned int >
88 if ( absValue < static_cast< TRealValueType >(0.5) )
94 return static_cast< TRealValueType
>(0.5);
122 if ( absValue < static_cast< TRealValueType >(0.5) )
125 return static_cast< TRealValueType
>(0.75) - sqrValue;
127 else if ( absValue < static_cast< TRealValueType >(1.5) )
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);
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) )
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 "
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
virtual ~BSplineKernelFunction() override
TRealValueType Evaluate(const Dispatch< 0 > &, const TRealValueType &u) const
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