I don’t know how to do this, but I believe it is possible. Loading via the Add Data method has never seemed cumbersome enough to me to pursue it.
Automatically? Then you need to come up with the decision algorithm and implement it. Manually? Then just pick your favorite UI method (buttons, radio buttons, etc.)
I have used segment editor effects from my modules, but have not tried to put a limited set of interactive effects to be available to the user. However, it looks like this discussion has exactly what you want.
This is straightforward. You can use slicer.vtkSlicerSegmentationsModuleLogic.ExportSegmentsClosedSurfaceRepresentationToFiles()
to export to STL or OBJ files.
The simple method used in many Slicer modules is to have sections with collapsible buttons. This allows areas which are not in current use to be collapsed and take up less room, allowing more screen space for the active area. You can set up your code to automatically collapse and expand sections at the proper times. For example, if I have a section in a collapsible button which is self.ui.CTRegistrationAreaCB
I can collapse it with self.ui.CTRegistrationAreaCB.collapsed = True
. For another approach, I believe Qt also allows tabbed layouts, but I’ve never tried that or looked into it so I can’t really help with that. Another possible approach would be to have multiple modules that you switch between (see this discussion). Also, I would highly recommend taking a look at Slicelets.
This discussion looks like it answers your question directly.
If you want to see an example of a working module which uses specific segment editor effects (but not the same way as they appear in the Segment Editor module) you could take a look at Heartbeat4D/PropagateSegToOtherPhases.py at main · mikebind/Heartbeat4D · GitHub The code there is old, written before Qt Designer became the default way of creating the UI, but it still works fine. It makes use of thresholding, grow from seeds, erode, close holes, masking, creating empty segments, and copying from one segmentation to another.