Run Slicer in your web browser - as a Jupyter notebook or as a full application

Is there a way to make use of a part of slicer’s function in a program? I’m trying to use my own method of segmentation and I want to use slicer’s 3d model generation/volume creation from a segmented arrays of image, to then export it as an stl file. Is there a way I could achieve this?

Maybe you can create a python script for Slicer to execute on the console like this:
Slicer.exe --python-script "/full/path/to/myscript.py" --no-splash --no-main-window

Inside the script you need to read your segment data (e.g. from a numpy array, maybe like this), then you need to create a closed surface representation of the segment (like this), you need change the storage of 3D models to stl (like this), then you need to export segments as models (like this), then you can save your model as .stl maybe like this:
slicer.util.saveNode(modelNode, filepath)

I haven’t tested this workflow, but I think it should work

1 Like