| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkBSplineDerivativeKernelFunction.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:33 $ |
| 7 |
|
Version: $Revision: 1.4 $ |
| 8 |
|
|
| 9 |
|
Copyright (c) Insight Software Consortium. All rights reserved. |
| 10 |
|
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. |
| 11 |
|
|
| 12 |
|
This software is distributed WITHOUT ANY WARRANTY; without even |
| 13 |
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 |
|
PURPOSE. See the above copyright notices for more information. |
| 15 |
|
|
| 16 |
|
=========================================================================*/ |
| 17 |
DEF |
#ifndef _itkBSplineDerivativeKernelFunction_h |
| 18 |
DEF |
#define _itkBSplineDerivativeKernelFunction_h |
| 19 |
|
|
| 20 |
|
#include "itkKernelFunction.h" |
| 21 |
|
#include "itkBSplineKernelFunction.h" |
| 22 |
|
|
| 23 |
|
namespace itk |
| 24 |
|
{ |
| 25 |
|
|
| 26 |
|
/** \class BSplineDerivativeKernelFunction |
| 27 |
|
* \brief Derivative of a BSpline kernel used for density estimation and |
| 28 |
|
* nonparameteric regression. |
| 29 |
|
* |
| 30 |
|
* This class enscapsulates the derivative of a BSpline kernel for |
| 31 |
|
* density estimation or nonparameteric regression. |
| 32 |
|
* See documentation for KernelFunction for more details. |
| 33 |
|
* |
| 34 |
|
* This class is templated over the spline order. |
| 35 |
|
* \warning Evaluate is only implemented for spline order 1 to 4 |
| 36 |
|
* |
| 37 |
|
* \sa KernelFunction |
| 38 |
|
* |
| 39 |
|
* \ingroup Functions |
| 40 |
|
*/ |
| 41 |
|
template <unsigned int VSplineOrder = 3> |
| 42 |
|
class ITK_EXPORT BSplineDerivativeKernelFunction : public KernelFunction |
| 43 |
|
{ |
| 44 |
|
public: |
| 45 |
|
/** Standard class typedefs. */ |
| 46 |
|
typedef BSplineDerivativeKernelFunction Self; |
| 47 |
TDA |
typedef KernelFunction Superclass; |
| 48 |
TDA |
typedef SmartPointer<Self> Pointer; |
| 49 |
|
|
| 50 |
|
/** Method for creation through the object factory. */ |
| 51 |
|
itkNewMacro(Self); |
| 52 |
|
|
| 53 |
|
/** Run-time type information (and related methods). */ |
| 54 |
|
itkTypeMacro(BSplineDerivativeKernelFunction, KernelFunction); |
| 55 |
|
|
| 56 |
|
/** Enum of for spline order. */ |
| 57 |
|
itkStaticConstMacro(SplineOrder, unsigned int, VSplineOrder); |
| 58 |
|
|
| 59 |
|
/** Evaluate the function. */ |
| 60 |
|
inline double Evaluate( const double & u ) const |
| 61 |
|
{ |
| 62 |
|
return ( m_KernelFunction->Evaluate( u + 0.5 ) - |
| 63 |
IND |
******m_KernelFunction->Evaluate( u - 0.5 ) ); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
protected: |
| 67 |
|
|
| 68 |
|
typedef BSplineKernelFunction<itkGetStaticConstMacro(SplineOrder) - 1> |
| 69 |
IND |
******KernelType; |
| 70 |
|
|
| 71 |
|
BSplineDerivativeKernelFunction() |
| 72 |
|
{ |
| 73 |
|
m_KernelFunction = KernelType::New(); |
| 74 |
|
}; |
| 75 |
|
|
| 76 |
|
~BSplineDerivativeKernelFunction(){}; |
| 77 |
|
void PrintSelf(std::ostream& os, Indent indent) const |
| 78 |
|
{ |
| 79 |
|
Superclass::PrintSelf( os, indent ); |
| 80 |
|
os << indent << "Spline Order: " << SplineOrder << std::endl; |
| 81 |
|
} |
| 82 |
|
|
| 83 |
|
private: |
| 84 |
|
BSplineDerivativeKernelFunction(const Self&); //purposely not implemented |
| 85 |
|
void operator=(const Self&); //purposely not implemented |
| 86 |
|
|
| 87 |
|
typename KernelType::Pointer m_KernelFunction; |
| 88 |
|
|
| 89 |
|
}; |
| 90 |
|
|
| 91 |
|
|
| 92 |
EML |
|
| 93 |
|
} // namespace itk |
| 94 |
|
|
| 95 |
|
#endif |
| 96 |
|
|