/*========================================================================= Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: itkThinPlateSplineKernelTransform2.txx,v $ Language: C++ Date: $Date: 2006-11-28 14:22:18 $ Version: $Revision: 1.1 $ Copyright (c) Insight Software Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef _itkThinPlateSplineKernelTransform2_txx #define _itkThinPlateSplineKernelTransform2_txx #include "itkThinPlateSplineKernelTransform2.h" namespace itk { template const typename ThinPlateSplineKernelTransform2::GMatrixType & ThinPlateSplineKernelTransform2:: ComputeG(const InputVectorType & x) const { const TScalarType r = x.GetNorm(); this->m_GMatrix.fill( NumericTraits< TScalarType >::Zero ); for(unsigned int i=0; im_GMatrix[i][i] = r; } return this->m_GMatrix; } template void ThinPlateSplineKernelTransform2:: ComputeDeformationContribution( const InputPointType & thisPoint, OutputPointType & result ) const { unsigned long numberOfLandmarks = this->m_SourceLandmarks->GetNumberOfPoints(); PointsIterator sp = this->m_SourceLandmarks->GetPoints()->Begin(); for(unsigned int lnd=0; lnd < numberOfLandmarks; lnd++ ) { InputVectorType position = thisPoint - sp->Value(); const TScalarType r = position.GetNorm(); for(unsigned int odim=0; odim < NDimensions; odim++ ) { result[ odim ] += r * this->m_DMatrix(odim,lnd); } ++sp; } } } // namespace itk #endif