2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
27 #include "PlaneReorientation.h"
32 //------------------------------------------------------------
33 PlaneReorientation::PlaneReorientation()
35 _transform=vtkTransform::New();
41 //------------------------------------------------------------
42 PlaneReorientation::~PlaneReorientation()
44 if (_transform != NULL ) { _transform->Delete(); }
47 void PlaneReorientation::CalculateNormal()
49 normal[0]=(a[1]*b[2])-(a[2]*b[1]);
50 normal[1]=(a[2]*b[0])-(a[0]*b[2]);
51 normal[2]=(a[0]*b[1])-(a[1]*b[0]);
53 vtkMath::Normalize(normal);
55 std::cout << "Normal axis : " << "X: " << normal[0] << " Y: " << normal[1] << " Z: " << normal[2] << std::endl;
58 void PlaneReorientation::SetVectors(std::vector<int> pointsX, std::vector<int> pointsY, std::vector<int> pointsZ, std::vector<std::string> labels)
60 //This part is for head reorientation using the chiasma and optical nerves
61 if(labels[0].compare("CHIASMA") == 0 || labels[1].compare("CHIASMA") == 0 || labels[2].compare("CHIASMA") == 0)
64 for(i = 0; i < 2; i++)
66 //Gets the point that represents the optic chiasma and sets it as the origin point
67 if(labels[i].compare("CHIASMA")==0)
73 //The point that represents the right eye (and subsequent first vector)
74 else if(labels[i].compare("RY")==0)
80 //The point that represents the left eye (and subsequent second vector)
81 else if(labels[i].compare("LY")==0)
89 //Creates the first vector
94 //Creates the second vector
102 a[0] = pointsX[1]-pointsX[0];
103 a[1] = pointsY[1]-pointsY[0];
104 a[2] = pointsZ[1]-pointsZ[0];
107 b[0] = pointsX[2]-pointsX[0];
108 b[1] = pointsY[2]-pointsY[0];
109 b[2] = pointsZ[2]-pointsZ[0];
113 vtkTransform* PlaneReorientation::getTransform()
118 void PlaneReorientation::Run()