diff --git a/skimage/filter/rank/bilateral_rank.pyx b/skimage/filter/rank/bilateral_rank.pyx index 39afa71a..73434bb5 100644 --- a/skimage/filter/rank/bilateral_rank.pyx +++ b/skimage/filter/rank/bilateral_rank.pyx @@ -41,10 +41,10 @@ def _apply(func8, func16, image, selem, out, mask, shift_x, shift_y, s0, s1): else: mask = np.ascontiguousarray(mask) mask = img_as_ubyte(mask) + if image is out: raise NotImplementedError("Cannot perform rank operation in place.") - mask = np.ascontiguousarray(mask) if image.dtype == np.uint8: if func8 is None: raise TypeError("Not implemented for uint8 image.") diff --git a/skimage/filter/rank/percentile_rank.pyx b/skimage/filter/rank/percentile_rank.pyx index c5a5a594..5e506035 100644 --- a/skimage/filter/rank/percentile_rank.pyx +++ b/skimage/filter/rank/percentile_rank.pyx @@ -40,10 +40,10 @@ def _apply(func8, func16, image, selem, out, mask, shift_x, shift_y, p0, p1): else: mask = np.ascontiguousarray(mask) mask = img_as_ubyte(mask) + if image is out: raise NotImplementedError("Cannot perform rank operation in place.") - mask = np.ascontiguousarray(mask) if image.dtype == np.uint8: if func8 is None: raise TypeError("Not implemented for uint8 image.") diff --git a/skimage/filter/rank/rank.pyx b/skimage/filter/rank/rank.pyx index 8ac98f81..74add3d7 100644 --- a/skimage/filter/rank/rank.pyx +++ b/skimage/filter/rank/rank.pyx @@ -33,10 +33,10 @@ def _apply(func8, func16, image, selem, out, mask, shift_x, shift_y): else: mask = np.ascontiguousarray(mask) mask = img_as_ubyte(mask) + if image is out: raise NotImplementedError("Cannot perform rank operation in place.") - mask = np.ascontiguousarray(mask) if image.dtype == np.uint8: if func8 is None: raise TypeError("Not implemented for uint8 image.")