is it possible to measure the distance between two fiducials separated to the three main axes (frontal, sagittal, axial)? I not only need the exact distance (hypotenuse of a right triangle) between the two points, but also would like to know the distance projection according to the 3 axes (legs of a right triangle).
You should create a Fiducial node with 2 points.
Either you rename the fiducial node to âForumProblemâ, or you change this identifier in the code snippet to your fiducial nodeâs display name, typically âFâ.
And itâs always a good idea to post error messages when requesting help.
... import math
File "<console>", line 7
import math
^
SyntaxError: invalid syntax
>>>
>>>
>>>
>>> fiducialNode = slicer.util.getNode("Fâ)
File "<console>", line 1
fiducialNode = slicer.util.getNode("Fâ)
^
SyntaxError: EOL while scanning string literal
>>>
>>> p1 = fiducialNode.GetNthControlPointPositionWorld(0)
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'fiducialNode' is not defined
>>>
>>> p2 = fiducialNode.GetNthControlPointPositionWorld(1)
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'fiducialNode' is not defined
>>>
>>>
>>>
>>> # Put p1 at origin. rp2 is p2 relative to p1
>>>
>>> rp2 = (p2[0] - p1[0], p2[1] - p1[1], p2[2] - p1[2])
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'p2' is not defined
>>>
>>>
>>>
>>> b = abs(rp2[0]) # LeftRight
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'rp2' is not defined
>>>
>>> a = abs(rp2[1]) # AnteriorPosterior
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'rp2' is not defined
>>>
>>> d = abs(rp2[2]) # InferiorSuperior
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'rp2' is not defined
>>>
>>>
>>>
>>> e = math.sqrt(vtk.vtkMath().Distance2BetweenPoints(p1, p2))
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'p1' is not defined
>>>
>>>
>>>
>>> # Check
>>>
>>> c1 = math.sqrt( (a * a) + (b * b) )
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'a' is not defined
>>>
>>> c2 = math.sqrt( (e * e) - ( d * d ) )
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'e' is not defined
>>>
>>> print(c1, c2)
An EOL ( End of Line ) error indicates that the Python interpreter expected a particular character or set of characters to have occurred in a specific line of code, but that those characters were not found before the end of the line . This results in Python stopping the program execution and throwing a syntax error .
The SyntaxError: EOL while scanning string literal error in python occurs when while scanning a string of a program the python hit the end of the line due to the following reasons: