Set parameters with python code. Skullstripper


(Mathias) #1

Hey!
Does someone know how to set the parrameters of the skullstripper extension with the use of python code?

skullWidget = slicer.modules.Skullstripper.widgetRepresentation()
— need to set the inputs here first
skullWidget.appry()

I know like Segment editor you can write something like this;
segmentEditorWidget = slicer.qMRMLSegmentEditorWidget()
segmentEditorWidget.setMRMLScene(slicer.mrmlScene)
segmentEditorNode = slicer.vtkMRMLSegmentEditorNode()
slicer.mrmlScene.AddNode(segmentEditorNode)
segmentEditorWidget.setMRMLSegmentEditorNode(segmentEditorNode)
segmentEditorWidget.setMasterVolumeNode(some_volume)

I cant understand how to reach this for skullstripping.

All help is appreciate :slight_smile:


(Andras Lasso) #2

This is a CLI module that you can run from Python as described here: https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python_scripting#Running_a_CLI_from_Python

Give SwissSkullStripper extension a try, too. It may work better.


(Mathias) #3

Thanks for the tip, found a way :slight_smile:

Here is a part of my code:


(Andras Lasso) #4

Thanks for the update and sharing the end result.

Please always include source code as text instead of screenshot, because others will not be able to easily copy-paste this code snippet picture and images also take thousand times more storage space. You can add triple ` character before and after the text to display it as source code.