]> Creatis software - creaRigidRegistration.git/blobdiff - PackRecalage/src/bbPackRecalageTransform3D3PointsBox.cxx
#2810 crea RigidRegistration Bug New Normal - update Transform3D3PointsBox
[creaRigidRegistration.git] / PackRecalage / src / bbPackRecalageTransform3D3PointsBox.cxx
index b4eb9dff0d9df561c9b8bf1da9f4165f798ff063..219da2bc1218f1697bca4b91492cba2c95b1272b 100644 (file)
@@ -1,3 +1,29 @@
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
+#                        pour la Santé)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+#
+#  This software is governed by the CeCILL-B license under French law and 
+#  abiding by the rules of distribution of free software. You can  use, 
+#  modify and/ or redistribute the software under the terms of the CeCILL-B 
+#  license as circulated by CEA, CNRS and INRIA at the following URL 
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability. 
+#
+#  The fact that you are presently reading this means that you have had
+#  knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------   
+*/
+
+
 #include "bbPackRecalageTransform3D3PointsBox.h"
 #include "bbPackRecalagePackage.h"
 namespace bbPackRecalage
@@ -160,18 +186,18 @@ void Transform3D3PointsBox::Process()
                //Calculates the new position of the points after the first transformation
                double A2N[3]; 
                A2N[0] = A2[0]*newMatrix[0][0] + A2[0]*newMatrix[0][1] + A2[0]*newMatrix[0][2];
-               A2N[1] = A2[1]*newMatrix[1][0] + A2[0]*newMatrix[1][1] + A2[0]*newMatrix[1][2];
-               A2N[2] = A2[2]*newMatrix[2][0] + A2[0]*newMatrix[2][1] + A2[0]*newMatrix[2][2];
+               A2N[1] = A2[1]*newMatrix[1][0] + A2[1]*newMatrix[1][1] + A2[1]*newMatrix[1][2];
+               A2N[2] = A2[2]*newMatrix[2][0] + A2[2]*newMatrix[2][1] + A2[2]*newMatrix[2][2];
 
                double B2N[3]; 
                B2N[0] = B2[0]*newMatrix[0][0] + B2[0]*newMatrix[0][1] + B2[0]*newMatrix[0][2];
-               B2N[1] = B2[1]*newMatrix[1][0] + B2[0]*newMatrix[1][1] + B2[0]*newMatrix[1][2];
-               B2N[2] = B2[2]*newMatrix[2][0] + B2[0]*newMatrix[2][1] + B2[0]*newMatrix[2][2];
+               B2N[1] = B2[1]*newMatrix[1][0] + B2[1]*newMatrix[1][1] + B2[1]*newMatrix[1][2];
+               B2N[2] = B2[2]*newMatrix[2][0] + B2[2]*newMatrix[2][1] + B2[2]*newMatrix[2][2];
 
                double O2N[3]; 
                O2N[0] = O2[0]*newMatrix[0][0] + O2[0]*newMatrix[0][1] + O2[0]*newMatrix[0][2];
-               O2N[1] = O2[1]*newMatrix[1][0] + O2[0]*newMatrix[1][1] + O2[0]*newMatrix[1][2];
-               O2N[2] = O2[2]*newMatrix[2][0] + O2[0]*newMatrix[2][1] + O2[0]*newMatrix[2][2];
+               O2N[1] = O2[1]*newMatrix[1][0] + O2[1]*newMatrix[1][1] + O2[1]*newMatrix[1][2];
+               O2N[2] = O2[2]*newMatrix[2][0] + O2[2]*newMatrix[2][1] + O2[2]*newMatrix[2][2];
 
                ///////////////////////////////////////////////////////////////////////////////
                //Creation of the two planes for the second transformation
@@ -209,6 +235,22 @@ void Transform3D3PointsBox::Process()
 
                transformer->SetSecondAngle(-anglePlanes);
 
+
+               double * vector2B;
+               vector2B = planes->makeVector(O2, B2);
+               double mag1= planes->getMagnitud(vector1B);
+               double mag2= planes->getMagnitud(vector2B);
+               transformer->SetScale(mag1/mag2);
+
+
+/*
+               double * vector2B;
+               vector2B = planes->makeVector(O2, B2);
+               double mag1= planes->getMagnitud(vector1);
+               double mag2= planes->getMagnitud(vector2);
+               transformer->SetScale(mag2/mag1);
+*/
+
                // The calculation of the transformations are made
                transformer->Run();