# Scissors segment editor effects from a script

**URL:** <https://discourse.slicer.org/t/scissors-segment-editor-effects-from-a-script/8348>\
**Category:** Development\
**Tags:** segmentation\
**Created:** [September 9, 2019, 5:36pm UTC](https://discourse.slicer.org/t/scissors-segment-editor-effects-from-a-script/8348 "2019-09-09T17:36:35Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![giovform](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/giovform/32/4687_2.png) [@giovform](https://discourse.slicer.org/u/giovform)\
**Post date:** [September 17, 2019, 5:45pm UTC](https://discourse.slicer.org/t/scissors-segment-editor-effects-from-a-script/8348/17 "2019-09-17T17:45:41Z")

</div>

I would like to apply both with the same segment, yes. I can do it manually, using the segmentation editor, but in the code I still can’t replicate the intensity range effect. I will post here the sequence of commands I am currently running (I have only one segmentation):

```
    # Create segment editor to get access to effects
    segmentEditorWidget = slicer.qMRMLSegmentEditorWidget()
    segmentEditorWidget.setMRMLScene(slicer.mrmlScene)
    segmentEditorNode = slicer.vtkMRMLSegmentEditorNode()
    slicer.mrmlScene.AddNode(segmentEditorNode)
    segmentEditorWidget.setMRMLSegmentEditorNode(segmentEditorNode)
    segmentEditorWidget.setSegmentationNode(segmentationNode)
    segmentEditorWidget.setMasterVolumeNode(inputVolume)

    segmentEditorWidget.setCurrentSegmentID(segmentationNode.GetSegmentation().GetNthSegmentID(0))
    # Set up masking parameters
    segmentEditorWidget.setActiveEffectByName("Mask volume")
    effect = segmentEditorWidget.activeEffect()
    segmentEditorNode.SetMaskSegmentID(segmentationNode.GetSegmentation().GetNthSegmentID(0))
    segmentEditorNode.SetMasterVolumeIntensityMask(True)
    segmentEditorNode.SetMasterVolumeIntensityMaskRange(6900, 7000)
    effect.setParameter("Operation", "FILL_OUTSIDE")
    effect.setParameter("FillValue", str(inputVolume.GetImageData().GetScalarRange()[0]))
    maskedVolume = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLScalarVolumeNode", "Temporary masked volume")
    effect.self().outputVolumeSelector.setCurrentNode(maskedVolume)
    effect.self().onApply()

```

The FillValue parameter is working.

---

_[View the full topic](https://discourse.slicer.org/t/scissors-segment-editor-effects-from-a-script/8348)._
