Skip to content

Commit b528e4a

Browse files
committed
Use new import convention
1 parent a0410c3 commit b528e4a

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import numpy as np
2-
from numpy.testing import assert_array_equal
32

4-
from skimage.color import rgb2gray
5-
from skimage.data import astronaut, cells3d
6-
from skimage.filters import gaussian
7-
from skimage.measure import blur_effect
3+
import skimage as ski
84

95

106
def test_blur_effect():
117
"""Test that the blur metric increases with more blurring."""
12-
image = astronaut()
13-
B0 = blur_effect(image, channel_axis=-1)
14-
B1 = blur_effect(gaussian(image, sigma=1, channel_axis=-1), channel_axis=-1)
15-
B2 = blur_effect(gaussian(image, sigma=4, channel_axis=-1), channel_axis=-1)
8+
image = ski.data.astronaut()
9+
B0 = ski.measure.blur_effect(image, channel_axis=-1)
10+
B1 = ski.measure.blur_effect(
11+
ski.filters.gaussian(image, sigma=1, channel_axis=-1), channel_axis=-1
12+
)
13+
B2 = ski.measure.blur_effect(
14+
ski.filters.gaussian(image, sigma=4, channel_axis=-1), channel_axis=-1
15+
)
1616
assert 0 <= B0 < 1
1717
assert B0 < B1 < B2
1818

@@ -21,10 +21,10 @@ def test_blur_effect_h_size():
2121
"""Test that the blur metric decreases with increasing size of the
2222
re-blurring filter.
2323
"""
24-
image = astronaut()
25-
B0 = blur_effect(image, h_size=3, channel_axis=-1)
26-
B1 = blur_effect(image, channel_axis=-1) # default h_size is 11
27-
B2 = blur_effect(image, h_size=30, channel_axis=-1)
24+
image = ski.data.astronaut()
25+
B0 = ski.measure.blur_effect(image, h_size=3, channel_axis=-1)
26+
B1 = ski.measure.blur_effect(image, channel_axis=-1) # default h_size is 11
27+
B2 = ski.measure.blur_effect(image, h_size=30, channel_axis=-1)
2828
assert 0 <= B0 < 1
2929
assert B0 > B1 > B2
3030

@@ -33,22 +33,22 @@ def test_blur_effect_channel_axis():
3333
"""Test that passing an RGB image is equivalent to passing its grayscale
3434
version.
3535
"""
36-
image = astronaut()
37-
B0 = blur_effect(image, channel_axis=-1)
38-
B1 = blur_effect(rgb2gray(image))
39-
B0_arr = blur_effect(image, channel_axis=-1, reduce_func=None)
40-
B1_arr = blur_effect(rgb2gray(image), reduce_func=None)
36+
image = ski.data.astronaut()
37+
B0 = ski.measure.blur_effect(image, channel_axis=-1)
38+
B1 = ski.measure.blur_effect(ski.color.rgb2gray(image))
39+
B0_arr = ski.measure.blur_effect(image, channel_axis=-1, reduce_func=None)
40+
B1_arr = ski.measure.blur_effect(ski.color.rgb2gray(image), reduce_func=None)
4141
assert 0 <= B0 < 1
4242
assert B0 == B1
43-
assert_array_equal(B0_arr, B1_arr)
43+
np.testing.assert_array_equal(B0_arr, B1_arr)
4444

4545

4646
def test_blur_effect_3d():
4747
"""Test that the blur metric works on a 3D image."""
48-
image_3d = cells3d()[:, 1, :, :] # grab just the nuclei
49-
B0 = blur_effect(image_3d)
50-
B1 = blur_effect(gaussian(image_3d, sigma=1))
51-
B2 = blur_effect(gaussian(image_3d, sigma=4))
48+
image_3d = ski.data.cells3d()[:, 1, :, :] # grab just the nuclei
49+
B0 = ski.measure.blur_effect(image_3d)
50+
B1 = ski.measure.blur_effect(ski.filters.gaussian(image_3d, sigma=1))
51+
B2 = ski.measure.blur_effect(ski.filters.gaussian(image_3d, sigma=4))
5252
assert 0 <= B0 < 1
5353
assert B0 < B1 < B2
5454

@@ -57,4 +57,4 @@ def test_blur_effect_zerodivision():
5757
"""Test that the blur effect function errors upon division by zero."""
5858
image = np.zeros((100, 100, 3))
5959
with np.testing.raises(ZeroDivisionError):
60-
blur_effect(image)
60+
ski.measure.blur_effect(image)

0 commit comments

Comments
 (0)