diff --git a/skimage/thresholding/__init__.py b/skimage/thresholding/__init__.py index d588eda0..d5d6eddf 100644 --- a/skimage/thresholding/__init__.py +++ b/skimage/thresholding/__init__.py @@ -1 +1 @@ -from .thresholding import otsu_threshold, binarize +from .thresholding import threshold_otsu, binarize diff --git a/skimage/thresholding/tests/test_thresholding.py b/skimage/thresholding/tests/test_thresholding.py index 713defe4..485ffbca 100644 --- a/skimage/thresholding/tests/test_thresholding.py +++ b/skimage/thresholding/tests/test_thresholding.py @@ -2,7 +2,7 @@ import numpy as np import skimage from skimage import data -from skimage.thresholding import otsu_threshold, binarize +from skimage.thresholding import threshold_otsu, binarize class TestSimpleImage(): @@ -14,16 +14,16 @@ class TestSimpleImage(): [4, 5, 1, 0, 0]], dtype=int) def test_otsu(self): - assert otsu_threshold(self.image) == 2 + assert threshold_otsu(self.image) == 2 @np.testing.raises(NotImplementedError) def test_otsu_raises_error(self): image = self.image - 2 - otsu_threshold(image) + threshold_otsu(image) def test_otsu_float_image(self): image = np.float64(self.image) - assert 2 <= otsu_threshold(image) < 3 + assert 2 <= threshold_otsu(image) < 3 def test_binarize(self): expected = np.array([[0, 0, 0, 1, 1], @@ -35,17 +35,17 @@ class TestSimpleImage(): def test_otsu_camera_image(): - assert otsu_threshold(data.camera()) == 87 + assert threshold_otsu(data.camera()) == 87 def test_otsu_coins_image(): - assert otsu_threshold(data.coins()) == 107 + assert threshold_otsu(data.coins()) == 107 def test_otsu_coins_image_as_float(): coins = skimage.img_as_float(data.coins()) - assert 0.41 < otsu_threshold(coins) < 0.42 + assert 0.41 < threshold_otsu(coins) < 0.42 def test_otsu_lena_image(): - assert otsu_threshold(data.lena()) == 141 + assert threshold_otsu(data.lena()) == 141 if __name__ == '__main__': diff --git a/skimage/thresholding/thresholding.py b/skimage/thresholding/thresholding.py index b5699f7e..62af6d8d 100644 --- a/skimage/thresholding/thresholding.py +++ b/skimage/thresholding/thresholding.py @@ -1,10 +1,10 @@ import numpy as np -__all__ = ['otsu_threshold', 'binarize'] +__all__ = ['threshold_otsu', 'binarize'] -def otsu_threshold(image, bins=256): +def threshold_otsu(image, bins=256): """Return threshold value based on Otsu's method. Parameters @@ -45,7 +45,7 @@ def otsu_threshold(image, bins=256): return threshold -_threshold_funcs = {'otsu': otsu_threshold} +_threshold_funcs = {'otsu': threshold_otsu} def binarize(image, method='otsu'): """Return binary image using an automatic thresholding method.