I am trying to write a Python script that can automate the export of a .stl model from a segmentation that is imported with the CT DICOM set.
I have pretty much everything by painfully looking through examples online, but I am stuck on how to do the final export.
I think this might be the code to use:
slicer.modules.models.logic().SaveModel()
But that code requires two arguments and I have no way of figuring out what they are supposed to be. This is an issue I have run into with many other commands. Is there some database I can access that says what all the arguments for a code are supposed to be?
Model node only stores the data, so youāll only find methods in this class that are responsible getting/setting content. Any operation on the data is implemented in Models or other module logic classes or in utility functions.
Sorry to be a bother, I hope this is the last I have to ask for help.
So I am trying to automate the step to export all segmentations as model that I can then save using the code you provided above.
So I have these segmentations. The Binary labelmap is currently master:
Thanks for the feedback. Youāve discovered a bug in ExportAllSegmentsToModelHierarchy method that Iāll fix in the nightly build today. Till then, or if you use the latest stable version, you can use ExportSegmentsToModelHierarchy method instead: