ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkCoxDeBoorBSplineKernelFunction_h 00019 #define __itkCoxDeBoorBSplineKernelFunction_h 00020 00021 #include "itkKernelFunctionBase.h" 00022 #include "vnl/vnl_real_polynomial.h" 00023 #include "vnl/vnl_matrix.h" 00024 00025 namespace itk 00026 { 00056 template<unsigned int VSplineOrder = 3, typename TRealValueType = double> 00057 class ITK_EXPORT CoxDeBoorBSplineKernelFunction: 00058 public KernelFunctionBase<TRealValueType> 00059 { 00060 public: 00062 typedef CoxDeBoorBSplineKernelFunction Self; 00063 typedef KernelFunctionBase<TRealValueType> Superclass; 00064 typedef SmartPointer<Self> Pointer; 00065 typedef SmartPointer<const Self> ConstPointer; 00066 00067 typedef typename Superclass::RealType RealType; 00068 00070 itkNewMacro( Self ); 00071 00073 itkTypeMacro( CoxDeBoorBSplineKernelFunction, KernelFunctionBase ); 00074 00075 typedef vnl_vector<TRealValueType> VectorType; 00076 typedef vnl_real_polynomial PolynomialType; 00077 typedef vnl_matrix<TRealValueType> MatrixType; 00078 00080 void SetSplineOrder( const unsigned int ); 00081 00083 itkGetConstMacro( SplineOrder, unsigned int ); 00084 00086 TRealValueType Evaluate( const TRealValueType & ) const; 00087 00089 TRealValueType EvaluateDerivative( const TRealValueType & ) const; 00090 00092 TRealValueType EvaluateNthDerivative( const TRealValueType &, const unsigned int ) const; 00093 00099 MatrixType GetShapeFunctions(); 00100 00105 MatrixType GetShapeFunctionsInZeroToOneInterval(); 00106 00107 protected: 00108 CoxDeBoorBSplineKernelFunction(); 00109 virtual ~CoxDeBoorBSplineKernelFunction(); 00110 void PrintSelf( std::ostream & os, Indent indent ) const; 00111 00112 private: 00113 CoxDeBoorBSplineKernelFunction( const Self & ); //purposely not implemented 00114 void operator=( const Self & ); //purposely not implemented 00115 00120 void GenerateBSplineShapeFunctions( const unsigned int ); 00121 00128 PolynomialType CoxDeBoor( const unsigned short, const VectorType, 00129 const unsigned int, const unsigned int ); 00130 00131 MatrixType m_BSplineShapeFunctions; 00132 unsigned int m_SplineOrder; 00133 }; 00134 } // end namespace itk 00135 00136 #ifndef ITK_MANUAL_INSTANTIATION 00137 #include "itkCoxDeBoorBSplineKernelFunction.hxx" 00138 #endif 00139 00140 #endif 00141