18 #ifndef itkBSplineKernelFunction_h
19 #define itkBSplineKernelFunction_h
42 template<
unsigned int VSplineOrder = 3,
typename TRealValueType =
double >
61 static constexpr
unsigned int SplineOrder = VSplineOrder;
64 TRealValueType
Evaluate(
const TRealValueType & u)
const override
74 Superclass::PrintSelf(os, indent);
75 os << indent <<
"Spline Order: " << SplineOrder << std::endl;
81 template<
unsigned int >
87 const TRealValueType absValue = itk::Math::abs(u);
88 if ( absValue < static_cast< TRealValueType >(0.5) )
94 return static_cast< TRealValueType
>(0.5);
106 const TRealValueType absValue = itk::Math::abs(u);
121 const TRealValueType absValue = itk::Math::abs(u);
122 if ( absValue < static_cast< TRealValueType >(0.5) )
124 const TRealValueType sqrValue = itk::Math::sqr(absValue);
125 return static_cast< TRealValueType
>(0.75) - sqrValue;
127 else if ( absValue < static_cast< TRealValueType >(1.5) )
129 const TRealValueType sqrValue = itk::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 = itk::Math::abs(u);
147 const TRealValueType sqrValue = itk::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 = itk::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 "
Define numeric traits for std::vector.
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.
TRealValueType Evaluate(const Dispatch< 0 > &, const TRealValueType &u) const
typename Superclass::RealType RealType
TRealValueType Evaluate(const TRealValueType &u) const override
void PrintSelf(std::ostream &os, Indent indent) const override
Control indentation during Print() invocation.
TRealValueType Evaluate(const DispatchBase &, const TRealValueType &) const
TRealValueType Evaluate(const Dispatch< 2 > &, const TRealValueType &u) const