From bf04c2ac3bef14ea83d23ccc3ed30dcef141adc9 Mon Sep 17 00:00:00 2001 From: Thiago Franco de Moraes Date: Tue, 29 Aug 2017 14:59:37 -0300 Subject: [PATCH] Fix: creation of square cursor (problem with float index in numpy) --- invesalius/data/cursor_actors.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/invesalius/data/cursor_actors.py b/invesalius/data/cursor_actors.py index 51abea6..a83635a 100644 --- a/invesalius/data/cursor_actors.py +++ b/invesalius/data/cursor_actors.py @@ -323,17 +323,17 @@ class CursorRectangle(CursorBase): r = self.radius sx, sy, sz = self.spacing if self.orientation == 'AXIAL': - x = math.floor(2*r/sx) - y = math.floor(2*r/sy) + x = int(math.floor(2*r/sx)) + y = int(math.floor(2*r/sy)) z = 1 elif self.orientation == 'CORONAL': - x = math.floor(r/sx) + x = int(math.floor(r/sx)) y = 1 - z = math.floor(r/sz) + z = int(math.floor(r/sz)) elif self.orientation == 'SAGITAL': x = 1 - y = math.floor(r/sy) - z = math.floor(r/sz) + y = int(math.floor(r/sy)) + z = int(math.floor(r/sz)) rectangle_m = numpy.ones((z, y, x), dtype='uint8') rectangle_i = to_vtk(rectangle_m, self.spacing, 0, self.orientation) @@ -353,13 +353,13 @@ class CursorRectangle(CursorBase): r = self.radius sx, sy, sz = self.spacing if self.orientation == 'AXIAL': - x = math.floor(2*r/sx) - y = math.floor(2*r/sy) + x = int(math.floor(2*r/sx)) + y = int(math.floor(2*r/sy)) elif self.orientation == 'CORONAL': - x = math.floor(r/sx) - y = math.floor(r/sz) + x = int(math.floor(r/sx)) + y = int(math.floor(r/sz)) elif self.orientation == 'SAGITAL': - x = math.floor(r/sy) - y = math.floor(r/sz) + x = int(math.floor(r/sy)) + y = int(math.floor(r/sz)) self.points = numpy.ones((y, x), dtype='bool') -- libgit2 0.21.2