def edit(self,label): """select the picked label for editing""" merge = self.merge if not merge: return colorNode = merge.GetDisplayNode().GetColorNode() structureName = colorNode.GetColorName( label ) structureVolume = self.structureVolume( structureName ) EditUtil.setActiveVolumes(self.master, structureVolume) EditUtil.setLabel(label)
def edit(self, label): """select the picked label for editing""" merge = self.merge if not merge: return colorNode = merge.GetDisplayNode().GetColorNode() structureName = colorNode.GetColorName(label) structureVolume = self.structureVolume(structureName) EditUtil.setActiveVolumes(self.master, structureVolume) EditUtil.setLabel(label)
def processEvent(self, caller=None, event=None): """ handle events from the render window interactor """ if super(PaintEffectTool,self).processEvent(caller,event): return # interactor events if event == "LeftButtonPressEvent": self.actionState = "painting" if not self.pixelMode: self.cursorOff() xy = self.interactor.GetEventPosition() if self.smudge: EditUtil.setLabel(self.getLabelPixel(xy)) self.paintAddPoint(xy[0], xy[1]) self.abortEvent(event) elif event == "LeftButtonReleaseEvent": self.paintApply() self.actionState = None self.cursorOn() elif event == "MouseMoveEvent": self.actor.VisibilityOn() if self.actionState == "painting": xy = self.interactor.GetEventPosition() self.paintAddPoint(xy[0], xy[1]) self.abortEvent(event) elif event == "EnterEvent": self.actor.VisibilityOn() elif event == "LeaveEvent": self.actor.VisibilityOff() elif event == "KeyPressEvent": key = self.interactor.GetKeySym() if key == 'plus' or key == 'equal': self.scaleRadius(1.2) if key == 'minus' or key == 'underscore': self.scaleRadius(0.8) else: pass # events from the slice node if caller and caller.IsA('vtkMRMLSliceNode'): if hasattr(self,'brush'): self.createGlyph(self.brush) self.positionActors()
def processEvent(self, caller=None, event=None): """ handle events from the render window interactor """ if super(PaintEffectTool, self).processEvent(caller, event): return # interactor events if event == "LeftButtonPressEvent": self.actionState = "painting" if not self.pixelMode: self.cursorOff() xy = self.interactor.GetEventPosition() if self.smudge: EditUtil.setLabel(self.getLabelPixel(xy)) self.paintAddPoint(xy[0], xy[1]) self.abortEvent(event) elif event == "LeftButtonReleaseEvent": self.paintApply() self.actionState = None self.cursorOn() elif event == "MouseMoveEvent": self.actor.VisibilityOn() if self.actionState == "painting": xy = self.interactor.GetEventPosition() self.paintAddPoint(xy[0], xy[1]) self.abortEvent(event) elif event == "EnterEvent": self.actor.VisibilityOn() elif event == "LeaveEvent": self.actor.VisibilityOff() elif event == "KeyPressEvent": key = self.interactor.GetKeySym() if key == 'plus' or key == 'equal': self.scaleRadius(1.2) if key == 'minus' or key == 'underscore': self.scaleRadius(0.8) else: pass # events from the slice node if caller and caller.IsA('vtkMRMLSliceNode'): if hasattr(self, 'brush'): self.createGlyph(self.brush) self.positionActors()