From d1ede53b36faee1f1ffcf77f582d6c6b82f3fda4 Mon Sep 17 00:00:00 2001 From: acs-home-ws Date: Wed, 15 Dec 2021 15:19:40 -0800 Subject: [PATCH 01/13] initial commit --- aydin/gui/gui.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/aydin/gui/gui.py b/aydin/gui/gui.py index e5c5b3e2..4c21971e 100644 --- a/aydin/gui/gui.py +++ b/aydin/gui/gui.py @@ -57,6 +57,7 @@ def setupMenubar(self): mainMenu.setNativeMenuBar(False) fileMenu = mainMenu.addMenu(' &File') runMenu = mainMenu.addMenu(' &Run') + preferencesMenu = mainMenu.addMenu(' &Preferences') helpMenu = mainMenu.addMenu(' &Help') # File Menu @@ -104,6 +105,16 @@ def setupMenubar(self): # # ) # runMenu.addAction(saveModelJSONButton) + # Preferences Menu + basicModeButton = QAction('Basic mode', self) + basicModeButton.setStatusTip('Switch to basic mode') + preferencesMenu.addAction(basicModeButton) + + advancedModeButton = QAction('Advanced mode', self) + advancedModeButton.setEnabled(False) + advancedModeButton.setStatusTip('Switch to advanced mode') + preferencesMenu.addAction(advancedModeButton) + # Help Menu versionButton = QAction("ver" + self.version, self) helpMenu.addAction(versionButton) From a92341ece5208ed304d1bbcf37ebb2cbb5046d86 Mon Sep 17 00:00:00 2001 From: acs-ws Date: Thu, 6 Jan 2022 15:33:57 -0800 Subject: [PATCH 02/13] making basic mode default --- aydin/gui/gui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aydin/gui/gui.py b/aydin/gui/gui.py index 7ed42737..1431bf1b 100644 --- a/aydin/gui/gui.py +++ b/aydin/gui/gui.py @@ -108,11 +108,11 @@ def setupMenubar(self): # Preferences Menu basicModeButton = QAction('Basic mode', self) + basicModeButton.setEnabled(False) basicModeButton.setStatusTip('Switch to basic mode') preferencesMenu.addAction(basicModeButton) advancedModeButton = QAction('Advanced mode', self) - advancedModeButton.setEnabled(False) advancedModeButton.setStatusTip('Switch to advanced mode') preferencesMenu.addAction(advancedModeButton) From e971b40613299e728710d2035abb761bcee1c703 Mon Sep 17 00:00:00 2001 From: acs-ws Date: Thu, 6 Jan 2022 15:35:02 -0800 Subject: [PATCH 03/13] cleaned redundant comments --- aydin/gui/gui.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/aydin/gui/gui.py b/aydin/gui/gui.py index 1431bf1b..f94135ef 100644 --- a/aydin/gui/gui.py +++ b/aydin/gui/gui.py @@ -90,22 +90,6 @@ def setupMenubar(self): ) runMenu.addAction(saveOptionsJSONButton) - # loadOptionsJSONButton = QAction('Load Options JSON', self) - # loadOptionsJSONButton.setStatusTip('Load options JSON') - # # loadOptionsJSONButton.triggered.connect( - # # self.main_widget.tabs["File(s)"].openFileNamesDialog - # # ) - # loadOptionsJSONButton.setEnabled(False) - # runMenu.addAction(loadOptionsJSONButton) - # - # saveModelJSONButton = QAction('Save Model', self) - # saveModelJSONButton.setStatusTip('Save the most-recent trained model') - # saveModelJSONButton.setEnabled(False) - # # saveModelJSONButton.triggered.connect( - # # self.main_widget.tabs["File(s)"].openFileNamesDialog - # # ) - # runMenu.addAction(saveModelJSONButton) - # Preferences Menu basicModeButton = QAction('Basic mode', self) basicModeButton.setEnabled(False) From a7d76adb92a2ac724955d13e352ee7434ed05f0b Mon Sep 17 00:00:00 2001 From: acs-ws Date: Thu, 6 Jan 2022 16:09:29 -0800 Subject: [PATCH 04/13] toggle between modes is functional --- aydin/gui/gui.py | 22 ++++++++++++++-------- aydin/gui/main_page.py | 11 +++++++++++ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/aydin/gui/gui.py b/aydin/gui/gui.py index f94135ef..d8ee6c7d 100644 --- a/aydin/gui/gui.py +++ b/aydin/gui/gui.py @@ -91,14 +91,20 @@ def setupMenubar(self): runMenu.addAction(saveOptionsJSONButton) # Preferences Menu - basicModeButton = QAction('Basic mode', self) - basicModeButton.setEnabled(False) - basicModeButton.setStatusTip('Switch to basic mode') - preferencesMenu.addAction(basicModeButton) - - advancedModeButton = QAction('Advanced mode', self) - advancedModeButton.setStatusTip('Switch to advanced mode') - preferencesMenu.addAction(advancedModeButton) + self.basicModeButton = QAction('Basic mode', self) + self.basicModeButton.setEnabled(False) + self.basicModeButton.setStatusTip('Switch to basic mode') + self.basicModeButton.triggered.connect( + lambda: self.main_widget.toggle_basic_advanced_mode() + ) + preferencesMenu.addAction(self.basicModeButton) + + self.advancedModeButton = QAction('Advanced mode', self) + self.advancedModeButton.setStatusTip('Switch to advanced mode') + self.advancedModeButton.triggered.connect( + lambda: self.main_widget.toggle_basic_advanced_mode() + ) + preferencesMenu.addAction(self.advancedModeButton) # Help Menu versionButton = QAction("ver" + self.version, self) diff --git a/aydin/gui/main_page.py b/aydin/gui/main_page.py index 2da18b38..1f8211c5 100644 --- a/aydin/gui/main_page.py +++ b/aydin/gui/main_page.py @@ -244,6 +244,17 @@ def handle_use_same_crop_state_changed(self): not self.tabs["Training Crop"].use_same_crop_checkbox.isChecked(), ) + def toggle_basic_advanced_mode(self): + # make calls to toggle the GUI at lower levels + + # swap certain features of basic and advanced menu items + self.parent.basicModeButton.setEnabled( + not self.parent.basicModeButton.isEnabled() + ) + self.parent.advancedModeButton.setEnabled( + not self.parent.advancedModeButton.isEnabled() + ) + def add_activity_dockable(self): self.activity_dock.setHidden(True) self.parent.addDockWidget(Qt.BottomDockWidgetArea, self.activity_dock) From 8120ff3c089aac3170bb4ffe283b9f8295e683ac Mon Sep 17 00:00:00 2001 From: acs-ws Date: Fri, 7 Jan 2022 08:53:55 -0800 Subject: [PATCH 05/13] set_advanced_enabled method is added to processing and denoise tabs --- aydin/gui/main_page.py | 3 ++- aydin/gui/tabs/qt/denoise.py | 3 +++ aydin/gui/tabs/qt/processing.py | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/aydin/gui/main_page.py b/aydin/gui/main_page.py index 1f8211c5..2e8ed951 100644 --- a/aydin/gui/main_page.py +++ b/aydin/gui/main_page.py @@ -246,8 +246,9 @@ def handle_use_same_crop_state_changed(self): def toggle_basic_advanced_mode(self): # make calls to toggle the GUI at lower levels + self.tabs["Denoise"].set_advanced_enabled() - # swap certain features of basic and advanced menu items + # swap the enabled state of `basic` and `advanced` menu items self.parent.basicModeButton.setEnabled( not self.parent.basicModeButton.isEnabled() ) diff --git a/aydin/gui/tabs/qt/denoise.py b/aydin/gui/tabs/qt/denoise.py index acf66c0e..a08f22de 100644 --- a/aydin/gui/tabs/qt/denoise.py +++ b/aydin/gui/tabs/qt/denoise.py @@ -111,3 +111,6 @@ def current_backend_qwidget(self): @property def lower_level_args(self): return self.stacked_widget.currentWidget().lower_level_args() + + def set_advanced_enabled(self): + raise NotImplementedError diff --git a/aydin/gui/tabs/qt/processing.py b/aydin/gui/tabs/qt/processing.py index 8bdca188..fdcf893d 100644 --- a/aydin/gui/tabs/qt/processing.py +++ b/aydin/gui/tabs/qt/processing.py @@ -57,3 +57,6 @@ def transforms(self): transforms.append(item.params_dict) return transforms + + def set_advanced_enabled(self): + raise NotImplementedError From 0b7b9b1e70e486956078b82312bcd05b8fdb898c Mon Sep 17 00:00:00 2001 From: acs-ws Date: Fri, 7 Jan 2022 09:06:41 -0800 Subject: [PATCH 06/13] processing tab function call chain is set up --- aydin/gui/_qt/transforms_tab_widget.py | 3 +++ aydin/gui/main_page.py | 7 ++++++- aydin/gui/tabs/qt/denoise.py | 2 +- aydin/gui/tabs/qt/processing.py | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/aydin/gui/_qt/transforms_tab_widget.py b/aydin/gui/_qt/transforms_tab_widget.py index dd67d422..478593b4 100644 --- a/aydin/gui/_qt/transforms_tab_widget.py +++ b/aydin/gui/_qt/transforms_tab_widget.py @@ -50,3 +50,6 @@ def __init__(self, parent): def clear_the_list(self): self.clear() + + def set_advanced_enabled(self, enable: bool = False): + raise NotImplementedError diff --git a/aydin/gui/main_page.py b/aydin/gui/main_page.py index 2e8ed951..f2da6b46 100644 --- a/aydin/gui/main_page.py +++ b/aydin/gui/main_page.py @@ -246,7 +246,12 @@ def handle_use_same_crop_state_changed(self): def toggle_basic_advanced_mode(self): # make calls to toggle the GUI at lower levels - self.tabs["Denoise"].set_advanced_enabled() + self.tabs["Pre/Post-Processing"].set_advanced_enabled( + self.parent.advancedModeButton.isEnabled() + ) + self.tabs["Denoise"].set_advanced_enabled( + self.parent.advancedModeButton.isEnabled() + ) # swap the enabled state of `basic` and `advanced` menu items self.parent.basicModeButton.setEnabled( diff --git a/aydin/gui/tabs/qt/denoise.py b/aydin/gui/tabs/qt/denoise.py index a08f22de..72383b6d 100644 --- a/aydin/gui/tabs/qt/denoise.py +++ b/aydin/gui/tabs/qt/denoise.py @@ -112,5 +112,5 @@ def current_backend_qwidget(self): def lower_level_args(self): return self.stacked_widget.currentWidget().lower_level_args() - def set_advanced_enabled(self): + def set_advanced_enabled(self, enable: bool = False): raise NotImplementedError diff --git a/aydin/gui/tabs/qt/processing.py b/aydin/gui/tabs/qt/processing.py index fdcf893d..37d96f0d 100644 --- a/aydin/gui/tabs/qt/processing.py +++ b/aydin/gui/tabs/qt/processing.py @@ -58,5 +58,5 @@ def transforms(self): return transforms - def set_advanced_enabled(self): - raise NotImplementedError + def set_advanced_enabled(self, enable: bool = False): + self.panes_widget.set_advanced_enabled(enable=enable) From c1d6a7715167e152ce6c088775a07d9d72df7157 Mon Sep 17 00:00:00 2001 From: acs-ws Date: Fri, 7 Jan 2022 09:19:54 -0800 Subject: [PATCH 07/13] initial working example with attenuation transform --- aydin/gui/_qt/transforms_tab_widget.py | 5 +++-- aydin/gui/main_page.py | 6 +++--- aydin/it/transforms/attenuation.py | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/aydin/gui/_qt/transforms_tab_widget.py b/aydin/gui/_qt/transforms_tab_widget.py index 478593b4..762c4a1d 100644 --- a/aydin/gui/_qt/transforms_tab_widget.py +++ b/aydin/gui/_qt/transforms_tab_widget.py @@ -31,7 +31,6 @@ def __init__(self, parent): class_itself = response.__getattribute__(elem) fullargspec = inspect.getfullargspec(class_itself.__init__) - # print(fullargspec) widget = TransformsTabItem( self, @@ -52,4 +51,6 @@ def clear_the_list(self): self.clear() def set_advanced_enabled(self, enable: bool = False): - raise NotImplementedError + for item_widget in self.list_of_item_widgets: + if "(advanced)" in item_widget.transform_class.__doc__: + item_widget.setEnabled(enable) diff --git a/aydin/gui/main_page.py b/aydin/gui/main_page.py index f2da6b46..fdc79281 100644 --- a/aydin/gui/main_page.py +++ b/aydin/gui/main_page.py @@ -249,9 +249,9 @@ def toggle_basic_advanced_mode(self): self.tabs["Pre/Post-Processing"].set_advanced_enabled( self.parent.advancedModeButton.isEnabled() ) - self.tabs["Denoise"].set_advanced_enabled( - self.parent.advancedModeButton.isEnabled() - ) + # self.tabs["Denoise"].set_advanced_enabled( + # self.parent.advancedModeButton.isEnabled() + # ) # swap the enabled state of `basic` and `advanced` menu items self.parent.basicModeButton.setEnabled( diff --git a/aydin/it/transforms/attenuation.py b/aydin/it/transforms/attenuation.py index 3964a83d..dade9cd2 100644 --- a/aydin/it/transforms/attenuation.py +++ b/aydin/it/transforms/attenuation.py @@ -15,7 +15,7 @@ class AttenuationTransform(ImageTransformBase): Corrects intensity attenuation of an image along a given list of axis. This is usefull to correct for signal attenuation over time or along space. Currently only linear attenuation is supported. More modes on the - way. + way.(advanced) """ preprocess_description = ( From 37cfe41438b5027f4ca68b8bbe50aa0433609e09 Mon Sep 17 00:00:00 2001 From: acs-ws Date: Fri, 7 Jan 2022 11:44:17 -0800 Subject: [PATCH 08/13] processing tab is ready and functional for toggling between basic and advanced modes --- aydin/gui/_qt/transforms_tab_widget.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aydin/gui/_qt/transforms_tab_widget.py b/aydin/gui/_qt/transforms_tab_widget.py index 762c4a1d..2e9e1dcf 100644 --- a/aydin/gui/_qt/transforms_tab_widget.py +++ b/aydin/gui/_qt/transforms_tab_widget.py @@ -51,6 +51,6 @@ def clear_the_list(self): self.clear() def set_advanced_enabled(self, enable: bool = False): - for item_widget in self.list_of_item_widgets: + for index, item_widget in enumerate(self.list_of_item_widgets): if "(advanced)" in item_widget.transform_class.__doc__: - item_widget.setEnabled(enable) + self.setTabEnabled(index, enable) From 14434ba51bfa4b5871f09f05824393d391520a14 Mon Sep 17 00:00:00 2001 From: acs-ws Date: Fri, 7 Jan 2022 14:30:02 -0800 Subject: [PATCH 09/13] denoising tab able to toggle between basic and advanced modes --- aydin/gui/main_page.py | 6 +- aydin/gui/tabs/qt/denoise.py | 58 +++++++++++++++---- .../denoise/util/test/test_denoise_utils.py | 5 +- 3 files changed, 54 insertions(+), 15 deletions(-) diff --git a/aydin/gui/main_page.py b/aydin/gui/main_page.py index fdc79281..f2da6b46 100644 --- a/aydin/gui/main_page.py +++ b/aydin/gui/main_page.py @@ -249,9 +249,9 @@ def toggle_basic_advanced_mode(self): self.tabs["Pre/Post-Processing"].set_advanced_enabled( self.parent.advancedModeButton.isEnabled() ) - # self.tabs["Denoise"].set_advanced_enabled( - # self.parent.advancedModeButton.isEnabled() - # ) + self.tabs["Denoise"].set_advanced_enabled( + self.parent.advancedModeButton.isEnabled() + ) # swap the enabled state of `basic` and `advanced` menu items self.parent.basicModeButton.setEnabled( diff --git a/aydin/gui/tabs/qt/denoise.py b/aydin/gui/tabs/qt/denoise.py index 72383b6d..fccac7bb 100644 --- a/aydin/gui/tabs/qt/denoise.py +++ b/aydin/gui/tabs/qt/denoise.py @@ -62,28 +62,44 @@ def __init__(self, parent): backend_options_descriptions, ) = get_list_of_denoiser_implementations() - backend_options, backend_options_descriptions = ( + self.backend_options, self.backend_options_descriptions = ( list(t) for t in zip(*sorted(zip(backend_options, backend_options_descriptions))) ) + self.basic_backend_options = [ + 'Classic-butterworth', + 'Classic-gaussian', + 'Classic-gm', + 'Classic-nlm', + 'Classic-tv', + 'Noise2SelfCNN-jinet', + 'Noise2SelfFGR-cb', + 'Noise2SelfFGR-lgbm', + 'Noise2SelfFGR-rf', + ] + + self.basic_backend_options_descriptions = [] + self.stacked_widget = QStackedWidget(self) default_option_index = 0 for idx, (backend_option, description) in enumerate( - zip(backend_options, backend_options_descriptions) + zip(self.backend_options, self.backend_options_descriptions) ): - self.leftlist.insertItem(idx, backend_option) - # self.leftlist.item(idx).setToolTip(tooltip) + if backend_option in self.basic_backend_options: + self.basic_backend_options_descriptions.append(description) - self.stacked_widget.addWidget( - DenoiseTabMethodWidget( - self, name=backend_option, description=description + self.leftlist.insertItem(idx, backend_option) + + self.stacked_widget.addWidget( + DenoiseTabMethodWidget( + self, name=backend_option, description=description + ) ) - ) - if backend_option == "Classic-butterworth": - default_option_index = idx + if backend_option == "Classic-butterworth": + default_option_index = idx self.leftlist.item(default_option_index).setSelected(True) self.change_current_method(default_option_index) @@ -113,4 +129,24 @@ def lower_level_args(self): return self.stacked_widget.currentWidget().lower_level_args() def set_advanced_enabled(self, enable: bool = False): - raise NotImplementedError + self.leftlist.clear() + + while self.stacked_widget.count(): + self.stacked_widget.removeWidget(self.stacked_widget.widget(0)) + + for index, backend_option in enumerate( + self.backend_options if enable else self.basic_backend_options + ): + self.leftlist.insertItem(index, backend_option) + + description_list = ( + self.backend_options_descriptions + if enable + else self.basic_backend_options_descriptions + ) + + self.stacked_widget.addWidget( + DenoiseTabMethodWidget( + self, name=backend_option, description=description_list[index] + ) + ) diff --git a/aydin/restoration/denoise/util/test/test_denoise_utils.py b/aydin/restoration/denoise/util/test/test_denoise_utils.py index 4d75f9e3..317bba93 100644 --- a/aydin/restoration/denoise/util/test/test_denoise_utils.py +++ b/aydin/restoration/denoise/util/test/test_denoise_utils.py @@ -4,7 +4,10 @@ get_list_of_denoiser_implementations, ) +implementations = get_list_of_denoiser_implementations() +pprint(implementations) + def est_denoise_utils(): implementations = get_list_of_denoiser_implementations() - pprint(implementations) + print(implementations) From 136f2da9dc342b49009836ba06fc8a612e4fe770 Mon Sep 17 00:00:00 2001 From: acs-ws Date: Fri, 7 Jan 2022 14:46:12 -0800 Subject: [PATCH 10/13] fixed the problem with processing tab init after enabling basic/advanced toggle --- aydin/gui/tabs/qt/processing.py | 2 ++ aydin/it/transforms/attenuation.py | 2 +- aydin/it/transforms/deskew.py | 2 +- aydin/it/transforms/motion.py | 2 +- aydin/it/transforms/periodic.py | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/aydin/gui/tabs/qt/processing.py b/aydin/gui/tabs/qt/processing.py index 37d96f0d..284da4b6 100644 --- a/aydin/gui/tabs/qt/processing.py +++ b/aydin/gui/tabs/qt/processing.py @@ -45,6 +45,8 @@ def __init__(self, parent): self.setLayout(self.tab_layout) + self.set_advanced_enabled(enable=False) # to init the tab correctly + @property def transforms(self): if len(self.panes_widget.list_of_item_widgets) < 1: diff --git a/aydin/it/transforms/attenuation.py b/aydin/it/transforms/attenuation.py index ec76ebfa..97d7033b 100644 --- a/aydin/it/transforms/attenuation.py +++ b/aydin/it/transforms/attenuation.py @@ -15,7 +15,7 @@ class AttenuationTransform(ImageTransformBase): Corrects intensity attenuation of an image along a given list of axis. This is usefull to correct for signal attenuation over time or along space. Currently only linear attenuation is supported. More modes on the - way.(advanced) + way. """ preprocess_description = ( diff --git a/aydin/it/transforms/deskew.py b/aydin/it/transforms/deskew.py index b78507e4..78a88fd0 100644 --- a/aydin/it/transforms/deskew.py +++ b/aydin/it/transforms/deskew.py @@ -18,7 +18,7 @@ class DeskewTransform(ImageTransformBase): per plane - must be an integer. We automatically snap the delta value to the closest integer. Padding is supported. Note: this only works for images with at least 3 dimensions. Does nothing - on images with less than 3 dimensions. + on images with less than 3 dimensions.(advanced) """ preprocess_description = "Deskew image" + ImageTransformBase.preprocess_description diff --git a/aydin/it/transforms/motion.py b/aydin/it/transforms/motion.py index 46ba006a..3618fc4f 100644 --- a/aydin/it/transforms/motion.py +++ b/aydin/it/transforms/motion.py @@ -25,7 +25,7 @@ class MotionStabilisationTransform(ImageTransformBase): we assume that all frames can be registered to a common reference frame, and thus that all images have a common background that can be used for registration. For completeness, multiple axis can be specified and the - correction is applied along each in sequence. + correction is applied along each in sequence.(advanced) """ preprocess_description = ( diff --git a/aydin/it/transforms/periodic.py b/aydin/it/transforms/periodic.py index 9c005a3c..f478fb5c 100644 --- a/aydin/it/transforms/periodic.py +++ b/aydin/it/transforms/periodic.py @@ -16,7 +16,7 @@ class PeriodicNoiseSuppressionTransform(ImageTransformBase): Some images have a form of periodic noise that can be seen as strong peaks in their power spectral density. Suppressing these peaks before and after denoising is often a good idea. This is tricky to use, use with - care. Works with non-axis aligned periodic patterns. + care. Works with non-axis aligned periodic patterns.(advanced) """ preprocess_description = ( From ccf4227cfc2500f9472c4e6d52e95f82268a3c52 Mon Sep 17 00:00:00 2001 From: acs-ws Date: Fri, 7 Jan 2022 14:50:49 -0800 Subject: [PATCH 11/13] reverting unnecessary change --- aydin/restoration/denoise/util/test/test_denoise_utils.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/aydin/restoration/denoise/util/test/test_denoise_utils.py b/aydin/restoration/denoise/util/test/test_denoise_utils.py index 317bba93..4d75f9e3 100644 --- a/aydin/restoration/denoise/util/test/test_denoise_utils.py +++ b/aydin/restoration/denoise/util/test/test_denoise_utils.py @@ -4,10 +4,7 @@ get_list_of_denoiser_implementations, ) -implementations = get_list_of_denoiser_implementations() -pprint(implementations) - def est_denoise_utils(): implementations = get_list_of_denoiser_implementations() - print(implementations) + pprint(implementations) From b1c3dc565fadeee59a6e563b7e2580b99e2b511c Mon Sep 17 00:00:00 2001 From: acs-ws Date: Fri, 7 Jan 2022 15:20:34 -0800 Subject: [PATCH 12/13] parameter filtering enabled --- aydin/gui/_qt/custom_widgets/constructor_arguments.py | 11 +++++++++++ aydin/gui/_qt/custom_widgets/denoise_tab_method.py | 2 +- aydin/gui/_qt/transforms_tab_widget.py | 2 ++ aydin/gui/tabs/qt/denoise.py | 6 ++++++ aydin/it/transforms/attenuation.py | 2 +- 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/aydin/gui/_qt/custom_widgets/constructor_arguments.py b/aydin/gui/_qt/custom_widgets/constructor_arguments.py index 7bcfdfc4..b515d061 100644 --- a/aydin/gui/_qt/custom_widgets/constructor_arguments.py +++ b/aydin/gui/_qt/custom_widgets/constructor_arguments.py @@ -129,3 +129,14 @@ def params_dict(self): params_dict["kwargs"][name] = value return params_dict + + def set_advanced_enabled(self, enable: bool = False): + for _ in range(self.arguments_layout.rowCount()): + if ( + "(advanced)" + in self.arguments_layout.itemAtPosition(_, 2).widget().text() + ): + for column_index in range(3): + self.arguments_layout.itemAtPosition( + _, column_index + ).widget().setHidden(not enable) diff --git a/aydin/gui/_qt/custom_widgets/denoise_tab_method.py b/aydin/gui/_qt/custom_widgets/denoise_tab_method.py index 974155c2..87f733ba 100644 --- a/aydin/gui/_qt/custom_widgets/denoise_tab_method.py +++ b/aydin/gui/_qt/custom_widgets/denoise_tab_method.py @@ -88,7 +88,7 @@ def __init__(self, parent, name=None, description=None): for component in list(args.keys()): sub_dict = args[component] - self.constructor_arguments_widget = ConstructorArgumentsWidget( + self.constructor_arguments_widget = ConstructorArgumentsWidget( # TODO: making return of this member doesn't make sense, double check self, arg_names=sub_dict["arguments"], arg_defaults=sub_dict["defaults"], diff --git a/aydin/gui/_qt/transforms_tab_widget.py b/aydin/gui/_qt/transforms_tab_widget.py index 2e9e1dcf..ed6f3f14 100644 --- a/aydin/gui/_qt/transforms_tab_widget.py +++ b/aydin/gui/_qt/transforms_tab_widget.py @@ -54,3 +54,5 @@ def set_advanced_enabled(self, enable: bool = False): for index, item_widget in enumerate(self.list_of_item_widgets): if "(advanced)" in item_widget.transform_class.__doc__: self.setTabEnabled(index, enable) + + item_widget.constructor_arguments_widget.set_advanced_enabled(enable=enable) diff --git a/aydin/gui/tabs/qt/denoise.py b/aydin/gui/tabs/qt/denoise.py index fccac7bb..a2ab71a1 100644 --- a/aydin/gui/tabs/qt/denoise.py +++ b/aydin/gui/tabs/qt/denoise.py @@ -150,3 +150,9 @@ def set_advanced_enabled(self, enable: bool = False): self, name=backend_option, description=description_list[index] ) ) + + for widget_index in range(self.stacked_widget.count()): + for key, constructor_arguments_widget in self.stacked_widget.widget( + widget_index + ).constructor_arguments_widget_dict.items(): + constructor_arguments_widget.set_advanced_enabled(enable=enable) diff --git a/aydin/it/transforms/attenuation.py b/aydin/it/transforms/attenuation.py index 97d7033b..f907d930 100644 --- a/aydin/it/transforms/attenuation.py +++ b/aydin/it/transforms/attenuation.py @@ -42,7 +42,7 @@ def __init__( ---------- axes : Union[None, int, Sequence[int]] Axis or list of axes over which to correct attenuation. - If None the axes are automatically determined. + If None the axes are automatically determined. (advanced) mode : str Attenuation fitting mode, only currently supported: 'linear' From d5b0c7f774626c8b9ed081f6c79e09bfc9d3dfb1 Mon Sep 17 00:00:00 2001 From: acs-ws Date: Fri, 7 Jan 2022 15:25:19 -0800 Subject: [PATCH 13/13] fix denoise tab init after enabling basic/advanced toggle, removed test advanced tag from parameter in attenuation.py --- aydin/gui/tabs/qt/denoise.py | 2 ++ aydin/it/transforms/attenuation.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/aydin/gui/tabs/qt/denoise.py b/aydin/gui/tabs/qt/denoise.py index a2ab71a1..ff09119c 100644 --- a/aydin/gui/tabs/qt/denoise.py +++ b/aydin/gui/tabs/qt/denoise.py @@ -113,6 +113,8 @@ def __init__(self, parent): self.setLayout(self.tab_layout) + self.set_advanced_enabled(enable=False) # to init the tab correctly + def change_current_method(self, new_index): self.stacked_widget.setCurrentIndex(new_index) diff --git a/aydin/it/transforms/attenuation.py b/aydin/it/transforms/attenuation.py index f907d930..97d7033b 100644 --- a/aydin/it/transforms/attenuation.py +++ b/aydin/it/transforms/attenuation.py @@ -42,7 +42,7 @@ def __init__( ---------- axes : Union[None, int, Sequence[int]] Axis or list of axes over which to correct attenuation. - If None the axes are automatically determined. (advanced) + If None the axes are automatically determined. mode : str Attenuation fitting mode, only currently supported: 'linear'