mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-03 16:24:33 +08:00
BUG: unwrap_phase on compressed masked array
unwrap_phase works on masked arrays with a compressed mask (no elements masked) Closes #1346
This commit is contained in:
@@ -156,5 +156,14 @@ def test_unwrap_3d_middle_wrap_around():
|
||||
unwrap = unwrap_phase(image, wrap_around=[False, True, False])
|
||||
assert np.all(unwrap == 0)
|
||||
|
||||
|
||||
def test_unwrap_2d_compressed_mask():
|
||||
# ValueError when image is masked array with a compressed mask (no masked
|
||||
# elments). GitHub issue #1346
|
||||
image = np.ma.zeros((10, 10))
|
||||
unwrap = unwrap_phase(image)
|
||||
assert np.all(unwrap == 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_module_suite()
|
||||
|
||||
@@ -88,8 +88,8 @@ def unwrap_phase(image, wrap_around=False, seed=None):
|
||||
'algorithm')
|
||||
|
||||
if np.ma.isMaskedArray(image):
|
||||
mask = np.require(image.mask, np.uint8, ['C'])
|
||||
image = image.data
|
||||
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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user