17 #ifndef __itkCenteredAffineTransform_txx
18 #define __itkCenteredAffineTransform_txx
20 #include "itkNumericTraits.h"
22 #include "vnl/algo/vnl_matrix_inverse.h"
29 template<
class TScalarType,
unsigned int NDimensions>
36 template<
class TScalarType,
unsigned int NDimensions>
44 template<
class TScalarType,
unsigned int NDimensions>
46 NDimensions>::ParametersType &
56 for(
unsigned int row=0; row<NDimensions; row++)
58 for(
unsigned int col=0; col<NDimensions; col++)
60 this->m_Parameters[par] = matrix[row][col];
68 for(
unsigned int j=0; j<NDimensions; j++)
70 this->m_Parameters[par] = center[j];
76 for(
unsigned int k=0; k<NDimensions; k++)
78 this->m_Parameters[par] = translation[k];
83 return this->m_Parameters;
88 template<
class TScalarType,
unsigned int NDimensions>
97 this->m_Parameters = parameters;
101 for(
unsigned int row=0; row<NDimensions; row++)
103 for(
unsigned int col=0; col<NDimensions; col++)
105 matrix[row][col] = this->m_Parameters[par];
110 this->SetMatrix( matrix );
114 for(
unsigned int i=0; i<NDimensions; i++)
116 center[i] = this->m_Parameters[par];
119 this->SetCenter(center);
123 for(
unsigned int k=0; k<NDimensions; k++)
125 translation[k] = this->m_Parameters[par];
128 this->SetTranslation(translation);
138 template<
class TScalarType,
unsigned int NDimensions>
151 this->m_Jacobian.Fill( 0.0 );
154 unsigned int blockOffset = 0;
156 for(
unsigned int block=0; block < SpaceDimension; block++)
158 for(
unsigned int dim=0; dim < SpaceDimension; dim++ )
160 this->m_Jacobian( block , blockOffset + dim ) = p[dim];
162 blockOffset += SpaceDimension;
166 const MatrixType & matrix = this->GetMatrix();
167 for(
unsigned int k=0; k < SpaceDimension; k++)
169 this->m_Jacobian( k, blockOffset + k ) = 1.0;
170 for(
unsigned int dim=0; dim < SpaceDimension; dim++ )
172 this->m_Jacobian( k, blockOffset + dim ) -= matrix[k][dim];
175 blockOffset += SpaceDimension;
178 for(
unsigned int dim=0; dim < SpaceDimension; dim++ )
180 this->m_Jacobian( dim , blockOffset + dim ) = 1.0;
183 return this->m_Jacobian;
188 template<
class TScalarType,
unsigned int NDimensions>
193 return this->Superclass::GetInverse(inverse);
197 template<
class TScalarType,
unsigned int NDimensions>