18 #ifndef itkBSplineKernelFunction_h
19 #define itkBSplineKernelFunction_h
42 template <
unsigned int VSplineOrder = 3,
typename TRealValueType =
double>
61 static constexpr
unsigned int SplineOrder = VSplineOrder;
65 Evaluate(
const TRealValueType & u)
const override
76 Superclass::PrintSelf(os, indent);
77 os << indent <<
"Spline Order: " << SplineOrder << std::endl;
84 template <
unsigned int>
92 const TRealValueType absValue = itk::Math::abs(u);
93 if (absValue < static_cast<TRealValueType>(0.5))
99 return static_cast<TRealValueType>(0.5);
109 inline TRealValueType
112 const TRealValueType absValue = itk::Math::abs(u);
125 inline TRealValueType
128 const TRealValueType absValue = itk::Math::abs(u);
129 if (absValue < static_cast<TRealValueType>(0.5))
131 const TRealValueType sqrValue = itk::Math::sqr(absValue);
132 return static_cast<TRealValueType>(0.75) - sqrValue;
134 else if (absValue < static_cast<TRealValueType>(1.5))
136 const TRealValueType sqrValue = itk::Math::sqr(absValue);
138 return (static_cast<TRealValueType>(9.0) - static_cast<TRealValueType>(12.0) * absValue +
139 static_cast<TRealValueType>(4.0) * sqrValue) *
140 static_cast<TRealValueType>(0.125);
150 inline TRealValueType
153 const TRealValueType absValue = itk::Math::abs(u);
156 const TRealValueType sqrValue = itk::Math::sqr(absValue);
157 return (static_cast<TRealValueType>(4.0) - static_cast<TRealValueType>(6.0) * sqrValue +
158 static_cast<TRealValueType>(3.0) * sqrValue * absValue) /
159 static_cast<TRealValueType>(6.0);
161 else if (absValue < static_cast<TRealValueType>(2.0))
163 const TRealValueType sqrValue = itk::Math::sqr(absValue);
164 return (static_cast<TRealValueType>(8.0) - static_cast<TRealValueType>(12.0) * absValue +
165 static_cast<TRealValueType>(6.0) * sqrValue - sqrValue * absValue) /
166 static_cast<TRealValueType>(6.0);
176 inline TRealValueType
179 itkExceptionMacro(
"Evaluate not implemented for spline order " << SplineOrder);