diff --git a/TODO.txt b/TODO.txt index bfc0f4c0..cf5d4556 100644 --- a/TODO.txt +++ b/TODO.txt @@ -12,13 +12,7 @@ Version 0.11 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` -* 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_*` -* Remove deprecated parameter `depth` in `skimage.segmentation.random_walker` * Remove deprecated logger function in `skimage/__init__.py` * Remove deprecated function `filter.median_filter` * Enable doctests of experimental `skimage.feature.brief` diff --git a/doc/examples/applications/plot_rank_filters.py b/doc/examples/applications/plot_rank_filters.py index 5fa88aa0..ce5014a3 100644 --- a/doc/examples/applications/plot_rank_filters.py +++ b/doc/examples/applications/plot_rank_filters.py @@ -142,11 +142,11 @@ the central one. """ -from skimage.filter.rank import bilateral_mean +from skimage.filter.rank import mean_bilateral noisy_image = img_as_ubyte(data.camera()) -bilat = bilateral_mean(noisy_image.astype(np.uint16), disk(20), s0=10, s1=10) +bilat = mean_bilateral(noisy_image.astype(np.uint16), disk(20), s0=10, s1=10) fig, ax = plt.subplots(2, 2, figsize=(10, 7)) ax1, ax2, ax3, ax4 = ax.ravel() diff --git a/doc/examples/plot_segmentations.py b/doc/examples/plot_segmentations.py index b87dd146..abbf352d 100644 --- a/doc/examples/plot_segmentations.py +++ b/doc/examples/plot_segmentations.py @@ -51,7 +51,7 @@ and image location and is therefore closely related to quickshift. As the clustering method is simpler, it is very efficient. It is essential for this algorithm to work in Lab color space to obtain good results. The algorithm quickly gained momentum and is now widely used. See [3] for details. The -``ratio`` parameter trades off color-similarity and proximity, as in the case +``compactness`` parameter trades off color-similarity and proximity, as in the case of Quickshift, while ``n_segments`` chooses the number of centers for kmeans. .. [3] Radhakrishna Achanta, Appu Shaji, Kevin Smith, Aurelien Lucchi, diff --git a/skimage/filter/rank/__init__.py b/skimage/filter/rank/__init__.py index a2804178..8641b984 100644 --- a/skimage/filter/rank/__init__.py +++ b/skimage/filter/rank/__init__.py @@ -7,29 +7,6 @@ from ._percentile import (autolevel_percentile, gradient_percentile, pop_percentile, sum_percentile, threshold_percentile) from .bilateral import mean_bilateral, pop_bilateral, sum_bilateral -from skimage._shared.utils import deprecated - - -percentile_autolevel = deprecated('autolevel_percentile')(autolevel_percentile) - -percentile_gradient = deprecated('gradient_percentile')(gradient_percentile) - -percentile_mean = deprecated('mean_percentile')(mean_percentile) -bilateral_mean = deprecated('mean_bilateral')(mean_bilateral) - -meansubtraction = deprecated('subtract_mean')(subtract_mean) -percentile_mean_subtraction = deprecated('subtract_mean_percentile')\ - (subtract_mean_percentile) - -morph_contr_enh = deprecated('enhance_contrast')(enhance_contrast) -percentile_morph_contr_enh = deprecated('enhance_contrast_percentile')\ - (enhance_contrast_percentile) - -percentile_pop = deprecated('pop_percentile')(pop_percentile) -bilateral_pop = deprecated('pop_bilateral')(pop_bilateral) - -percentile_threshold = deprecated('threshold_percentile')(threshold_percentile) - __all__ = ['autolevel', 'autolevel_percentile', @@ -60,14 +37,4 @@ __all__ = ['autolevel', 'noise_filter', 'entropy', 'otsu', - 'percentile', - # Deprecated - 'percentile_autolevel', - 'percentile_gradient', - 'percentile_mean', - 'percentile_mean_subtraction', - 'percentile_morph_contr_enh', - 'percentile_pop', - 'percentile_threshold', - 'bilateral_mean', - 'bilateral_pop'] + 'percentile'] diff --git a/skimage/segmentation/random_walker_segmentation.py b/skimage/segmentation/random_walker_segmentation.py index 17c4c98b..ffd7526d 100644 --- a/skimage/segmentation/random_walker_segmentation.py +++ b/skimage/segmentation/random_walker_segmentation.py @@ -190,8 +190,7 @@ def _build_laplacian(data, spacing, mask=None, beta=50, def random_walker(data, labels, beta=130, mode='bf', tol=1.e-3, copy=True, - multichannel=False, return_full_prob=False, depth=1., - spacing=None): + multichannel=False, return_full_prob=False, spacing=None): """Random walker algorithm for segmentation from markers. Random walker algorithm is implemented for gray-level or multichannel @@ -203,8 +202,8 @@ def random_walker(data, labels, beta=130, mode='bf', tol=1.e-3, copy=True, Image to be segmented in phases. Gray-level `data` can be two- or three-dimensional; multichannel data can be three- or four- dimensional (multichannel=True) with the highest dimension denoting - channels. Data spacing is assumed isotropic unless depth keyword - argument is used. + channels. Data spacing is assumed isotropic unless the `spacing` + keyword argument is used. labels : array of ints, of same shape as `data` without channels dimension Array of seed markers labeled with different positive integers for different phases. Zero-labeled pixels are unlabeled pixels. @@ -249,13 +248,6 @@ def random_walker(data, labels, beta=130, mode='bf', tol=1.e-3, copy=True, return_full_prob : bool, default False If True, the probability that a pixel belongs to each of the labels will be returned, instead of only the most likely label. - depth : float, default 1. [DEPRECATED] - Correction for non-isotropic voxel depths in 3D volumes. - Default (1.) implies isotropy. This factor is derived as follows: - depth = (out-of-plane voxel spacing) / (in-plane voxel spacing), where - in-plane voxel spacing represents the first two spatial dimensions and - out-of-plane voxel spacing represents the third spatial dimension. - `depth` is deprecated as of 0.9, in favor of `spacing`. spacing : iterable of floats Spacing between voxels in each spatial dimension. If `None`, then the spacing between pixels/voxels in each dimension is assumed 1. @@ -344,10 +336,12 @@ def random_walker(data, labels, beta=130, mode='bf', tol=1.e-3, copy=True, """ if mode is None: - mode = 'bf' - warnings.warn("Default mode will change in the next release from 'bf' " - "to 'cg_mg' if pyamg is installed, else to 'cg' if " - "SciPy was built with UMFPACK, or to 'bf' otherwise.") + if amg_loaded: + mode = 'cg_mg' + elif UmfpackContext is not None: + mode = 'cg' + else: + mode = 'bf' if UmfpackContext is None and mode == 'cg': warnings.warn('SciPy was built without UMFPACK. Consider rebuilding ' @@ -355,19 +349,15 @@ def random_walker(data, labels, beta=130, mode='bf', tol=1.e-3, copy=True, 'random walker functions. You may also install pyamg ' 'and run the random walker function in cg_mg mode ' '(see the docstrings)') - if depth != 1.: - warnings.warn('`depth` kwarg is deprecated, and will be removed in the' - ' next major release. Use `spacing` instead.') # Spacing kwarg checks if spacing is None: - spacing = (1., 1.) + (depth, ) - elif len(spacing) == 2: - spacing = tuple(spacing) + (depth, ) + spacing = (1., 1., 1.) elif len(spacing) == 3: pass else: - raise ValueError('Input argument `spacing` incorrect, see docstring.') + raise ValueError('Input argument `spacing` incorrect, should be an ' + 'iterable of length 3.') # Parse input data if not multichannel: diff --git a/skimage/segmentation/tests/test_random_walker.py b/skimage/segmentation/tests/test_random_walker.py index 46a82d8e..54e0d832 100644 --- a/skimage/segmentation/tests/test_random_walker.py +++ b/skimage/segmentation/tests/test_random_walker.py @@ -184,7 +184,7 @@ def test_multispectral_3d(): return data, multi_labels, single_labels, labels -def test_depth(): +def test_spacing_0(): n = 30 lx, ly, lz = n, n, n data, _ = make_3d_syntheticdata(lx, ly, lz) @@ -202,14 +202,14 @@ def test_depth(): ly // 2 - small_l // 4, lz // 4 - small_l // 8] = 2 - # Test with `depth` kwarg + # Test with `spacing` kwarg labels_aniso = random_walker(data_aniso, labels_aniso, mode='cg', - depth=0.5) + spacing=(1., 1., 0.5)) assert (labels_aniso[13:17, 13:17, 7:9] == 2).all() -def test_spacing(): +def test_spacing_1(): n = 30 lx, ly, lz = n, n, n data, _ = make_3d_syntheticdata(lx, ly, lz) diff --git a/skimage/viewer/plugins/lineprofile.py b/skimage/viewer/plugins/lineprofile.py index e7c04d87..d0011c75 100644 --- a/skimage/viewer/plugins/lineprofile.py +++ b/skimage/viewer/plugins/lineprofile.py @@ -1,5 +1,4 @@ from __future__ import division -import warnings import numpy as np from skimage.util.dtype import dtype_range @@ -22,8 +21,6 @@ class LineProfile(PlotPlugin): ---------- maxdist : float Maximum pixel distance allowed when selecting end point of scan line. - epsilon : float - Deprecated. Use `maxdist` instead. limits : tuple or {None, 'image', 'dtype'} (minimum, maximum) intensity limits for plotted profile. The following special values are defined: @@ -37,10 +34,6 @@ class LineProfile(PlotPlugin): def __init__(self, maxdist=10, epsilon='deprecated', limits='image', **kwargs): super(LineProfile, self).__init__(**kwargs) - - if not epsilon == 'deprecated': - warnings.warn("Parameter `epsilon` deprecated; use `maxdist`.") - maxdist = epsilon self.maxdist = maxdist self._limit_type = limits print(self.help())