How to get parameters of Segment Editor effects

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

You can find list of Segment Editor effect parameters for built-in effects here: Segment editor — 3D Slicer documentation

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:

1 Like

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

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.

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" .

1 Like
 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

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.

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

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.