From 9091d2759a70e9714d4fa9fb5549a5a632dc479b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jostein=20B=C3=B8=20Fl=C3=B8ystad?= Date: Tue, 16 Jul 2013 13:06:53 +0200 Subject: [PATCH] unwrap: Change 2D wrapper code from float to double. --- skimage/exposure/_unwrap_2d.pyx | 8 ++++---- skimage/exposure/unwrap.py | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/skimage/exposure/_unwrap_2d.pyx b/skimage/exposure/_unwrap_2d.pyx index 88983287..6e889729 100644 --- a/skimage/exposure/_unwrap_2d.pyx +++ b/skimage/exposure/_unwrap_2d.pyx @@ -1,12 +1,12 @@ -cdef extern void unwrap2D(float* wrapped_image, - float* unwrapped_image, +cdef extern void unwrap2D(double* wrapped_image, + double* unwrapped_image, unsigned char* input_mask, int image_width, int image_height, int wrap_around_x, int wrap_around_y) -def unwrap_2d(float[:, ::1] image, +def unwrap_2d(double[:, ::1] image, unsigned char[:, ::1] mask, - float[:, ::1] unwrapped_image, + double[:, ::1] unwrapped_image, wrap_around): unwrap2D(&image[0, 0], &unwrapped_image[0, 0], diff --git a/skimage/exposure/unwrap.py b/skimage/exposure/unwrap.py index a2a8c42a..039ae911 100644 --- a/skimage/exposure/unwrap.py +++ b/skimage/exposure/unwrap.py @@ -92,6 +92,8 @@ def unwrap_phase(image, wrap_around=False): if image.ndim == 1: unwrap_1d(image_not_masked, image_unwrapped) elif image.ndim == 2: + image_not_masked = np.asarray(image, dtype=np.float64, order='C') + image_unwrapped = np.empty_like(image, dtype=np.float64, order='C') unwrap_2d(image_not_masked, mask, image_unwrapped, wrap_around) elif image.ndim == 3: