Automate converting model to segmentation

I have a set of MRI dicoms and STL model images, I am wanting to create binary segmentation maps from the models, which i can do fine manually using these steps:

  • Go to Segmentations module
  • Create new segmentation node
  • Change master to Closed surface
  • In Import/Export section import the model node to the segmentation node
  • Export visible segments to binary labels map

But i have a lot of cases i need to do, so was wondering what is the actual code being executed to load in the STL files and convert them to a segmentation map? So i can automate the process


See several examples of how to automate these conversions in the script repository: