KWStyle - itkThinPlateR2LogRSplineKernelTransform.txx
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkThinPlateR2LogRSplineKernelTransform.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 _itkThinPlateR2LogRSplineKernelTransform_txx
18 DEF #define _itkThinPlateR2LogRSplineKernelTransform_txx
19 #include "itkThinPlateR2LogRSplineKernelTransform.h"
20
21 namespace itk
22 {
23
24 template <class TScalarType, unsigned int NDimensions>
25 LEN const typename ThinPlateR2LogRSplineKernelTransform<TScalarType, NDimensions>::GMatrixType &
26 ThinPlateR2LogRSplineKernelTransform<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   const TScalarType R2logR = 
33 IND ****( r > 1e-8 )? r * r * log( r ) : NumericTraits<TScalarType>::Zero;
34
35   this->m_GMatrix.fill_diagonal( R2logR );
36  
37   return this->m_GMatrix;
38 }
39
40
41 template <class TScalarType, unsigned int NDimensions>
42 void
43 ThinPlateR2LogRSplineKernelTransform<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     const TScalarType R2logR = 
57 IND ******( r > 1e-8 )? r * r * log( r ) : NumericTraits<TScalarType>::Zero;
58     for(unsigned int odim=0; odim < NDimensions; odim++ )
59       {
60       result[ odim ] += R2logR * this->m_DMatrix(odim,lnd);
61       }
62     ++sp;
63     }
64
65 }
66
67
68 // namespace itk
69 #endif
70

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