KWStyle - itkThinPlateSplineKernelTransform.txx
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkThinPlateSplineKernelTransform.txx.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:48 $
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 _itkThinPlateSplineKernelTransform_txx
18 DEF #define _itkThinPlateSplineKernelTransform_txx
19 #include "itkThinPlateSplineKernelTransform.h"
20
21 namespace itk
22 {
23
24 template <class TScalarType, unsigned int NDimensions>
25 LEN const typename ThinPlateSplineKernelTransform<TScalarType, NDimensions>::GMatrixType &
26 ThinPlateSplineKernelTransform<TScalarType, NDimensions>::
27 ComputeG(const InputVectorType & x) const
28 {
29
30   const TScalarType r = x.GetNorm();
31   this->m_GMatrix.fill( NumericTraits< TScalarType >::Zero );
32   for(unsigned int i=0; i<NDimensions; i++)
33     {
34     this->m_GMatrix[i][i] = r;
35     }
36   return this->m_GMatrix;
37 }
38
39
40 EML
41 template <class TScalarType, unsigned int NDimensions>
42 void
43 ThinPlateSplineKernelTransform<TScalarType, NDimensions>::
44 ComputeDeformationContribution( const InputPointType  & thisPoint,
45                                 OutputPointType & result     ) const
46 {
47
48 LEN   unsigned long numberOfLandmarks = this->m_SourceLandmarks->GetNumberOfPoints();
49
50   PointsIterator sp  = this->m_SourceLandmarks->GetPoints()->Begin();
51
52   for(unsigned int lnd=0; lnd < numberOfLandmarks; lnd++ )
53     {
54     InputVectorType position = thisPoint - sp->Value();
55     const TScalarType r = position.GetNorm();
56
57     for(unsigned int odim=0; odim < NDimensions; odim++ )
58       {
59       result[ odim ] += r * this->m_DMatrix(odim,lnd);
60       }
61     ++sp;
62     }
63
64 }
65
66
67 // namespace itk
68 #endif
69

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:50PM
© Kitware Inc.