Perform "threshold" and "fill between slices" directly in python

Hi, I have a binary image where slices are already labeled, and want to generate a volume by interpolating between slices. I was able to do this easily in the 3D-slicer GUI by performing 1) a threshold segmentation and then 2) a fill between slices operation. However I wonder if it is possible to perform these operations directly in python without using the GUI?
Thanks,
Fredrik

All Slicer features are available to be used without GUI, from Python scripting. See many examples of automating segmentation using Python script here: https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script

Great! Thanks a lot for the help!