18#ifndef __itkBSplineSecondOrderDerivativeKernelFunction2_h
19#define __itkBSplineSecondOrderDerivativeKernelFunction2_h
21#include "itkKernelFunctionBase.h"
22#include "vnl/vnl_math.h"
43template<
unsigned int VSplineOrder = 3 >
63 inline double Evaluate(
const double & u )
const override
65 return this->
Evaluate( Dispatch< VSplineOrder >(), u );
70 inline void Evaluate(
const double & u,
double * weights )
const
72 this->
Evaluate( Dispatch< VSplineOrder >(), u, weights );
81 void PrintSelf( std::ostream & os, Indent indent )
const override
83 Superclass::PrintSelf( os, indent );
84 os << indent <<
"Spline Order: " << SplineOrder << std::endl;
94 struct DispatchBase {};
95 template<
unsigned int >
96 struct Dispatch : DispatchBase {};
105 inline double Evaluate(
const Dispatch< 2 > &,
const double & u )
const
107 double absValue = std::abs( u );
113 else if( absValue == 0.5 )
117 else if( absValue < 1.5 )
121 else if( absValue == 1.5 )
132 inline void Evaluate(
const Dispatch< 2 > &,
const double & u,
double * weights )
const
141 inline double Evaluate(
const Dispatch< 3 > &,
const double & u )
const
143 const double absValue = std::abs( u );
147 return vnl_math::sgn0( u ) * ( 3.0 * u ) - 2.0;
149 else if( absValue < 2.0 )
151 return -vnl_math::sgn( u ) * u + 2.0;
160 inline void Evaluate(
const Dispatch< 3 > &,
const double & u,
double * weights )
const
162 weights[ 0 ] = -u + 2.0;
163 weights[ 1 ] = 3.0 * u - 5.0;
164 weights[ 2 ] = -3.0 * u + 4.0;
165 weights[ 3 ] = u - 1.0;
170 inline double Evaluate(
const DispatchBase &,
const double & )
const
172 itkExceptionMacro(
"Evaluate not implemented for spline order " << SplineOrder );
176 inline void Evaluate(
const DispatchBase &,
const double &,
double * )
const
178 itkExceptionMacro(
"Evaluate not implemented for spline order " << SplineOrder );
Derivative of a B-spline kernel used for density estimation and nonparametric regression.
~BSplineSecondOrderDerivativeKernelFunction2() override
void Evaluate(const double &u, double *weights) const
double Evaluate(const Dispatch< 3 > &, const double &u) const
BSplineSecondOrderDerivativeKernelFunction2 Self
void operator=(const Self &)
itkStaticConstMacro(SplineOrder, unsigned int, VSplineOrder)
void Evaluate(const DispatchBase &, const double &, double *) const
double Evaluate(const Dispatch< 2 > &, const double &u) const
BSplineSecondOrderDerivativeKernelFunction2()
double Evaluate(const DispatchBase &, const double &) const
BSplineSecondOrderDerivativeKernelFunction2(const Self &)
SmartPointer< Self > Pointer
void PrintSelf(std::ostream &os, Indent indent) const override
void Evaluate(const Dispatch< 3 > &, const double &u, double *weights) const
double Evaluate(const double &u) const override
void Evaluate(const Dispatch< 2 > &, const double &u, double *weights) const
KernelFunctionBase< double > Superclass