Switching between models for automatic segmentation from command line #1494
-
Hi everyone I am training some modules via MONAILabel and 3D Slicer and was currently I am working with two models that I have trained (and are in the same app). For the workflow I want to achieve, I would want to automate the process as much as possible, and hence I am looking at ways to turn the workflow into a Python script. Here is in broad lines what I want to do:
Here is what I have done already: Now here is my problem Alternatively:
where "DICOMX" is the name of the file that is currently loaded into Slicer. Does anyone have any idea how I could solve this problem? Thanks in advance! Kind regards Lukas |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Have you tried running MONAI Label main file as a standard Python script? Here you can find an example: https://github.com/Project-MONAI/MONAILabel/blob/main/sample-apps/radiology/main.py#L263-L346 Just specify the studies, models and command you want to run (i.e. train, infer): https://github.com/Project-MONAI/MONAILabel/blob/main/sample-apps/radiology/main.py#L289-L291 Hope this helps, |
Beta Was this translation helpful? Give feedback.
-
Hi again, I found a solution to my problem! Using the following command, you can choose the loaded model which you want to use for automatic segmentation: As argument you give a string with the name of the preferred model. Thanks for the help! Lukas |
Beta Was this translation helpful? Give feedback.
Hi again,
I found a solution to my problem! Using the following command, you can choose the loaded model which you want to use for automatic segmentation:
slicer.modules.MONAILabelWidget.ui.segmentationModelSelector.setCurrentText()
As argument you give a string with the name of the preferred model.
For example,
slicer.modules.MONAILabelWidget.ui.segmentationModelSelector.setCurrentText("deepedit_seg")
switches the selected model to the
deepedit
model.Thanks for the help!
Lukas