7 template <
class TScalarType>
12 m_Theta = m_Phi = m_Distance = itk::NumericTraits<ScalarType>::Zero;
14 m_CenterTransform.SetIdentity();
15 m_CenterTransformInv.SetIdentity();
17 this->ComputeMatrix();
21 template <
class TScalarType>
26 this->SetMatrix(matrix);
37 template <
class TScalarType>
40 unsigned int parametersDimension):
41 Superclass(spaceDimension, parametersDimension)
43 m_Theta = m_Phi = m_Distance = itk::NumericTraits<ScalarType>::Zero;
45 m_CenterTransform.SetIdentity();
46 m_CenterTransformInv.SetIdentity();
48 this->ComputeMatrix();
51 template <
class TScalarType>
56 m_CenterTransform.SetIdentity();
57 m_CenterTransformInv.SetIdentity();
59 for (
unsigned int i = 0;i < 3;++i)
61 m_CenterTransform(i,3) = rotCenter[i];
62 m_CenterTransformInv(i,3) = - rotCenter[i];
65 this->ComputeMatrix();
72 template <
class TScalarType>
77 itkDebugMacro( <<
"Setting parameters " << parameters );
80 m_Theta = parameters[0];
81 m_Phi = parameters[1];
82 m_Distance = parameters[2];
84 this->ComputeMatrix();
89 itkDebugMacro(<<
"After setting parameters ");
94 template <
class TScalarType>
99 this->m_Parameters[0] = m_Theta;
100 this->m_Parameters[1] = m_Phi;
101 this->m_Parameters[2] = m_Distance;
103 return this->m_Parameters;
107 template <
class TScalarType>
112 Superclass::SetIdentity();
117 this->ComputeMatrix();
121 template <
class TScalarType>
126 double cosa, sina, cosb, sinb;
128 cosa = std::cos(m_Theta);
129 sina = std::sin(m_Theta);
130 cosb = std::cos(m_Phi);
131 sinb = std::sin(m_Phi);
133 double d = m_Distance;
136 rotationMatrix.SetIdentity();
138 rotationMatrix[0][0] = 1-2*cosb*cosb*cosa*cosa;
139 rotationMatrix[0][1] = -2*cosb*sinb*cosa*cosa;
140 rotationMatrix[0][2] = -2*cosb*cosa*sina;
142 rotationMatrix[1][0] = rotationMatrix[0][1];
143 rotationMatrix[1][1] = 1-2*sinb*sinb*cosa*cosa;
144 rotationMatrix[1][2] = -2*sinb*cosa*sina;
146 rotationMatrix[2][0] = rotationMatrix[0][2];
147 rotationMatrix[2][1] = rotationMatrix[1][2];
148 rotationMatrix[2][2] = 1-2*sina*sina;
150 rotationMatrix[0][3] = 2*d*cosb*cosa;
151 rotationMatrix[1][3] = 2*d*sinb*cosa;
152 rotationMatrix[2][3] = 2*d*sina;
154 rotationMatrix = m_CenterTransform * rotationMatrix * m_CenterTransformInv;
159 for (
unsigned int i = 0;i < 3;++i)
161 off[i] = rotationMatrix(i,3);
162 for (
unsigned int j = 0;j < 3;++j)
163 linearMatrix(i,j) = rotationMatrix(i,j);
166 this->SetMatrix(linearMatrix);
167 this->SetOffset(off);
171 template<
class TScalarType>
176 Superclass::PrintSelf(os,indent);
178 os << indent <<
"Symmetry plane parameters: Theta=" << m_Theta
180 <<
" Distance=" << m_Distance
181 <<
" Center transform=" << m_CenterTransform