/*========================================================================= Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: itkVolumeSplineKernelTransform2.txx,v $ Language: C++ Date: $Date: 2006/03/18 18:06:38 $ Version: $Revision: 1.8 $ 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 __itkVolumeSplineKernelTransform2_txx #define __itkVolumeSplineKernelTransform2_txx #include "itkVolumeSplineKernelTransform2.h" namespace itk { template const typename VolumeSplineKernelTransform2::GMatrixType & VolumeSplineKernelTransform2:: ComputeG(const InputVectorType & x) const { const TScalarType r = x.GetNorm(); this->m_GMatrix.fill( NumericTraits< TScalarType >::Zero ); const TScalarType r3 = r * r * r; for(unsigned int i=0; im_GMatrix[i][i] = r3; } return this->m_GMatrix; } template void VolumeSplineKernelTransform2:: 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(); const TScalarType r3 = r * r * r; for(unsigned int odim=0; odim < NDimensions; odim++ ) { result[ odim ] += r3 * this->m_DMatrix(odim,lnd); } ++sp; } } } // namespace itk #endif