From 12c173908f921b80415d1992c04f03545d87d050 Mon Sep 17 00:00:00 2001 From: Gael Varoquaux Date: Fri, 20 Nov 2015 15:41:01 +0100 Subject: [PATCH] BUX: in _slic.pyx slice can has steps=None int(None) fails, and slice.steps == None is valid. It is equivalent to 1. --- skimage/segmentation/_slic.pyx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/skimage/segmentation/_slic.pyx b/skimage/segmentation/_slic.pyx index 19fc1627..bde81749 100644 --- a/skimage/segmentation/_slic.pyx +++ b/skimage/segmentation/_slic.pyx @@ -76,7 +76,8 @@ def _slic_cython(double[:, :, :, ::1] image_zyx, # approximate grid size for desired n_segments cdef Py_ssize_t step_z, step_y, step_x slices = regular_grid((depth, height, width), n_segments) - step_z, step_y, step_x = [int(s.step) for s in slices] + step_z, step_y, step_x = [int(s.step if s.step is not None else 1) + for s in slices] cdef Py_ssize_t[:, :, ::1] nearest_segments \ = np.empty((depth, height, width), dtype=np.intp)