From 86fed49f17311ae3ddbd01f2393c1a8269fbb1ad Mon Sep 17 00:00:00 2001 From: Sachidanand Alle Date: Tue, 15 Mar 2022 06:58:38 -0700 Subject: [PATCH] Show/hide tabs based on models that are available Signed-off-by: Sachidanand Alle --- plugins/slicer/MONAILabel/MONAILabel.py | 18 +++++++++++++++++- .../MONAILabel/Resources/UI/MONAILabel.ui | 6 +++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/plugins/slicer/MONAILabel/MONAILabel.py b/plugins/slicer/MONAILabel/MONAILabel.py index 7cab2bccc..0a9a3821e 100644 --- a/plugins/slicer/MONAILabel/MONAILabel.py +++ b/plugins/slicer/MONAILabel/MONAILabel.py @@ -479,10 +479,26 @@ def updateGUIFromParameterNode(self, caller=None, event=None): if self.models and [k for k, v in self.models.items() if v["type"] == "segmentation"]: self.ui.segmentationCollapsibleButton.collapsed = False + self.ui.segmentationCollapsibleButton.show() + else: + self.ui.segmentationCollapsibleButton.hide() + if self.models and [k for k, v in self.models.items() if v["type"] in ("deepgrow", "deepedit")]: self.ui.deepgrowCollapsibleButton.collapsed = False + self.ui.deepgrowCollapsibleButton.show() + else: + self.ui.deepgrowCollapsibleButton.hide() + if self.models and [k for k, v in self.models.items() if v["type"] == "scribbles"]: self.ui.scribblesCollapsibleButton.collapsed = False + self.ui.scribblesCollapsibleButton.show() + else: + self.ui.scribblesCollapsibleButton.hide() + + if self.info.get("trainers", {}): + self.ui.aclCollapsibleButton.show() + else: + self.ui.aclCollapsibleButton.hide() self.ui.labelComboBox.clear() if self._segmentNode: @@ -1226,7 +1242,7 @@ def onUploadImage(self, init_sample=True, session=False): "Server Error:: Session creation Failed\nPlease upgrade to latest monailable version (> 0.2.0)", detailedText=traceback.format_exc(), ) - self.current_sample["session_id"] = None + self.current_sample["session"] = None else: slicer.util.errorDisplay("Failed to upload volume to Server", detailedText=traceback.format_exc()) return False diff --git a/plugins/slicer/MONAILabel/Resources/UI/MONAILabel.ui b/plugins/slicer/MONAILabel/Resources/UI/MONAILabel.ui index 89affab2e..0684dfd2d 100644 --- a/plugins/slicer/MONAILabel/Resources/UI/MONAILabel.ui +++ b/plugins/slicer/MONAILabel/Resources/UI/MONAILabel.ui @@ -218,7 +218,7 @@ - Train: + Model: @@ -237,7 +237,7 @@ - Run + Train @@ -365,7 +365,7 @@ SmartEdit / Deepgrow - false + true 9