18#ifndef itkBSplineSecondOrderDerivativeKernelFunction2_h
19#define itkBSplineSecondOrderDerivativeKernelFunction2_h
21#include "itkKernelFunctionBase.h"
22#include <vnl/vnl_math.h>
43template <
unsigned int VSplineOrder = 3>
68 return Self::Evaluate(Dispatch<VSplineOrder>(), u);
77 Self::Evaluate(Dispatch<VSplineOrder>(), u, weights);
85 return Self::FastEvaluate(u);
91 Evaluate(
const double u,
double * weights)
const
93 Self::FastEvaluate(u, weights);
102 PrintSelf(std::ostream & os, Indent indent)
const override
104 Superclass::PrintSelf(os, indent);
105 os << indent <<
"Spline Order: " << SplineOrder << std::endl;
113 template <
unsigned int>
114 struct ITK_TEMPLATE_EXPORT Dispatch : DispatchBase
127 double absValue = std::abs(u);
133 else if (absValue == 0.5)
137 else if (absValue < 1.5)
141 else if (absValue == 1.5)
153 Evaluate(
const Dispatch<2> &,
const double,
double * weights)
165 const double absValue = std::abs(u);
169 return vnl_math::sgn0(u) * (3.0 * u) - 2.0;
171 else if (absValue < 2.0)
173 return -vnl_math::sgn(u) * u + 2.0;
183 Evaluate(
const Dispatch<3> &,
const double u,
double * weights)
185 weights[0] = -u + 2.0;
186 weights[1] = 3.0 * u - 5.0;
187 weights[2] = -3.0 * u + 4.0;
188 weights[3] = u - 1.0;
196 itkGenericExceptionMacro(
"Evaluate not implemented for spline order " << SplineOrder);
201 Evaluate(
const DispatchBase &,
const double,
double *)
203 itkGenericExceptionMacro(
"Evaluate not implemented for spline order " << SplineOrder);
Derivative of a B-spline kernel used for density estimation and nonparametric regression.
static void Evaluate(const Dispatch< 3 > &, const double u, double *weights)
static void Evaluate(const DispatchBase &, const double, double *)
static double Evaluate(const Dispatch< 2 > &, const double u)
itkStaticConstMacro(SplineOrder, unsigned int, VSplineOrder)
KernelFunctionBase< double > Superclass
static void FastEvaluate(const double u, double *const weights)
static double FastEvaluate(const double u)
static double Evaluate(const Dispatch< 3 > &, const double u)
static double Evaluate(const DispatchBase &, const double)
~BSplineSecondOrderDerivativeKernelFunction2() override=default
void Evaluate(const double u, double *weights) const
static void Evaluate(const Dispatch< 2 > &, const double, double *weights)
BSplineSecondOrderDerivativeKernelFunction2()=default
ITK_DISALLOW_COPY_AND_MOVE(BSplineSecondOrderDerivativeKernelFunction2)
void PrintSelf(std::ostream &os, Indent indent) const override
double Evaluate(const double &u) const override