Export multiple individual segment .stl files from one segmented nii.gz file using python script

Hi there,

I am currently new to 3dslicer and I have questions about how to perform a specific task using the python script code for 3d slicer.

The segmented file (nii.gz) can be exported into individual ‘.stl’ files based on different segments using the 3Dslicer software. However I am about to integrate this function into my own python code. Could anyone please give me some tips on where I should look at or even start? Thank you very much.new slicer

See examples how to do this in the script repository: Documentation/Nightly/ScriptRepository - Slicer Wiki

Hi, thank you very much for the link. It is indeed helpful. However I also noticed that in the 3DSlicer we could export segments into ‘.stl’, ‘.obj’ or ‘nrrd’ files, could the python script allow the user to choose which output format?

Yes, you can save segmentations to all these formats. You can find more examples in this forum, for example: