diff --git a/skimage/restoration/tests/test_unwrap.py b/skimage/restoration/tests/test_unwrap.py index 979cd80c..ca4cfe32 100644 --- a/skimage/restoration/tests/test_unwrap.py +++ b/skimage/restoration/tests/test_unwrap.py @@ -131,6 +131,7 @@ def test_mask(): # The end of the unwrapped array should have value equal to the # endpoint of the unmasked ramp assert_array_almost_equal_nulp(image_unwrapped[:, -1], image[i, -1]) + assert np.ma.isMaskedArray(image_unwrapped) # Same tests, but forcing use of the 3D unwrapper by reshaping with expected_warnings(['length 1 dimension']): diff --git a/skimage/restoration/unwrap.py b/skimage/restoration/unwrap.py index 6dd7c7ef..36fe0d9d 100644 --- a/skimage/restoration/unwrap.py +++ b/skimage/restoration/unwrap.py @@ -89,11 +89,11 @@ def unwrap_phase(image, wrap_around=False, seed=None): if np.ma.isMaskedArray(image): mask = np.require(np.ma.getmaskarray(image), np.uint8, ['C']) - image = np.ma.getdata(image) else: mask = np.zeros_like(image, dtype=np.uint8, order='C') - image_not_masked = np.asarray(image, dtype=np.double, order='C') + image_not_masked = np.asarray( + np.ma.getdata(image), dtype=np.double, order='C') image_unwrapped = np.empty_like(image, dtype=np.double, order='C') if image.ndim == 1: