From a51b064c03415cc31dca0d3685df966ad93d46d6 Mon Sep 17 00:00:00 2001 From: Arnaud Breheret Date: Mon, 4 Mar 2024 17:19:43 -0500 Subject: [PATCH 1/2] bug fix --- .../components/checkbox_component.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fsleyes_plugin_shimming_toolbox/components/checkbox_component.py b/fsleyes_plugin_shimming_toolbox/components/checkbox_component.py index 2146eb3..f10070f 100644 --- a/fsleyes_plugin_shimming_toolbox/components/checkbox_component.py +++ b/fsleyes_plugin_shimming_toolbox/components/checkbox_component.py @@ -111,6 +111,9 @@ def get_argument(self, checkboxes): if checkbox.GetValue(): label = checkbox.GetLabel() args += option_values[label] + ',' + if args == "": + return "-1" + return args[:-1] def get_command(self): From aef514d5d1b66162852e9ec265dd72ed45a1cd63 Mon Sep 17 00:00:00 2001 From: Arnaud Breheret Date: Tue, 5 Mar 2024 11:40:08 -0500 Subject: [PATCH 2/2] modifies tests to make sure scanner-coil-order checkboxes work --- test/gui/test_b0shim_tab.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/test/gui/test_b0shim_tab.py b/test/gui/test_b0shim_tab.py index 73c2f73..dc9dc05 100644 --- a/test/gui/test_b0shim_tab.py +++ b/test/gui/test_b0shim_tab.py @@ -21,7 +21,7 @@ def test_st_plugin_b0shim_dyn_lsq_mse(): options = {'optimizer-method': 'Least Squares', 'optimizer-criteria': 'Mean Squared Error', 'slices': 'Auto detect', - 'scanner-coil-order': '0', + 'scanner-coil-order': 'f0', 'output-file-format-scanner': 'Slicewise per Channel', 'output-file-format-coil': 'Slicewise per Channel', 'fatsat': 'Auto detect', @@ -46,6 +46,21 @@ def test_st_plugin_b0shim_dyn_lsq_mae(): def _test_st_plugin_b0shim_dyn(view, overlayList, displayCtx, options=options): __test_st_plugin_b0shim_dyn(view, overlayList, displayCtx, options=options) run_with_orthopanel(_test_st_plugin_b0shim_dyn) + + +def test_st_plugin_b0shim_dyn_lsq_mse_coil_only(): + options = {'optimizer-method': 'Least Squares', + 'optimizer-criteria': 'Mean Absolute Error', + 'slices': 'Auto detect', + 'scanner-coil-order': '', + 'output-file-format-scanner': 'Slicewise per Channel', + 'output-file-format-coil': 'Slicewise per Channel', + 'output-value-format': 'delta' + } + + def _test_st_plugin_b0shim_dyn(view, overlayList, displayCtx, options=options): + __test_st_plugin_b0shim_dyn(view, overlayList, displayCtx, options=options) + run_with_orthopanel(_test_st_plugin_b0shim_dyn) def test_st_plugin_b0shim_dyn_pi(): @@ -60,8 +75,8 @@ def test_st_plugin_b0shim_dyn_pi(): def _test_st_plugin_b0shim_dyn(view, overlayList, displayCtx, options=options): __test_st_plugin_b0shim_dyn(view, overlayList, displayCtx, options=options) run_with_orthopanel(_test_st_plugin_b0shim_dyn) - - + + def test_st_plugin_b0shim_dyn_qp(): options = {'optimizer-method': 'Quad Prog', 'optimizer-criteria': 'Mean Squared Error', @@ -133,7 +148,7 @@ def __test_st_plugin_b0shim_dyn(view, overlayList, displayCtx, options): get_all_children(b0shim_tab.sizer_run, list_widgets) for widget in list_widgets: if isinstance(widget, wx.CheckBox) and widget.IsShown(): - if widget.GetName() == 'check': + if widget.Label in options['scanner-coil-order']: assert set_checkbox(widget) # Select the dropdowns that are nested