Handle more warnings and reset io plugins as needed

Reset plugins prior to running collections test

Handle warnings in morphology pkg

Add __init__ for morpohology tests

Handle warnings for novice pkg

Handle warnings for restoration pkg

Handle warnings for segmentation pkg

Handle warnings for _shared pkg

Handle warnings for transform pkg

Handle warnings for util pkg

Handle warnings in viewer module
This commit is contained in:
Steven Silvester
2014-12-23 16:48:16 -06:00
parent 9e8f91930e
commit 0debedd82c
21 changed files with 161 additions and 75 deletions
+13 -6
View File
@@ -4,6 +4,7 @@ from numpy import testing
from skimage import data, color
from skimage.util import img_as_bool
from skimage.morphology import binary, grey, selem
from skimage._shared.utils import all_warnings
from scipy import ndimage
@@ -14,35 +15,40 @@ bw_img = img > 100
def test_non_square_image():
strel = selem.square(3)
binary_res = binary.binary_erosion(bw_img[:100, :200], strel)
grey_res = img_as_bool(grey.erosion(bw_img[:100, :200], strel))
with all_warnings(): # precision loss
grey_res = img_as_bool(grey.erosion(bw_img[:100, :200], strel))
testing.assert_array_equal(binary_res, grey_res)
def test_binary_erosion():
strel = selem.square(3)
binary_res = binary.binary_erosion(bw_img, strel)
grey_res = img_as_bool(grey.erosion(bw_img, strel))
with all_warnings(): # precision loss
grey_res = img_as_bool(grey.erosion(bw_img, strel))
testing.assert_array_equal(binary_res, grey_res)
def test_binary_dilation():
strel = selem.square(3)
binary_res = binary.binary_dilation(bw_img, strel)
grey_res = img_as_bool(grey.dilation(bw_img, strel))
with all_warnings(): # precision loss
grey_res = img_as_bool(grey.dilation(bw_img, strel))
testing.assert_array_equal(binary_res, grey_res)
def test_binary_closing():
strel = selem.square(3)
binary_res = binary.binary_closing(bw_img, strel)
grey_res = img_as_bool(grey.closing(bw_img, strel))
with all_warnings(): # precision loss
grey_res = img_as_bool(grey.closing(bw_img, strel))
testing.assert_array_equal(binary_res, grey_res)
def test_binary_opening():
strel = selem.square(3)
binary_res = binary.binary_opening(bw_img, strel)
grey_res = img_as_bool(grey.opening(bw_img, strel))
with all_warnings(): # precision loss
grey_res = img_as_bool(grey.opening(bw_img, strel))
testing.assert_array_equal(binary_res, grey_res)
@@ -51,7 +57,8 @@ def test_selem_overflow():
img = np.zeros((20, 20))
img[2:19, 2:19] = 1
binary_res = binary.binary_erosion(img, strel)
grey_res = img_as_bool(grey.erosion(img, strel))
with all_warnings(): # precision loss
grey_res = img_as_bool(grey.erosion(img, strel))
testing.assert_array_equal(binary_res, grey_res)