]> Creatis software - clitk.git/blobdiff - common/clitkTransformUtilities.h
Add GetRotationMatrix2D and GetRotationMatrix wrapper
[clitk.git] / common / clitkTransformUtilities.h
index a6fdd8c6a33f2670d9d665896d458f9cb1c7462c..b9a540a672a23602a33a8b919ed208eba4156823 100644 (file)
@@ -38,6 +38,8 @@ namespace clitk
   template <unsigned int Dimension > itk::Matrix<double, Dimension+1, Dimension+1> GetBackwardAffineMatrix(itk::Array<double> transformParameters);
 
   itk::Matrix<double, 3, 3> GetRotationMatrix3D(itk::Array<double> rotationParameters);
+  itk::Matrix<double, 2, 2> GetRotationMatrix2D(itk::Array<double> rotationParameters);
+  template <unsigned int Dimension> itk::Matrix<double, Dimension, Dimension> GetRotationMatrix(itk::Array<double> rotationParameters);
   itk::Point<double, 3> GetRotatedPoint3D(itk::Array<double> rotationParameters, itk::Point<double, 3> input);
   itk::Matrix<double, 4, 4> GetCenteredRotationMatrix3D(itk::Array<double> rotationParameters,itk::Point<double,3> centerOfRotation);
   //   itk::Matrix<double, 4, 4> GetComposedMatrix3D(itk::Matrix<double, 4, 4> firstTransform, itk::Matrix<double, 4, 4> secondTransform);
@@ -166,9 +168,17 @@ namespace clitk
     matrix[2][2]= cos(rotationParameters[0])*cos(rotationParameters[1]);
     return matrix;
   }
+
+  inline itk::Matrix<double, 2, 2> GetRotationMatrix2D(itk::Array<double> rotationParameters)
+  {
+    itk::Matrix<double, 2, 2> matrix;
+    matrix[0][0] = cos(rotationParameters[0]);
+    matrix[1][0] = sin(rotationParameters[0]);
+    matrix[0][1] = -matrix[1][0];
+    matrix[1][1] = matrix[0][0];
+    return matrix;
+  }
+
   //========================================================================================
   inline  itk::Point<double, 3> GetRotatedPoint3D(itk::Array<double> rotationParameters, itk::Point<double, 3> input)
   {