# How to customize the Segment Editor effects - Paint/Erase options in Python?

**URL:** <https://discourse.slicer.org/t/how-to-customize-the-segment-editor-effects-paint-erase-options-in-python/33011>\
**Category:** Development\
**Tags:** segmentation, python\
**Created:** [November 24, 2023, 7:14pm UTC](https://discourse.slicer.org/t/how-to-customize-the-segment-editor-effects-paint-erase-options-in-python/33011 "2023-11-24T19:14:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajmadhan](https://avatars.discourse-cdn.com/v4/letter/r/5daacb/32.png) [@rajmadhan](https://discourse.slicer.org/u/rajmadhan)\
**Post date:** [November 24, 2023, 7:14pm UTC](https://discourse.slicer.org/t/how-to-customize-the-segment-editor-effects-paint-erase-options-in-python/33011/1 "2023-11-24T19:14:54Z")

</div>

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:

1. Set a fixed brush diameter, say 5mm
2. 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:
