17 #ifndef __itkBSplineSecondOrderDerivativeKernelFunction2_h
18 #define __itkBSplineSecondOrderDerivativeKernelFunction2_h
20 #include "itkKernelFunction.h"
21 #include "vnl/vnl_math.h"
42 template <
unsigned int VSplineOrder = 3>
58 itkStaticConstMacro(SplineOrder,
unsigned int, VSplineOrder);
67 inline double Evaluate(
const double & u )
const
69 return this->Evaluate( Dispatch<VSplineOrder>(), u );
76 void PrintSelf(std::ostream& os, Indent indent)
const
78 Superclass::PrintSelf( os, indent );
79 os << indent <<
"Spline Order: " << SplineOrder << std::endl;
84 void operator=(
const Self&);
87 struct DispatchBase {};
88 template<
unsigned int>
89 struct Dispatch : DispatchBase {};
134 inline double Evaluate (
const Dispatch<2>&,
const double& u)
const
136 double absValue = vnl_math_abs( u );
138 if ( absValue < 0.5 )
142 else if ( absValue == 0.5 )
146 else if ( absValue < 1.5 )
150 else if ( absValue == 1.5 )
162 inline double Evaluate (
const Dispatch<3>&,
const double& u)
const
164 const double absValue = vnl_math_abs( u );
166 if ( absValue < 1.0 )
168 return vnl_math_sgn0( u ) * ( 3.0 * u ) - 2.0;
170 else if ( absValue < 2.0 )
172 return -vnl_math_sgn( u ) * u + 2.0;
182 inline double Evaluate (
const DispatchBase&,
const double&)
const
184 itkExceptionMacro(
"Evaluate not implemented for spline\
185 order " << SplineOrder);