-
I'm working with a 3D slicer and the monai-label plugin for heart MR image segmentation. I want to automatically keep track of the specific monai bundle used for labeling by adding its name as a suffix to the label file. Is this feasible, or do you have a better approach? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi @MalikTeng, This is a great question. Are you starting MONAI Label pointing to a local folder? If yes, this is the class we use to manage the local datastore: https://github.com/Project-MONAI/MONAILabel/blob/main/monailabel/datastore/local.py#L86 That class creates and modifies the datastore_V.json* file we use to keep track of the volumes and labels. These are the endpoints to modify the datastore: https://github.com/Project-MONAI/MONAILabel/blob/main/monailabel/endpoints/datastore.py#L93 When you submit the label using Slicer, this is the method that is called: https://github.com/Project-MONAI/MONAILabel/blob/main/plugins/slicer/MONAILabel/MONAILabel.py#L1433 and this is the endpoint: https://github.com/Project-MONAI/MONAILabel/blob/main/monailabel/endpoints/datastore.py#L93 One idea would be to modify the save_label method by adding more information to the submitted label name. Hope this helps, |
Beta Was this translation helpful? Give feedback.
-
Hi @diazandr3s, To enable bundle name tracking in the MONAI Label plugin with 3D Slicer, I followed these steps:
After these modifications, MONAI Label will save labels in folders named after the bundle's name. Note that this solution might vary based on different 3D Slicer versions and may require repeating the first step after updates to the MONAI Label plugin. Looking forward to your feedback! |
Beta Was this translation helpful? Give feedback.
Hi @diazandr3s,
To enable bundle name tracking in the MONAI Label plugin with 3D Slicer, I followed these steps:
Clone and Install MONAI Label: Clone the MONAI Label repository to your local machine and install it in edit mode. For example, clone to
~/MONAILabel
and install using the commandpip install -e .
.Modify MONAILabel.py: In the
MONAILabel.py
script, located at~/Slicer-5.4.0-linux-amd64/slicer.org/Extensions-31938/MONAILabel/lib/Slicer-5.4/qt-scripted-modules
, alter theself.logic.save_label
call. Add the bundle name used for segmentation by includingself.ui.segmentationModelSelector.currentText
to theparams
argument, forming a dictionary like{"label_info": label_info, "m…