18 #ifndef __itkBSplineDerivativeKernelFunction_h
19 #define __itkBSplineDerivativeKernelFunction_h
41 template<
unsigned int VSplineOrder = 3,
typename TRealValueType =
double >
58 itkStaticConstMacro(SplineOrder,
unsigned int, VSplineOrder);
61 inline TRealValueType Evaluate(
const TRealValueType & u )
const
70 void PrintSelf(std::ostream & os,
Indent indent)
const
72 Superclass::PrintSelf(os, indent);
73 os << indent <<
"Spline Order: " << SplineOrder << std::endl;
78 void operator=(
const Self &);
82 template<
unsigned int >
86 inline TRealValueType Evaluate(
const Dispatch<0>&,
const TRealValueType & itkNotUsed( u ) )
93 inline TRealValueType Evaluate(
const Dispatch<1>&,
const TRealValueType& u )
const
97 return static_cast< TRealValueType
>(0.5);
113 return static_cast< TRealValueType
>(-0.5);
123 inline TRealValueType Evaluate(
const Dispatch<2>&,
const TRealValueType& u)
const
125 if( ( u > static_cast< TRealValueType >(-0.5) ) && ( u < static_cast< TRealValueType >(0.5) ) )
127 return ( static_cast< TRealValueType >(-2.0) * u );
129 else if( ( u >= static_cast< TRealValueType >(0.5) ) && ( u < static_cast< TRealValueType >(1.5) ) )
131 return ( static_cast< TRealValueType >(-1.5) + u );
133 else if( ( u > static_cast< TRealValueType >(-1.5) ) && ( u <= static_cast< TRealValueType >(-0.5) ) )
135 return ( static_cast< TRealValueType >(1.5) + u );
145 inline TRealValueType Evaluate(
const Dispatch<3>&,
const TRealValueType& u )
const
149 return ( static_cast< TRealValueType >(-2.0)* u + static_cast< TRealValueType >(1.5) * u * u );
153 return ( static_cast< TRealValueType >(-2.0) * u - static_cast< TRealValueType >(1.5) * u * u );
157 return ( static_cast< TRealValueType >(-2.0) + static_cast< TRealValueType >(2.0) * u - static_cast< TRealValueType >(0.5) * u * u );
161 return ( static_cast< TRealValueType >(2.0) + static_cast< TRealValueType >(2.0) * u + static_cast< TRealValueType >(0.5) * u * u );
171 inline TRealValueType Evaluate(
const DispatchBase&,
const TRealValueType& )
const
173 itkExceptionMacro(
"Evaluate not implemented for spline order " << SplineOrder );