]> Creatis software - clitk.git/blobdiff - common/clitkTransformUtilities.h
Add GetRotationMatrix2D and GetRotationMatrix wrapper
[clitk.git] / common / clitkTransformUtilities.h
index 778fc973e18b82cfba176746abba3a2c90f3a77a..b9a540a672a23602a33a8b919ed208eba4156823 100644 (file)
@@ -3,7 +3,7 @@
 
   Authors belong to: 
   - University of LYON              http://www.universite-lyon.fr/
-  - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
 
   This software is distributed WITHOUT ANY WARRANTY; without even
@@ -14,7 +14,7 @@
 
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-======================================================================-====*/
+===========================================================================**/
 
 #ifndef CLITKTRANSFORMUTILITIES_H
 #define CLITKTRANSFORMUTILITIES_H
@@ -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)
   {