mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-10 12:35:06 +08:00
Fix imports and suppress deprecation warnings
This commit is contained in:
@@ -3,7 +3,7 @@ __all__ = ['convex_hull_image', 'convex_hull_object']
|
||||
import numpy as np
|
||||
from ._pnpoly import grid_points_inside_poly
|
||||
from ._convex_hull import possible_hull
|
||||
from skimage.morphology import label
|
||||
from ..measure._ccomp import label
|
||||
from skimage.util import unique_rows
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ from numpy.testing import assert_array_equal, run_module_suite
|
||||
|
||||
from skimage.morphology import label
|
||||
from warnings import catch_warnings
|
||||
from _shared.util import skimage_deprecation
|
||||
|
||||
class TestConnectedComponents:
|
||||
def setup(self):
|
||||
@@ -25,7 +26,7 @@ class TestConnectedComponents:
|
||||
def test_random(self):
|
||||
x = (np.random.random((20, 30)) * 5).astype(np.int)
|
||||
|
||||
with catch_warnings(DeprecationWarning):
|
||||
with catch_warnings(skimage_deprecation):
|
||||
labels = label(x)
|
||||
|
||||
n = labels.max()
|
||||
@@ -37,13 +38,13 @@ class TestConnectedComponents:
|
||||
x = np.array([[0, 0, 1],
|
||||
[0, 1, 0],
|
||||
[1, 0, 0]])
|
||||
with catch_warnings(DeprecationWarning):
|
||||
with catch_warnings(skimage_deprecation):
|
||||
assert_array_equal(label(x), x)
|
||||
|
||||
def test_4_vs_8(self):
|
||||
x = np.array([[0, 1],
|
||||
[1, 0]], dtype=int)
|
||||
with catch_warnings(DeprecationWarning):
|
||||
with catch_warnings(skimage_deprecation):
|
||||
assert_array_equal(label(x, 4),
|
||||
[[0, 1],
|
||||
[2, 3]])
|
||||
@@ -56,7 +57,7 @@ class TestConnectedComponents:
|
||||
[1, 1, 5],
|
||||
[0, 0, 0]])
|
||||
|
||||
with catch_warnings(DeprecationWarning):
|
||||
with catch_warnings(skimage_deprecation):
|
||||
assert_array_equal(label(x), [[0, 1, 1],
|
||||
[0, 0, 2],
|
||||
[3, 3, 3]])
|
||||
@@ -91,7 +92,7 @@ class TestConnectedComponents:
|
||||
[0, 0, 6],
|
||||
[5, 5, 5]])
|
||||
|
||||
with catch_warnings(DeprecationWarning):
|
||||
with catch_warnings(skimage_deprecation):
|
||||
assert_array_equal(label(x, return_num=True)[1], 4)
|
||||
|
||||
assert_array_equal(label(x, background=0, return_num=True)[1], 3)
|
||||
|
||||
Reference in New Issue
Block a user