1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
19 #include "clitkTransformUtilities.h"
24 //--------------------------------------------------------------------
26 itk::Matrix<double, 3, 3>
27 GetForwardAffineMatrix<2>(itk::Array<double> transformParameters)
29 return GetForwardAffineMatrix2D(transformParameters);
32 //--------------------------------------------------------------------
34 itk::Matrix<double, 4, 4>
35 GetForwardAffineMatrix<3>(itk::Array<double> transformParameters)
37 return GetForwardAffineMatrix3D(transformParameters);
40 //--------------------------------------------------------------------
42 itk::Matrix<double, 3, 3>
43 GetBackwardAffineMatrix<2>(itk::Array<double> transformParameters)
45 return GetBackwardAffineMatrix2D(transformParameters);
48 //--------------------------------------------------------------------
50 itk::Matrix<double, 4, 4>
51 GetBackwardAffineMatrix<3>(itk::Array<double> transformParameters)
53 return GetBackwardAffineMatrix3D(transformParameters);
56 //--------------------------------------------------------------------
58 itk::Matrix<double, 2, 2> GetRotationMatrix<2>(itk::Array<double> rotationParameters)
60 return GetRotationMatrix2D(rotationParameters);
63 //--------------------------------------------------------------------
65 itk::Matrix<double, 3, 3> GetRotationMatrix<3>(itk::Array<double> rotationParameters)
67 return GetRotationMatrix3D(rotationParameters);
70 //--------------------------------------------------------------------
71 itk::Matrix<double, 4, 4> ReadMatrix3D(std::string fileName)
75 openFileForReading(is, fileName);
76 std::vector<double> nb;
80 while (is && !is.eof()) {
87 itkGenericExceptionMacro(<< "Could not read 4x4 matrix in " << fileName);
89 //copy it to the matrix
90 itk::Matrix<double, 4, 4> matrix;
92 for (unsigned int i=0;i<4;i++)
93 for (unsigned int j=0;j<4;j++)
94 matrix[i][j]=nb[index++];