From fe02c18f3d5df6676225870a0df4314f7eafe2a9 Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Fri, 9 Aug 2013 18:43:24 +1000 Subject: [PATCH 1/2] Use Py_ssize_t instead of int in _slic_cython --- skimage/segmentation/_slic.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/skimage/segmentation/_slic.pyx b/skimage/segmentation/_slic.pyx index d4121721..d47cf8ff 100644 --- a/skimage/segmentation/_slic.pyx +++ b/skimage/segmentation/_slic.pyx @@ -14,10 +14,10 @@ from ..color import rgb2lab, gray2rgb def _slic_cython(double[:, :, :, ::1] image_zyx, - long[:, :, ::1] nearest_mean, + Py_ssize_t[:, :, ::1] nearest_mean, double[:, :, ::1] distance, double[:, ::1] means, - int max_iter, int n_segments): + Py_ssize_t max_iter, Py_ssize_t n_segments): """Helper function for SLIC segmentation. Parameters @@ -26,7 +26,7 @@ def _slic_cython(double[:, :, :, ::1] image_zyx, The image with embedded coordinates, that is, `image_zyx[i, j, k]` is `array([i, j, k, r, g, b])` or `array([i, j, k, L, a, b])`, depending on the colorspace. - nearest_mean : 3D np.ndarray of long, shape (Z, Y, X) + nearest_mean : 3D np.ndarray of int, shape (Z, Y, X) The (initially empty) label field. distance : 3D np.ndarray of double, shape (Z, Y, X) The (initially infinity) array of distances to the nearest centroid. From 4edf2278692a6f0fcbb9cd7846422cebb06fed34 Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Sat, 10 Aug 2013 11:17:18 +1000 Subject: [PATCH 2/2] Change 'long' to 'int' in Cython docs --- skimage/segmentation/_slic.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skimage/segmentation/_slic.pyx b/skimage/segmentation/_slic.pyx index d47cf8ff..bfa6cd1a 100644 --- a/skimage/segmentation/_slic.pyx +++ b/skimage/segmentation/_slic.pyx @@ -39,7 +39,7 @@ def _slic_cython(double[:, :, :, ::1] image_zyx, Returns ------- - nearest_mean : 3D np.ndarray of long, shape (Z, Y, X) + nearest_mean : 3D np.ndarray of int, shape (Z, Y, X) The label field/superpixels found by SLIC. """