Right now the fiducial list, the markups, are shown as green dots. For a better representation of the electrode, a cylinder with radius and height according to the electrodes.config 025157a
update list:
import numpy as np to shorten line of code
added import math as m
the computation of P3 for the vtkline inside the if createVTK.checked: is moved before the for p in range(0, (len(points) - 1), 3): (this for add the fiducial list with a = fidNode.AddFiducial(float(points[p]), float(points[p + 1]), float(points[p + 2])). The meaning of this, is that the computation of the cylinder rotation, it requires the P3 value. instead of calculate once again P3 two times, i preferred to move the computation of P3 earlier
the computation of the cylinder is calculated inside the for p in range(0, (len(points) - 1), 3): together with the a = fidNode.AddFiducial(float(points[p]), float(points[p + 1]), float(points[p + 2])). So the moment we add a fiducial list (the moment we add a green dot on the screen that represent our fiducial node) we create a cylinder at (0,0,0) rotate it accordingly to the direction of P1 and P3 and then moved where the new fiducial node is added. The computation of the rotation of the cylinder is done using the euler angles. Given the points P1 and P3 we compute the rotation matrix and then pass it to the cylinder vtktransform
added function def mat4x4Gen(self, m):. From quaternion generate an object vtkMatrix4x4
added function def mat3To4(self, m,x,y,z):. From a matrix 3x3 add rows and column to generate a 4x4 matrix
added function def fromRotMat(self, R):. From a rotation matrix compute the euler angles. Not used but useful
added fucntion def rotMat(self, vec2):. Compute the rotation matrix between the vector (P1,P3) and vector (0,1,0). The meaning of (0,1,0) is that the cylinder at (0,0,0) is rotated like a vector pointing at (0,1,0)
Right now the fiducial list, the markups, are shown as green dots. For a better representation of the electrode, a cylinder with radius and height according to the electrodes.config 025157a
update list:
import numpy as np
to shorten line of codeimport math as m
if createVTK.checked:
is moved before thefor p in range(0, (len(points) - 1), 3):
(this for add the fiducial list witha = fidNode.AddFiducial(float(points[p]), float(points[p + 1]), float(points[p + 2]))
. The meaning of this, is that the computation of the cylinder rotation, it requires the P3 value. instead of calculate once again P3 two times, i preferred to move the computation of P3 earlierfor p in range(0, (len(points) - 1), 3):
together with thea = fidNode.AddFiducial(float(points[p]), float(points[p + 1]), float(points[p + 2]))
. So the moment we add a fiducial list (the moment we add a green dot on the screen that represent our fiducial node) we create a cylinder at (0,0,0) rotate it accordingly to the direction of P1 and P3 and then moved where the new fiducial node is added. The computation of the rotation of the cylinder is done using the euler angles. Given the points P1 and P3 we compute the rotation matrix and then pass it to the cylinder vtktransformdef mat4x4Gen(self, m):
. From quaternion generate an object vtkMatrix4x4def mat3To4(self, m,x,y,z):
. From a matrix 3x3 add rows and column to generate a 4x4 matrixdef fromRotMat(self, R):
. From a rotation matrix compute the euler angles. Not used but usefuldef rotMat(self, vec2):
. Compute the rotation matrix between the vector (P1,P3) and vector (0,1,0). The meaning of (0,1,0) is that the cylinder at (0,0,0) is rotated like a vector pointing at (0,1,0)