mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-03 18:06:42 +08:00
unwrap_phase returns masked array when image is masked
With commit e3b84ed the unwrap_phase function would always return an ndarray
even when image was masked. This restores the pre-e3b84ed behavior of
returning a masked array when the image is masked.
This commit is contained in:
@@ -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']):
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user