From 372512ae800de73515421d7021f9458c99767424 Mon Sep 17 00:00:00 2001 From: tatiana Date: Thu, 23 Jul 2009 17:14:36 +0000 Subject: [PATCH] ADD: Brush operation while clicking (despite moving) --- invesalius/data/viewer_slice.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/invesalius/data/viewer_slice.py b/invesalius/data/viewer_slice.py index f39ec2b..8d44dec 100755 --- a/invesalius/data/viewer_slice.py +++ b/invesalius/data/viewer_slice.py @@ -172,8 +172,27 @@ class Viewer(wx.Panel): def OnBrushClick(self, obj, evt_vtk): self.mouse_pressed = 1 - coord = self.GetCoordinate() - print "Edit pixel region based on origin:", coord + + + coord = self.GetCoordinateCursor() + self.cursor.SetPosition(coord) + self.cursor.SetEditionPosition(self.GetCoordinateCursorEdition()) + self.__update_cursor_position(coord) + self.ren.Render() + + if self._brush_cursor_op == 'Erase': + evt_msg = 'Erase mask pixel' + elif self._brush_cursor_op == 'Draw': + evt_msg = 'Add mask pixel' + elif self._brush_cursor_op == 'Threshold': + evt_msg = 'Edit mask pixel' + + pixels = self.cursor.GetPixels() + for coord in pixels: + ps.Publisher().sendMessage(evt_msg, coord) + + self.OnCrossMove(None, None) + def OnBrushMove(self, obj, evt_vtk): coord = self.GetCoordinateCursor() @@ -190,11 +209,11 @@ class Viewer(wx.Panel): evt_msg = 'Edit mask pixel' if self.mouse_pressed: - print "Edit pixel region based on origin:", coord pixels = self.cursor.GetPixels() for coord in pixels: ps.Publisher().sendMessage(evt_msg, coord) self.interactor.Render() + def OnCrossMove(self, obj, evt_vtk): coord = self.GetCoordinate() -- libgit2 0.21.2