From 7ea3a754e0584cb5057f7928d0714ab1cd1ebef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Sat, 10 Nov 2012 08:59:48 +0100 Subject: [PATCH] Remove duplicate contiguous conversion --- skimage/filter/rank/bilateral_rank.pyx | 2 +- skimage/filter/rank/percentile_rank.pyx | 2 +- skimage/filter/rank/rank.pyx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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.")