@@ -589,11 +589,12 @@ def make_buttons(self):
589589 w = 3
590590 for j in range (len (self .filter_text )):
591591 self .FilterButtons .append (
592- guiparts .FilterButton (self , self .filter_text [j ]))
592+ guiparts .FilterButton (self . medfont , self .filter_text [j ]))
593593 self .filterBox_grid_layout .addWidget (self .FilterButtons [- 1 ], widget_row , jj , 1 , w )
594594 self .FilterButtons [- 1 ].setFixedWidth (75 )
595595 self .FilterButtons [- 1 ].setToolTip (nett [j ])
596596 self .FilterButtons [- 1 ].setFont (self .medfont )
597+ self .FilterButtons [- 1 ].pressed_type .connect (self .filter_button_pressed )
597598 widget_row += 1 if j % 2 == 1 else 0
598599 jj = 0 if j % 2 == 1 else jj + w
599600
@@ -777,8 +778,6 @@ def enable_buttons(self):
777778
778779 for i in range (len (self .FilterButtons )):
779780 self .FilterButtons [i ].setEnabled (True )
780- if self .load_3D :
781- self .FilterButtons [- 2 ].setEnabled (False )
782781
783782 self .newmodel .setEnabled (True )
784783 self .loadMasks .setEnabled (True )
@@ -1618,7 +1617,7 @@ def compute_saturation_if_checked(self):
16181617
16191618 def compute_saturation (self , return_img = False ):
16201619 norm = self .get_normalize_params ()
1621- print ( norm )
1620+ self . logger . debug ( f'Compute saturation normalization: { norm } ' )
16221621 sharpen , smooth = norm ["sharpen_radius" ], norm ["smooth_radius" ]
16231622 percentile = norm ["percentile" ]
16241623 tile_norm = norm ["tile_norm_blocksize" ]
@@ -1663,6 +1662,8 @@ def compute_saturation(self, return_img=False):
16631662 self .ViewDropDown .setCurrentIndex (self .ViewDropDown .count () - 1 )
16641663 else :
16651664 img_norm = self .stack if self .restore is None or self .restore == "filter" else self .stack_filtered
1665+ self .ViewDropDown .model ().item (self .ViewDropDown .count () - 1 ).setEnabled (False )
1666+ self .ViewDropDown .setCurrentIndex (0 )
16661667
16671668 if self .autobtn .isChecked ():
16681669 self .saturation = []
@@ -1694,7 +1695,7 @@ def compute_saturation(self, return_img=False):
16941695 else :
16951696 for n in range (self .NZ ):
16961697 self .saturation [- 1 ].append ([0 , 255. ])
1697- print ( self .saturation [2 ][self .currentZ ])
1698+ self . logger . debug ( f'compute_saturation: saturation[2] levels at currentZ: { self .saturation [2 ][self .currentZ ]} ' )
16981699
16991700 if img_norm .shape [- 1 ] == 1 :
17001701 self .saturation .append (self .saturation [0 ])
@@ -1949,3 +1950,28 @@ def compute_segmentation(self, custom=False, model_name=None, load_model=True):
19491950 self .recompute_masks = False
19501951 except Exception as e :
19511952 print ("ERROR: %s" % e )
1953+
1954+ def filter_button_pressed (self , model_type : str ):
1955+ if model_type == 'filter' :
1956+ normalize_params = self .get_normalize_params ()
1957+ if (normalize_params ["sharpen_radius" ] == 0 and
1958+ normalize_params ["smooth_radius" ] == 0 and
1959+ normalize_params ["tile_norm_blocksize" ] == 0 ):
1960+ print (
1961+ "GUI_ERROR: no filtering settings on (use custom filter settings)" )
1962+ self .restore = None
1963+ return
1964+ self .restore = "filter"
1965+
1966+ elif model_type == 'none' :
1967+ self .set_normalize_params (
1968+ {
1969+ 'sharpen_radius' : 0 ,
1970+ 'smooth_radius' : 0 ,
1971+ 'tile_norm_blocksize' : 0 ,
1972+ }
1973+ )
1974+ self .restore = None
1975+ else :
1976+ self .logger .error (f'Filter model type not known: { model_type } ' )
1977+ self .compute_saturation ()
0 commit comments