10 template <
class TScalarType>
15 m_FirstAngle.Fill(itk::NumericTraits<TScalarType>::Zero);
16 m_SecondAngle.Fill(itk::NumericTraits<TScalarType>::Zero);
17 m_LogScale.Fill(itk::NumericTraits<TScalarType>::Zero);
21 template <
class TScalarType>
26 m_FirstAngle[0] = parameters[0];
27 m_FirstAngle[1] = parameters[1];
28 m_FirstAngle[2] = parameters[2];
32 m_LogScale[0] = parameters[6];
33 m_LogScale[1] = parameters[7];
34 m_LogScale[2] = parameters[8];
36 m_SecondAngle[0] = parameters[9];
37 m_SecondAngle[1] = parameters[10];
38 m_SecondAngle[2] = parameters[11];
41 newTranslation[0] = parameters[3];
42 newTranslation[1] = parameters[4];
43 newTranslation[2] = parameters[5];
45 this->SetTranslation(newTranslation);
47 this->ComputeMatrix();
48 this->ComputeOffset();
58 template <
class TScalarType>
63 this->m_Parameters[0] = this->GetFirstAngle()[0];
64 this->m_Parameters[1] = this->GetFirstAngle()[1];
65 this->m_Parameters[2] = this->GetFirstAngle()[2];
67 this->m_Parameters[3] = this->GetTranslation()[0];
68 this->m_Parameters[4] = this->GetTranslation()[1];
69 this->m_Parameters[5] = this->GetTranslation()[2];
71 this->m_Parameters[6] = this->GetLogScale()[0];
72 this->m_Parameters[7] = this->GetLogScale()[1];
73 this->m_Parameters[8] = this->GetLogScale()[2];
75 this->m_Parameters[9] = this->GetSecondAngle()[0];
76 this->m_Parameters[10] = this->GetSecondAngle()[1];
77 this->m_Parameters[11] = this->GetSecondAngle()[2];
79 return this->m_Parameters;
82 template <
class TScalarType>
87 m_FirstAngle.Fill(itk::NumericTraits <TScalarType>::Zero);
88 m_LogScale.Fill(itk::NumericTraits <TScalarType>::Zero);
89 m_SecondAngle.Fill(itk::NumericTraits <TScalarType>::Zero);
92 newTranslation.Fill(0.0);
94 this->SetTranslation(newTranslation);
96 this->ComputeMatrix();
97 this->ComputeOffset();
100 template <
class TScalarType>
105 m_FirstAngle = angle;
106 this->ComputeMatrix();
107 this->ComputeOffset();
110 template <
class TScalarType>
116 this->ComputeMatrix();
117 this->ComputeOffset();
120 template <
class TScalarType>
125 m_SecondAngle = angle;
126 this->ComputeMatrix();
127 this->ComputeOffset();
131 template <
class TScalarType>
136 std::vector <TScalarType> angles(3, 0.0);
137 for (
unsigned int i = 0;i < InputSpaceDimension;++i)
138 angles[i] = m_FirstAngle[i];
140 vnl_matrix <TScalarType> firstRotationMatrix;
143 vnl_matrix <TScalarType> scaleMatrix(InputSpaceDimension, InputSpaceDimension);
144 scaleMatrix.set_identity();
145 for (
unsigned int i = 0;i < InputSpaceDimension;++i)
146 scaleMatrix(i,i) = std::exp(m_LogScale[i]);
148 for (
unsigned int i = 0;i < InputSpaceDimension;++i)
149 angles[i] = m_SecondAngle[i];
151 vnl_matrix <TScalarType> secondRotationMatrix;
154 MatrixType varMatrix = firstRotationMatrix * scaleMatrix * secondRotationMatrix;
155 this->SetVarMatrix (varMatrix);
158 template <
class TScalarType>
163 itkExceptionMacro( <<
"Setting the matrix of a SplitAffine3D transform is not supported at this time." );
167 template<
class TScalarType>
173 Superclass::PrintSelf(os,indent);
175 os << indent <<
"First angle: " << m_FirstAngle << std::endl;
176 os << indent <<
"Scale: " << m_LogScale << std::endl;
177 os << indent <<
"Second angle: " << m_SecondAngle << std::endl;
void Get3DRotationExponential(const std::vector< T > &angles, vnl_matrix< T > &outputRotation)
Computation of a 3D rotation matrix exponential. Rodrigues' explicit formula.