# How to get parameters of Segment Editor effects

**URL:** <https://discourse.slicer.org/t/how-to-get-parameters-of-segment-editor-effects/20046>\
**Category:** Development\
**Tags:** segmentation\
**Created:** [October 7, 2021, 5:52am UTC](https://discourse.slicer.org/t/how-to-get-parameters-of-segment-editor-effects/20046 "2021-10-07T05:52:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [October 7, 2021, 5:52am UTC](https://discourse.slicer.org/t/how-to-get-parameters-of-segment-editor-effects/20046/1 "2021-10-07T05:52:37Z")

</div>

Hi Andras,  
How to get the parameter list for the segment editor modules

for example I need parameter list for wrap solidify. How can I get it.  
Regards,  
Saima Safdar

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 7, 2021, 5:57am UTC](https://discourse.slicer.org/t/how-to-get-parameters-of-segment-editor-effects/20046/2 "2021-10-07T05:57:56Z")

</div>

You can find list of Segment Editor effect parameters for built-in effects here: [Segment editor — 3D Slicer documentation](https://slicer.readthedocs.io/en/latest/developer_guide/modules/segmenteditor.html)

Usually extension developers do not write this kind of documentation but you can read the list of parameters directly from the source code, see for example here:

> <https://github.com/sebastianandress/Slicer-SurfaceWrapSolidify/blob/a9512a05f4203f4ae75211a9efde2bcab8bb549e/SegmentEditorWrapSolidify/SegmentEditorWrapSolidifyLib/SegmentEditorEffect.py#L903-L962>

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [October 7, 2021, 6:49am UTC](https://discourse.slicer.org/t/how-to-get-parameters-of-segment-editor-effects/20046/3 "2021-10-07T06:49:05Z")

</div>

Hi Andras,  
could you help me with this.  
I am running the wrapsolidify using script. At the end I want models for the segments. but I get another segmentation node as a result.

```
segmentEditorWidget.setActiveEffectByName("Wrap Solidify")
effect = segmentEditorWidget.activeEffect()

segmentEditorWidget.setCurrentSegmentID(segmentationNode.GetSegmentation().GetSegmentIdBySegmentName('Bone'))
effect.setParameter("ARG_OUTPUT_TYPE", "OUTPUT_MODEL")
effect.setParameter("ARG_REGION", "region")
effect.setParameter("REGION_OUTER_SURFACE", "outerSurface")
effect.setParameter("ARG_CARVE_HOLES_IN_OUTER_SURFACE", True)
effect.setParameter("ARG_CARVE_HOLES_IN_OUTER_SURFACE_DIAMETER", 10)
effect.self().onApply()

```

I am not getting the model output file. for the current segment. any help. Am I applying it correctly.

Thank you

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [October 7, 2021, 11:48am UTC](https://discourse.slicer.org/t/how-to-get-parameters-of-segment-editor-effects/20046/4 "2021-10-07T11:48:35Z")

</div>

> [@Saima](#):
>
> Hi Andras,  
> could you help me with this.  
> I am running the wrapsolidify using script. At the end I want models for the segments. but I get another segmentation node as a result.
> 
> ```auto
> segmentEditorWidget.setActiveEffectByName("Wrap Solidify")
> effect = segmentEditorWidget.activeEffect()
> 
> segmentEditorWidget.setCurrentSegmentID(segmentationNode.GetSegmentation().GetSegmentIdBySegmentName('Bone'))
> effect.setParameter("ARG_OUTPUT_TYPE", "OUTPUT_MODEL")
> effect.setParameter("ARG_REGION", "region")
> effect.setParameter("REGION_OUTER_SURFACE", "outerSurface")
> effect.setParameter("ARG_CARVE_HOLES_IN_OUTER_SURFACE", True)
> effect.setParameter("ARG_CARVE_HOLES_IN_OUTER_SURFACE_DIAMETER", 10)
> effect.self().onApply()
> 
> ```
> 
> I am not getting the model output file. for the current segment. any help. Am I applying it correctly.

Hi Andras,  
could you help me with this.  
I am running the wrapsolidify using script. At the end I want models for the segments. but I get another segmentation node as a result.

```auto
segmentEditorWidget.setActiveEffectByName("Wrap Solidify")
effect = segmentEditorWidget.activeEffect()

segmentEditorWidget.setCurrentSegmentID(segmentationNode.GetSegmentation().GetSegmentIdBySegmentName('Bone'))
effect.setParameter("ARG_OUTPUT_TYPE", "OUTPUT_MODEL")
effect.setParameter("ARG_REGION", "region")
effect.setParameter("REGION_OUTER_SURFACE", "outerSurface")
effect.setParameter("ARG_CARVE_HOLES_IN_OUTER_SURFACE", True)
effect.setParameter("ARG_CARVE_HOLES_IN_OUTER_SURFACE_DIAMETER", 10)
effect.self().onApply()

```

I am not getting the model output file. for the current segment. any help. Am I applying it correctly.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 7, 2021, 12:20pm UTC](https://discourse.slicer.org/t/how-to-get-parameters-of-segment-editor-effects/20046/5 "2021-10-07T12:20:50Z")

</div>

You need to use the variable’s value in the string literal, not the variable’s name. For example, replace `"ARG_OUTPUT_TYPE" ` by `"outputType" `.

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [October 7, 2021, 12:29pm UTC](https://discourse.slicer.org/t/how-to-get-parameters-of-segment-editor-effects/20046/6 "2021-10-07T12:29:22Z")

</div>

```
 effect.setParameter("region", "outerSurface")
    effect.setParameter("regionSegmentID", segmentName)
    #effect.setParameter("REGION_OUTER_SURFACE", "outerSurface")
    #effect.setParameter("REGION_LARGEST_CAVITY", "largestCavity")
    effect.setParameter("carveHolesInOuterSurface", True)
    effect.setParameter("carveHolesInOuterSurfaceDiameter", 10)
    effect.setParameter("outputType", "model")
    #effect.setParameter("ARG_OUTPUT_MODEL_NODE", model1)
    effect.self().onApply()

```

Like this I am getting the model.

I am using split island by filter but i do not understand why it is running two times although my script contains only one time but it is creating a new segmentation node again.  
is it because i am using this line

```
segmentEditorNode.SetOverwriteMode(slicer.vtkMRMLSegmentEditorNode.OverwriteNone)

```

regards,  
Saima Safdar

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 7, 2021, 12:47pm UTC](https://discourse.slicer.org/t/how-to-get-parameters-of-segment-editor-effects/20046/7 "2021-10-07T12:47:32Z")

</div>

It seems that everything works as expected, it may be just not clear for you yet how things work internally. For this, you can attach a Python debugger and go through all the Python code step by step very easily. If you want to dig into C++ code as well then you can either just read the source code; or build Slicer and step through the code using Visual Studio’s debugger. See instructions [here](https://slicer.readthedocs.io/en/latest/developer_guide/debugging/index.html).

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [October 7, 2021, 3:19pm UTC](https://discourse.slicer.org/t/how-to-get-parameters-of-segment-editor-effects/20046/8 "2021-10-07T15:19:40Z")

</div>

Hi Andras,  
I do not understand the following

Processing started  
QLayout::addChildLayout: layout “” already has a parent  
ctkSliderWidget::setSingleStep() 0 is out of bounds. 0 10 1  
72 islands created (12083 ignored)  
72 islands created (0 ignored)  
Processing completed in 422.18 seconds  
Processing started  
QLayout::addChildLayout: layout “” already has a parent  
ctkSliderWidget::setSingleStep() 0 is out of bounds. 0 10 1  
72 islands created (12083 ignored)  
72 islands created (0 ignored)  
QString qSlicerSegmentEditorAbstractEffect::parameter(QString) : Parameter named “regionSegmentID” cannot be found for effect “Wrap Solidify”  
Processing completed in 825.04 seconds

Regards,  
Saima Safdar

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 7, 2021, 5:59pm UTC](https://discourse.slicer.org/t/how-to-get-parameters-of-segment-editor-effects/20046/9 "2021-10-07T17:59:27Z")

</div>

You can put a breakpoint where “islands created” is logged and see what has called that method.

By the way, 825 second for Wrap Solidify is extreme. Probably you want to clean up the input segmentation a bit (a small smoothing may suffice) to get reasonable computation time.
