18#ifndef itkBSplineDerivativeKernelFunction_h
19#define itkBSplineDerivativeKernelFunction_h
42template <
unsigned int VSplineOrder = 3,
typename TRealValueType =
double>
61 static constexpr unsigned int SplineOrder = VSplineOrder;
73 Evaluate(
const TRealValueType & u)
const override
75 return Self::FastEvaluate(u);
85 Superclass::PrintSelf(os, indent);
86 os << indent <<
"Spline Order: " << SplineOrder << std::endl;
93 template <
unsigned int>
98 inline static TRealValueType
101 return TRealValueType{ 0.0 };
105 inline static TRealValueType
110 return TRealValueType{ 0.5 };
112 else if ((u > TRealValueType{ -1.0 }) && (u < TRealValueType{ 0.0 }))
114 return TRealValueType{ 1.0 };
118 return TRealValueType{ 0.0 };
120 else if ((u > TRealValueType{ 0.0 }) && (u < TRealValueType{ 1.0 }))
122 return TRealValueType{ -1.0 };
126 return TRealValueType{ -0.5 };
130 return TRealValueType{ 0.0 };
136 inline static TRealValueType
139 if ((u > TRealValueType{ -0.5 }) && (u < TRealValueType{ 0.5 }))
141 return (TRealValueType{ -2.0 } * u);
143 else if ((u >= TRealValueType{ 0.5 }) && (u < TRealValueType{ 1.5 }))
145 return (TRealValueType{ -1.5 } + u);
147 else if ((u > TRealValueType{ -1.5 }) && (u <= TRealValueType{ -0.5 }))
149 return (TRealValueType{ 1.5 } + u);
153 return TRealValueType{ 0.0 };
159 inline static TRealValueType
162 if ((u >= TRealValueType{ 0.0 }) && (u < TRealValueType{ 1.0 }))
164 return (TRealValueType{ -2.0 } * u + TRealValueType{ 1.5 } * u * u);
166 else if ((u > TRealValueType{ -1.0 }) && (u < TRealValueType{ 0.0 }))
168 return (TRealValueType{ -2.0 } * u - TRealValueType{ 1.5 } * u * u);
170 else if ((u >= TRealValueType{ 1.0 }) && (u < TRealValueType{ 2.0 }))
172 return (TRealValueType{ -2.0 } + TRealValueType{ 2.0 } * u - TRealValueType{ 0.5 } * u * u);
174 else if ((u > TRealValueType{ -2.0 }) && (u <= TRealValueType{ -1.0 }))
176 return (TRealValueType{ 2.0 } + TRealValueType{ 2.0 } * u + TRealValueType{ 0.5 } * u * u);
180 return TRealValueType{ 0.0 };
186 inline static TRealValueType
189 itkGenericExceptionMacro(
"Evaluate not implemented for spline order " << SplineOrder);
Derivative of a BSpline kernel used for density estimation and nonparametric regression.
void PrintSelf(std::ostream &os, Indent indent) const override
BSplineDerivativeKernelFunction()=default
static TRealValueType Evaluate(const Dispatch< 3 > &, const TRealValueType &u)
TRealValueType Evaluate(const TRealValueType &u) const override
static TRealValueType Evaluate(const Dispatch< 0 > &, const TRealValueType &)
static TRealValueType Evaluate(const DispatchBase &, const TRealValueType &)
~BSplineDerivativeKernelFunction() override=default
static TRealValueType FastEvaluate(const TRealValueType u)
static TRealValueType Evaluate(const Dispatch< 1 > &, const TRealValueType &u)
static TRealValueType Evaluate(const Dispatch< 2 > &, const TRealValueType &u)
Control indentation during Print() invocation.
Kernel used for density estimation and nonparametric regression.
bool ExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Return the result of an exact comparison between two scalar values of potentially different types.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....