11"""
22MIT License
3- Copyright (c) 2022 [Insert copyright holders]
3+ Copyright (c) 2023 Yihao Liu
44Permission is hereby granted, free of charge, to any person obtaining a copy
55of this software and associated documentation files (the "Software"), to deal
66in the Software without restriction, including without limitation the rights
@@ -39,11 +39,16 @@ def setup(self):
3939 self .addObserver (slicer .mrmlScene , slicer .mrmlScene .EndCloseEvent , self .onSceneEndClose )
4040
4141 # UI
42+
43+ self .ui .radioDataVolume .connect ("toggled(bool)" , self .onRadioDataOptions )
44+ self .ui .radioData2D .connect ("toggled(bool)" , self .onRadioDataOptions )
45+
4246 self .ui .pushComputePredictor .connect ('clicked(bool)' , self .onPushComputePredictor )
4347 self .ui .pushStartMaskSync .connect ('clicked(bool)' , self .onPushStartMaskSync )
4448 self .ui .pushStopMaskSync .connect ('clicked(bool)' , self .onPushStopMaskSync )
4549 self .ui .pushFreezeSlice .connect ('clicked(bool)' , self .onPushFreezeSlice )
4650 self .ui .pushUnfreezeSlice .connect ('clicked(bool)' , self .onPushUnfreezeSlice )
51+
4752 self .ui .comboVolumeNode .connect ("currentNodeChanged(vtkMRMLNode*)" , self .updateParameterNodeFromGUI )
4853 self .ui .markupsAdd .connect ("markupsNodeChanged()" , self .updateParameterNodeFromGUI )
4954 self .ui .markupsRemove .connect ("markupsNodeChanged()" , self .updateParameterNodeFromGUI )
@@ -100,6 +105,12 @@ def updateParameterNodeFromGUI(self, caller=None, event=None):
100105
101106 self ._parameterNode .EndModify (wasModified )
102107
108+ def onRadioDataOptions (self ):
109+ if self .ui .radioDataVolume .checked :
110+ self ._parameterNode .SetParameter ("sammDataOptions" , "Volume" )
111+ if self .ui .radioData2D .checked :
112+ self ._parameterNode .SetParameter ("sammDataOptions" , "2D" )
113+
103114 def onPushComputePredictor (self ):
104115 self .logic .processComputePredictor ()
105116
@@ -110,8 +121,9 @@ def onPushStartMaskSync(self):
110121 self .logic ._flag_mask_sync = True
111122 self .logic .processInitMaskSync ()
112123 self .logic .processStartMaskSync ()
113- self .logic ._flag_promptpts_sync = True
114- self .logic .processPromptPointsSync ()
124+ if self ._parameterNode .GetParameter ("sammDataOptions" ) == "Volume" :
125+ self .logic ._flag_promptpts_sync = True
126+ self .logic .processPromptPointsSync ()
115127
116128 def onPushStopMaskSync (self ):
117129 self .logic ._flag_promptpts_sync = False
0 commit comments