def try_all_threshold(image, figsize=(8, 5), verbose=True):
 def thresh(func):
  '\n        A wrapper function to return a thresholded image.\n        '
  def wrapper(im):
   return (im > func(im))
  try:
   wrapper.__orifunc__ = func.__orifunc__
  except AttributeError:
   wrapper.__orifunc__ = ((func.__module__ + '.') + func.__name__)
  return wrapper
 methods = OrderedDict({'Isodata': thresh(threshold_isodata), 'Li': thresh(threshold_li), 'Mean': thresh(threshold_mean), 'Minimum': thresh(threshold_minimum), 'Otsu': thresh(threshold_otsu), 'Triangle': thresh(threshold_triangle), 'Yen': thresh(threshold_yen)})
 return _try_all(image, figsize=figsize, methods=methods, verbose=verbose)

def try_all_threshold ( image , figsize = ( 8 , 5 ) , verbose = True ) : def thresh ( func ) : def wrapper ( im ) : return ( im > func ( im ) ) try : wrapper . __orifunc__ = func . __orifunc__ except AttributeError : wrapper . __orifunc__ = ( ( func . __module__ + '.' ) + func . __name__ ) return wrapper methods = OrderedDict ( { 'Isodata' : thresh ( threshold_isodata ) , 'Li' : thresh ( threshold_li ) , 'Mean' : thresh ( threshold_mean ) , 'Minimum' : thresh ( threshold_minimum ) , 'Otsu' : thresh ( threshold_otsu ) , 'Triangle' : thresh ( threshold_triangle ) , 'Yen' : thresh ( threshold_yen ) } ) return _try_all ( image , figsize = figsize , methods = methods , verbose = verbose )
returns a figure comparing the outputs of different thresholding methods .