From 55fe6ce2d685e25cfc9e0894c517bccd6b7bf4fe Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Mon, 20 May 2013 17:05:59 +1000 Subject: [PATCH] Bug fix: spatial vs image dimension comparison reversed --- skimage/segmentation/slic_superpixels.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skimage/segmentation/slic_superpixels.py b/skimage/segmentation/slic_superpixels.py index 35e00a34..1c9b8510 100644 --- a/skimage/segmentation/slic_superpixels.py +++ b/skimage/segmentation/slic_superpixels.py @@ -85,7 +85,7 @@ def slic(image, n_segments=100, ratio=10., max_iter=10, sigma=1, warnings.warn(RuntimeWarning(msg)) multichannel = True elif multichannel is None: - multichannel = (spatial_dims == image.ndim + 1) + multichannel = (spatial_dims + 1 == image.ndim) if ((not multichannel and image.ndim not in [2, 3]) or (multichannel and image.ndim not in [3, 4]) or (multichannel and image.shape[-1] != 3)):