]> Creatis software - clitk.git/blobdiff - common/clitkTransformUtilities.h
Merge branch 'master' of git.creatis.insa-lyon.fr:clitk
[clitk.git] / common / clitkTransformUtilities.h
index 47f92ce2b56063a7a6b63e8123b7a100725010b1..3bdf22026ee0ab969a5fe8f6274db3a0fd4fa2e3 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
@@ -32,12 +32,15 @@ namespace clitk
   //============================================================================
   itk::Matrix<double, 3, 3> GetForwardAffineMatrix2D(itk::Array<double> transformParameters);
   itk::Matrix<double, 4, 4> GetForwardAffineMatrix3D(itk::Array<double> transformParameters);
+  template <unsigned int Dimension > itk::Matrix<double, Dimension+1, Dimension+1> GetForwardAffineMatrix(itk::Array<double> transformParameters);
 
   itk::Matrix<double, 3, 3> GetBackwardAffineMatrix2D(itk::Array<double> transformParameters);
   itk::Matrix<double, 4, 4> GetBackwardAffineMatrix3D(itk::Array<double> transformParameters);
   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);
@@ -151,12 +154,6 @@ namespace clitk
     return matrix;
   }
   
-  template <unsigned int Dimension >
-  inline itk::Matrix<double, Dimension+1, Dimension+1>
-  GetBackwardAffineMatrix(itk::Array<double> transformParameters)
-  {
-  }
-
   inline itk::Matrix<double, 3, 3> GetRotationMatrix3D(itk::Array<double> rotationParameters)
   {
     itk::Matrix<double, 3, 3> matrix;
@@ -172,9 +169,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)
   {