17 #ifndef __itkScalableAffineTransform_txx
18 #define __itkScalableAffineTransform_txx
20 #include "itkNumericTraits.h"
23 #include "vnl/algo/vnl_matrix_inverse.h"
30 template<
class TScalarType,
unsigned int NDimensions>
35 for (
unsigned int i=0; i<NDimensions; i++)
43 template<
class TScalarType,
unsigned int NDimensions>
46 unsigned int parametersDimension )
47 :
Superclass(outputSpaceDimension, parametersDimension)
49 for (
unsigned int i=0; i<NDimensions; i++)
57 template<
class TScalarType,
unsigned int NDimensions>
63 for (
unsigned int i=0; i<NDimensions; i++)
71 template<
class TScalarType,
unsigned int NDimensions>
79 template<
class TScalarType,
unsigned int NDimensions>
84 Superclass::PrintSelf(os,indent);
88 os << indent <<
"Scale : ";
89 for (i = 0; i < NDimensions; i++)
91 os << m_Scale[i] <<
" ";
94 os << indent <<
"MatrixScale : ";
95 for (i = 0; i < NDimensions; i++)
97 os << m_MatrixScale[i] <<
" ";
104 template<
class TScalarType,
unsigned int NDimensions>
109 for (
unsigned int i=0; i<NDimensions; i++)
112 m_MatrixScale[i] = 1;
114 this->Superclass::SetIdentity();
119 template<
class TScalarType,
unsigned int NDimensions>
125 for (i=0; i<NDimensions; i++)
127 m_Scale[i] = scale[i];
129 this->ComputeMatrix();
133 template<
class TScalarType,
unsigned int NDimensions>
139 for (i=0; i<NDimensions; i++)
141 m_Scale[i] = scale[i];
143 this->ComputeMatrix();
148 template<
class TScalarType,
unsigned int NDimensions>
153 return this->Superclass::GetInverse(inverse);
157 template<
class TScalarType,
unsigned int NDimensions>
159 ::InverseTransformBasePointer
168 template<
class TScalarType,
unsigned int NDimensions>
174 for (i=0; i<NDimensions; i++)
176 if(m_Scale[i] != m_MatrixScale[i])
181 if ( i < NDimensions )
185 for (i=0; i<NDimensions; i++)
187 if(m_MatrixScale[i] != 0 && m_Scale[i] != 0)
189 imat.put(i, i, m_Scale[i]/m_MatrixScale[i] * this->GetMatrix()[i][i]);
190 m_MatrixScale[i] = m_Scale[i];
195 m_MatrixScale[i] = 1;
196 imat.put(i, i, this->GetMatrix()[i][i]);
199 Superclass::SetVarMatrix(mat);