From 3ee7eebec630d551cbabaf9f15e682af39529dbb Mon Sep 17 00:00:00 2001 From: Thiago Franco de Moraes Date: Thu, 25 Aug 2016 14:23:00 -0300 Subject: [PATCH] Using get_voxel_clicked FloodFillMaskInteractorStyle and removed a bunch of related codes --- invesalius/data/styles.py | 53 +---------------------------------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/invesalius/data/styles.py b/invesalius/data/styles.py index 8f00776..bf38d53 100644 --- a/invesalius/data/styles.py +++ b/invesalius/data/styles.py @@ -1804,24 +1804,10 @@ class FloodFillMaskInteractorStyle(DefaultInteractorStyle): viewer = self.viewer iren = viewer.interactor - mouse_x, mouse_y = iren.GetEventPosition() - render = iren.FindPokedRenderer(mouse_x, mouse_y) - slice_data = viewer.get_slice_data(render) - - self.picker.Pick(mouse_x, mouse_y, 0, render) - - coord = self.get_coordinate_cursor() - position = slice_data.actor.GetInput().FindPoint(coord) - - if position != -1: - coord = slice_data.actor.GetInput().GetPoint(position) - - if position < 0: - position = viewer.calculate_matrix_position(coord) + x, y, z = self.viewer.get_voxel_clicked(mouse_x, mouse_y, self.picker) mask = self.viewer.slice_.current_mask.matrix[1:, 1:, 1:] - x, y, z = self.calcultate_scroll_position(position) if mask[z, y, x] < self.t0 or mask[z, y, x] > self.t1: return @@ -1878,43 +1864,6 @@ class FloodFillMaskInteractorStyle(DefaultInteractorStyle): self.viewer.slice_.current_mask.was_edited = True Publisher.sendMessage('Reload actual slice') - def get_coordinate_cursor(self): - # Find position - x, y, z = self.picker.GetPickPosition() - bounds = self.viewer.slice_data.actor.GetBounds() - if bounds[0] == bounds[1]: - x = bounds[0] - elif bounds[2] == bounds[3]: - y = bounds[2] - elif bounds[4] == bounds[5]: - z = bounds[4] - return x, y, z - - def calcultate_scroll_position(self, position): - # Based in the given coord (x, y, z), returns a list with the scroll positions for each - # orientation, being the first position the sagital, second the coronal - # and the last, axial. - - if self.orientation == 'AXIAL': - image_width = self.slice_actor.GetInput().GetDimensions()[0] - axial = self.slice_data.number - coronal = position / image_width - sagital = position % image_width - - elif self.orientation == 'CORONAL': - image_width = self.slice_actor.GetInput().GetDimensions()[0] - axial = position / image_width - coronal = self.slice_data.number - sagital = position % image_width - - elif self.orientation == 'SAGITAL': - image_width = self.slice_actor.GetInput().GetDimensions()[1] - axial = position / image_width - coronal = position % image_width - sagital = self.slice_data.number - - return sagital, coronal, axial - class RemoveMaskPartsInteractorStyle(FloodFillMaskInteractorStyle): def __init__(self, viewer): -- libgit2 0.21.2