Commit 372512ae800de73515421d7021f9458c99767424

Authored by tatiana
1 parent 2cd86549

ADD: Brush operation while clicking (despite moving)

Showing 1 changed file with 22 additions and 3 deletions   Show diff stats
invesalius/data/viewer_slice.py
... ... @@ -172,8 +172,27 @@ class Viewer(wx.Panel):
172 172  
173 173 def OnBrushClick(self, obj, evt_vtk):
174 174 self.mouse_pressed = 1
175   - coord = self.GetCoordinate()
176   - print "Edit pixel region based on origin:", coord
  175 +
  176 +
  177 + coord = self.GetCoordinateCursor()
  178 + self.cursor.SetPosition(coord)
  179 + self.cursor.SetEditionPosition(self.GetCoordinateCursorEdition())
  180 + self.__update_cursor_position(coord)
  181 + self.ren.Render()
  182 +
  183 + if self._brush_cursor_op == 'Erase':
  184 + evt_msg = 'Erase mask pixel'
  185 + elif self._brush_cursor_op == 'Draw':
  186 + evt_msg = 'Add mask pixel'
  187 + elif self._brush_cursor_op == 'Threshold':
  188 + evt_msg = 'Edit mask pixel'
  189 +
  190 + pixels = self.cursor.GetPixels()
  191 + for coord in pixels:
  192 + ps.Publisher().sendMessage(evt_msg, coord)
  193 +
  194 + self.OnCrossMove(None, None)
  195 +
177 196  
178 197 def OnBrushMove(self, obj, evt_vtk):
179 198 coord = self.GetCoordinateCursor()
... ... @@ -190,11 +209,11 @@ class Viewer(wx.Panel):
190 209 evt_msg = 'Edit mask pixel'
191 210  
192 211 if self.mouse_pressed:
193   - print "Edit pixel region based on origin:", coord
194 212 pixels = self.cursor.GetPixels()
195 213 for coord in pixels:
196 214 ps.Publisher().sendMessage(evt_msg, coord)
197 215 self.interactor.Render()
  216 +
198 217  
199 218 def OnCrossMove(self, obj, evt_vtk):
200 219 coord = self.GetCoordinate()
... ...