Commit bf04c2ac3bef14ea83d23ccc3ed30dcef141adc9

Authored by Thiago Franco de Moraes
1 parent c3b850ed
Exists in master

Fix: creation of square cursor (problem with float index in numpy)

Showing 1 changed file with 12 additions and 12 deletions   Show diff stats
invesalius/data/cursor_actors.py
... ... @@ -323,17 +323,17 @@ class CursorRectangle(CursorBase):
323 323 r = self.radius
324 324 sx, sy, sz = self.spacing
325 325 if self.orientation == 'AXIAL':
326   - x = math.floor(2*r/sx)
327   - y = math.floor(2*r/sy)
  326 + x = int(math.floor(2*r/sx))
  327 + y = int(math.floor(2*r/sy))
328 328 z = 1
329 329 elif self.orientation == 'CORONAL':
330   - x = math.floor(r/sx)
  330 + x = int(math.floor(r/sx))
331 331 y = 1
332   - z = math.floor(r/sz)
  332 + z = int(math.floor(r/sz))
333 333 elif self.orientation == 'SAGITAL':
334 334 x = 1
335   - y = math.floor(r/sy)
336   - z = math.floor(r/sz)
  335 + y = int(math.floor(r/sy))
  336 + z = int(math.floor(r/sz))
337 337  
338 338 rectangle_m = numpy.ones((z, y, x), dtype='uint8')
339 339 rectangle_i = to_vtk(rectangle_m, self.spacing, 0, self.orientation)
... ... @@ -353,13 +353,13 @@ class CursorRectangle(CursorBase):
353 353 r = self.radius
354 354 sx, sy, sz = self.spacing
355 355 if self.orientation == 'AXIAL':
356   - x = math.floor(2*r/sx)
357   - y = math.floor(2*r/sy)
  356 + x = int(math.floor(2*r/sx))
  357 + y = int(math.floor(2*r/sy))
358 358 elif self.orientation == 'CORONAL':
359   - x = math.floor(r/sx)
360   - y = math.floor(r/sz)
  359 + x = int(math.floor(r/sx))
  360 + y = int(math.floor(r/sz))
361 361 elif self.orientation == 'SAGITAL':
362   - x = math.floor(r/sy)
363   - y = math.floor(r/sz)
  362 + x = int(math.floor(r/sy))
  363 + y = int(math.floor(r/sz))
364 364  
365 365 self.points = numpy.ones((y, x), dtype='bool')
... ...