KWStyle - itkVolumeSplineKernelTransform.txx
 
Matrix View
Description

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

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