From 9510c03ce525c031a4514bbb266207d226ca9a79 Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Wed, 9 Apr 2014 17:55:35 +1000 Subject: [PATCH 1/4] Remove deprecated `ratio` keyword in SLIC --- skimage/segmentation/slic_superpixels.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/skimage/segmentation/slic_superpixels.py b/skimage/segmentation/slic_superpixels.py index 11373381..baac79ae 100644 --- a/skimage/segmentation/slic_superpixels.py +++ b/skimage/segmentation/slic_superpixels.py @@ -11,7 +11,7 @@ from skimage.color import rgb2lab def slic(image, n_segments=100, compactness=10., max_iter=10, sigma=None, - spacing=None, multichannel=True, convert2lab=True, ratio=None, + spacing=None, multichannel=True, convert2lab=True, enforce_connectivity=False, min_size_factor=0.5, max_size_factor=3, slic_zero=False): """Segments image using k-means clustering in Color-(x,y,z) space. @@ -48,8 +48,6 @@ def slic(image, n_segments=100, compactness=10., max_iter=10, sigma=None, Whether the input should be converted to Lab colorspace prior to segmentation. For this purpose, the input is assumed to be RGB. Highly recommended. - ratio : float, optional - Synonym for `compactness`. This keyword is deprecated. enforce_connectivity: bool, optional (default False) Whether the generated segments are connected or not min_size_factor: float, optional @@ -112,11 +110,6 @@ def slic(image, n_segments=100, compactness=10., max_iter=10, sigma=None, warnings.warn('Default value of keyword `sigma` changed from ``1`` ' 'to ``0``.') sigma = 0 - if ratio is not None: - warnings.warn('Keyword `ratio` is deprecated. Use `compactness` ' - 'instead.') - compactness = ratio - if enforce_connectivity is None: warnings.warn('Deprecation: enforce_connectivity will default to' ' True in future versions.') From dcd822bf485862597902e990bc867c3d27ff8fb9 Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Wed, 9 Apr 2014 17:57:06 +1000 Subject: [PATCH 2/4] Remove deprecated sigma default warning in SLIC --- skimage/segmentation/slic_superpixels.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/skimage/segmentation/slic_superpixels.py b/skimage/segmentation/slic_superpixels.py index baac79ae..7135047e 100644 --- a/skimage/segmentation/slic_superpixels.py +++ b/skimage/segmentation/slic_superpixels.py @@ -10,7 +10,7 @@ from skimage.segmentation._slic import _slic_cython, _enforce_label_connectivity from skimage.color import rgb2lab -def slic(image, n_segments=100, compactness=10., max_iter=10, sigma=None, +def slic(image, n_segments=100, compactness=10., max_iter=10, sigma=0, spacing=None, multichannel=True, convert2lab=True, enforce_connectivity=False, min_size_factor=0.5, max_size_factor=3, slic_zero=False): @@ -98,18 +98,13 @@ def slic(image, n_segments=100, compactness=10., max_iter=10, sigma=None, >>> from skimage.segmentation import slic >>> from skimage.data import lena >>> img = lena() - >>> segments = slic(img, n_segments=100, compactness=10, sigma=0) + >>> segments = slic(img, n_segments=100, compactness=10) Increasing the compactness parameter yields more square regions: - >>> segments = slic(img, n_segments=100, compactness=20, sigma=0) + >>> segments = slic(img, n_segments=100, compactness=20) """ - - if sigma is None: - warnings.warn('Default value of keyword `sigma` changed from ``1`` ' - 'to ``0``.') - sigma = 0 if enforce_connectivity is None: warnings.warn('Deprecation: enforce_connectivity will default to' ' True in future versions.') From 39d6360eecbdf4339db6b3267049f99bb5439011 Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Wed, 9 Apr 2014 17:58:10 +1000 Subject: [PATCH 3/4] Remove SLIC deprecations for 0.10 from TODO.txt --- TODO.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/TODO.txt b/TODO.txt index 10dfe117..11731d34 100644 --- a/TODO.txt +++ b/TODO.txt @@ -15,8 +15,6 @@ Version 0.10 * Remove deprecated functions in `skimage.filter.rank.*` * Remove deprecated parameter `epsilon` of `skimage.viewer.LineProfile` * Remove backwards-compatability of `skimage.measure.regionprops` -* Remove {`ratio`, `sigma`} deprecation warnings of `skimage.segmentation.slic` - and also remove explicit `sigma` parameter from doc-string example * Change default mode of random_walker segmentation to 'cg_mg' > 'cg' > 'bf', depending on which optional dependencies are available. * Remove deprecated `out` parameter of `skimage.morphology.binary_*` From 68a53337aa8761a74f3f9eb025716a336660d257 Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Wed, 9 Apr 2014 18:32:10 +1000 Subject: [PATCH 4/4] Remove 'ratio' kwarg from SLIC example --- doc/examples/plot_segmentations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/examples/plot_segmentations.py b/doc/examples/plot_segmentations.py index 931e92d5..b87dd146 100644 --- a/doc/examples/plot_segmentations.py +++ b/doc/examples/plot_segmentations.py @@ -70,7 +70,7 @@ from skimage.util import img_as_float img = img_as_float(lena()[::2, ::2]) segments_fz = felzenszwalb(img, scale=100, sigma=0.5, min_size=50) -segments_slic = slic(img, ratio=10, n_segments=250, sigma=1) +segments_slic = slic(img, n_segments=250, compactness=10, sigma=1) segments_quick = quickshift(img, kernel_size=3, max_dist=6, ratio=0.5) print("Felzenszwalb's number of segments: %d" % len(np.unique(segments_fz)))