Operating system: Windows 10
Slicer version: 5.4.0
Expected behavior:
I would like to customize the Segment Editor options for the Paint/Erase effects in Python.
Desired functionality:
- Set a fixed brush diameter, say 5mm
- Hide all the options exposed by the Paint/Erase effects.
Functionality 1:
Able to set a fixed size for the brush diameter using the below code:
paintEffect = self.ui.embeddedSegmentEditorWidget.effectByName(“Paint”)
paintEffect.setCommonParameter(“BrushDiameterIsRelative”, “0”)
paintEffect.setCommonParameter(“BrushAbsoluteDiameter”, 5) crosshairNode=slicer.mrmlScene.GetSingletonNode(‘default’,‘vtkMRMLCrosshairNode’)
sliceNode = crosshairNode.GetCursorPositionXYZ([0,0,0])
if sliceNode:
sliceNode.Modified()
The code works, but not consistently. The change for “BrushDiameterIsRelative” works correctly all the time. The UI always displays brush diameter units in “mm”, but the diameter value is not 5 all the time. Sometimes it shows as 5, other times 25.
Functionality 2:
I’m not able to hide the “Masking” options exposed by the Paint/Erase effects.
Tried the below code, but is not working:
self.ui.embeddedSegmentEditorWidget.MaskingGroupBox.hide()
or
self.ui.embeddedSegmentEditorWidget.MaskingGroupBox.setVisible(False)
Actual behavior: