1 #include "PlaneReorientation.h"
6 //------------------------------------------------------------
7 PlaneReorientation::PlaneReorientation()
9 _transform=vtkTransform::New();
15 //------------------------------------------------------------
16 PlaneReorientation::~PlaneReorientation()
18 if (_transform != NULL ) { _transform->Delete(); }
21 void PlaneReorientation::CalculateNormal()
23 normal[0]=(a[1]*b[2])-(a[2]*b[1]);
24 normal[1]=(a[2]*b[0])-(a[0]*b[2]);
25 normal[2]=(a[0]*b[1])-(a[1]*b[0]);
27 vtkMath::Normalize(normal);
29 std::cout << "Normal axis : " << "X: " << normal[0] << " Y: " << normal[1] << " Z: " << normal[2] << std::endl;
32 void PlaneReorientation::SetVectors(std::vector<int> pointsX, std::vector<int> pointsY, std::vector<int> pointsZ, std::vector<std::string> labels)
34 //This part is for head reorientation using the chiasma and optical nerves
35 if(labels[0].compare("CHIASMA") == 0 || labels[1].compare("CHIASMA") == 0 || labels[2].compare("CHIASMA") == 0)
38 for(i = 0; i < 2; i++)
40 //Gets the point that represents the optic chiasma and sets it as the origin point
41 if(labels[i].compare("CHIASMA")==0)
47 //The point that represents the right eye (and subsequent first vector)
48 else if(labels[i].compare("RY")==0)
54 //The point that represents the left eye (and subsequent second vector)
55 else if(labels[i].compare("LY")==0)
63 //Creates the first vector
68 //Creates the second vector
76 a[0] = pointsX[1]-pointsX[0];
77 a[1] = pointsY[1]-pointsY[0];
78 a[2] = pointsZ[1]-pointsZ[0];
81 b[0] = pointsX[2]-pointsX[0];
82 b[1] = pointsY[2]-pointsY[0];
83 b[2] = pointsZ[2]-pointsZ[0];
87 vtkTransform* PlaneReorientation::getTransform()
92 void PlaneReorientation::Run()