From d870bcc5df5416e29f1eaf445710847bb55f6821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Sat, 18 Jun 2016 23:39:09 +0200 Subject: [PATCH] Minor fixes --- doc/examples/segmentation/plot_thresholding.py | 7 ------- doc/examples/xx_applications/plot_thresholding.py | 11 ----------- skimage/filters/thresholding.py | 4 ++-- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/doc/examples/segmentation/plot_thresholding.py b/doc/examples/segmentation/plot_thresholding.py index baa6b0b4..09654b5d 100644 --- a/doc/examples/segmentation/plot_thresholding.py +++ b/doc/examples/segmentation/plot_thresholding.py @@ -49,9 +49,6 @@ plt.show() # the best algorithm for you data without a deep understanding of their # mechanisms. -import matplotlib.pyplot as plt - -from skimage import data from skimage.filters import thresholding img = data.page() @@ -61,7 +58,3 @@ img = data.page() fig, ax = thresholding.try_all_threshold(img, radius=20, figsize=(10, 8), verbose=False) plt.show() - - - - diff --git a/doc/examples/xx_applications/plot_thresholding.py b/doc/examples/xx_applications/plot_thresholding.py index 3fae3c4f..e6a93242 100644 --- a/doc/examples/xx_applications/plot_thresholding.py +++ b/doc/examples/xx_applications/plot_thresholding.py @@ -51,7 +51,6 @@ plt.show() # and naive threshold value, which is sometimes used as a guess value. from skimage.filters.thresholding import threshold_mean -from skimage import data image = data.camera() @@ -83,9 +82,6 @@ plt.show() # histogram, there can be multiple pixel values with the minimum histogram # count, so you can pick the 'min', 'mid', or 'max' of these values. -import matplotlib.pyplot as plt - -from skimage import data from skimage.filters.thresholding import threshold_minimum @@ -182,9 +178,6 @@ plt.show() # each pixel (i.e. local neighborhoods). Each threshold value is the weighted mean # of the local neighborhood minus an offset value. -import matplotlib.pyplot as plt - -from skimage import data from skimage.filters import threshold_otsu, threshold_adaptive @@ -223,14 +216,10 @@ plt.show() # The example compares the local threshold with the global threshold. # -from skimage import data from skimage.morphology import disk from skimage.filters import threshold_otsu, rank from skimage.util import img_as_ubyte -import matplotlib -import matplotlib.pyplot as plt - img = img_as_ubyte(data.page()) diff --git a/skimage/filters/thresholding.py b/skimage/filters/thresholding.py index d3cc8ca5..97b3e5e9 100644 --- a/skimage/filters/thresholding.py +++ b/skimage/filters/thresholding.py @@ -43,7 +43,7 @@ def _try_all(image, methods=None, figsize=None, num_cols=2, verbose=True): """ from matplotlib import pyplot as plt - num_rows = math.ceil((len(methods) + 1) / 2.) + num_rows = math.ceil((len(methods) + 1.) / num_cols) num_rows = int(num_rows) # Python 2.7 support fig, ax = plt.subplots(num_rows, num_cols, figsize=figsize, sharex=True, sharey=True, @@ -75,7 +75,7 @@ def try_all_threshold(image, radius=None, figsize=(8, 5), verbose=True): ---------- image : (N, M) ndarray Input image. - radius : int, optinal + radius : int, optional Lengthscale used for local methods. If None, local methods are ignored. figsize : tuple, optional