BUX: in _slic.pyx slice can has steps=None

int(None) fails, and slice.steps == None is valid. It is equivalent to 1.
This commit is contained in:
Gael Varoquaux
2015-12-08 12:27:24 +11:00
committed by Juan Nunez-Iglesias
parent 6f016c9087
commit 12c173908f
+2 -1
View File
@@ -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)