Commit 1239b41cbdf404f68c0f3a6e069e1bedcec1fbd4

Authored by Victor Hugo Souza
Committed by GitHub
1 parent 6e48b67a
Exists in master

FIX: Add pixel spacing in inv to voxel coordinate transformation (#385)

* FIX: Add pixel spacing in inv to voxel coordinate transformation

* FIX: Apply the conversion to the unitary voxel shift to mantain the range
Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
invesalius/data/imagedata_utils.py
@@ -606,7 +606,7 @@ def convert_invesalius_to_voxel(position): @@ -606,7 +606,7 @@ def convert_invesalius_to_voxel(position):
606 :return: a vector of 3 coordinates in the voxel space 606 :return: a vector of 3 coordinates in the voxel space
607 """ 607 """
608 slice = sl.Slice() 608 slice = sl.Slice()
609 - return np.array((position[0], slice.matrix.shape[1] - position[1] - 1, position[2])) 609 + return np.array((position[0], slice.spacing[1]*(slice.matrix.shape[1] - 1) - position[1], position[2]))
610 610
611 611
612 def convert_invesalius_to_world(position, orientation): 612 def convert_invesalius_to_world(position, orientation):