hherhold
(Hollister Herhold)
September 12, 2020, 3:00pm
1
I’m trying to set up a key shortcut in python to enable/disable sphere brush in PaintEffect. The first step is code to set that parameter, which I’m doing like this:
segmentEditorWidget = slicer.qMRMLSegmentEditorWidget()
paintEffect = segmentEditorWidget.effectByName("Paint")
paintEffect.setCommonParameter("BrushSphere", False)
paintEffect.updateGUIFromMRML()
The parameter does not seem to change the brush behavior and I don’t get any changes reflected in the GUI. What am I doing wrong here?
Thanks!!!
-Hollister
lassoan
(Andras Lasso)
September 17, 2020, 3:37am
2
Instead of creating a new widget, refer to the Segment Editor module’s widget:
segmentEditorWidget = slicer.modules.segmenteditor.widgetRepresentation().self().editor
paintEffect = segmentEditorWidget.effectByName("Paint")
paintEffect.setCommonParameter("BrushSphere", 1) # enable
paintEffect.setCommonParameter("BrushSphere", 0) # disable
hherhold
(Hollister Herhold)
September 17, 2020, 12:26pm
3
Oh, I see - I didn’t realize that I was creating a new widget (rather than finding the existing one).
THANKS!
-Hollister
1 Like