mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-05 07:39:15 +08:00
More doctest and pil_plugin fixes
Fix Python2 imread in pil_plugin. Load from data Use all_warnings when importing the other packages More fixes for regionprops doctest
This commit is contained in:
@@ -179,9 +179,11 @@ def mono_check(plugin, fmt='png'):
|
||||
|
||||
|
||||
def setup_test():
|
||||
from scipy import signal, ndimage, special, optimize, linalg
|
||||
from skimage import filter, viewer
|
||||
warnings.simplefilter('error')
|
||||
with all_warnings():
|
||||
from scipy import signal, ndimage, special, optimize, linalg
|
||||
from skimage import filter, viewer, data
|
||||
data.moon()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -180,7 +180,10 @@ def ndarray_to_pil(arr, format_str=None):
|
||||
|
||||
if arr.ndim == 2:
|
||||
im = Image.new(mode_base, arr.T.shape)
|
||||
im.frombytes(arr.tobytes(), 'raw', mode)
|
||||
try:
|
||||
im.frombytes(arr.tobytes(), 'raw', mode)
|
||||
except AttributeError:
|
||||
im.frombytes(arr.tostring(), 'raw', mode)
|
||||
|
||||
else:
|
||||
try:
|
||||
@@ -188,7 +191,7 @@ def ndarray_to_pil(arr, format_str=None):
|
||||
arr.tobytes())
|
||||
except AttributeError:
|
||||
im = Image.frombytes(mode, (arr.shape[1], arr.shape[0]),
|
||||
arr.tobytes())
|
||||
arr.tostring())
|
||||
return im
|
||||
|
||||
|
||||
|
||||
@@ -475,9 +475,11 @@ def regionprops(label_image, intensity_image=None, cache=True):
|
||||
>>> img = util.img_as_ubyte(data.coins()) > 110
|
||||
>>> label_img = label(img) # doctest: +SKIP
|
||||
>>> props = regionprops(label_img) # doctest: +SKIP
|
||||
>>> props[0].centroid # doctest: +SKIP centroid of first labeled object
|
||||
>>> # centroid of first labeled object
|
||||
>>> props[0].centroid # doctest: +SKIP
|
||||
(22.729879860483141, 81.912285234465827)
|
||||
>>> props[0]['centroid'] # doctest: +SKIP centroid of first labeled object
|
||||
>>> # centroid of first labeled object
|
||||
>>> props[0]['centroid'] # doctest: +SKIP
|
||||
(22.729879860483141, 81.912285234465827)
|
||||
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user