Mercurial > repos > imgteam > 2d_local_threshold
diff auto_local_threshold.py @ 3:be2d3ce89c0f draft default tip
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/2d_auto_local_threshold/ commit b1b3c63ab021aa77875c3b04127f6836024812f9"
author | imgteam |
---|---|
date | Sat, 19 Feb 2022 15:17:19 +0000 |
parents | 497dcd834bb3 |
children |
line wrap: on
line diff
--- a/auto_local_threshold.py Wed Dec 18 05:00:26 2019 -0500 +++ b/auto_local_threshold.py Sat Feb 19 15:17:19 2022 +0000 @@ -1,9 +1,10 @@ import argparse import sys -import skimage.io + +import numpy as np import skimage.filters +import skimage.io import skimage.util -import numpy as np threshOptions = { 'gaussian': lambda img_raw, bz: skimage.filters.threshold_local(img_raw, bz, method='gaussian'), @@ -24,7 +25,7 @@ img_in = np.reshape(img_in, [img_in.shape[0], img_in.shape[1]]) thresh = threshOptions[args.thresh_type](img_in, args.block_size) - if args.dark_background: + if args.dark_background: res = img_in > thresh else: res = img_in <= thresh