Paint Effect Util with loadable module

I’m new with slicer and I’m trying to build a module which includes the paint effect. Right now I have two problems:

  • I don’t know how to create and link a label map. The code below just works when I create a Label Map using the Editor Module.

  • When I change the radius of the sphere it creates a new circle, but on painting the size stays the same.

      # TODO: Create/Link Labelmap!!
      editUtil = EditorLib.EditUtil.EditUtil()
      parameterNode = editUtil.getParameterNode()
      lm =
      paintEffect = EditorLib.PaintEffectOptions()
      parameterNode.SetParameter('PaintEffect,radius', str(sphereSize))
      parameterNode.SetParameter('PaintEffect,sphere', '1')
      sliceWidget = lm.sliceWidget('Red')
      paintTool = EditorLib.PaintEffectTool(sliceWidget)
      sliceWidget = lm.sliceWidget('Green')
      paintTool = EditorLib.PaintEffectTool(sliceWidget)
      sliceWidget = lm.sliceWidget('Yellow')
      paintTool = EditorLib.PaintEffectTool(sliceWidget)

Hi - we’ve moved active development to the Segment Editor module, particularly for segmentation tools embedding inside other modules.

I think @lassoan, @cpinter or @che85 can point to some examples of how to do the embedding.

The simplest embedding example is the SegmentEditor module itself.
For a more complex example, have a look at

You can customize which effects are displayed in what order. You can also hide node selectors, etc.