From 264ca6ebd9d8a3fde26e77f4a35468de8f9959e0 Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Wed, 9 Apr 2014 23:41:37 +1000 Subject: [PATCH] Remove deprecated depth parameter in random_walker This has been supplanted by the `spacing` parameter. --- TODO.txt | 1 - .../random_walker_segmentation.py | 24 +++++-------------- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/TODO.txt b/TODO.txt index 2c84c7d1..b2145f1b 100644 --- a/TODO.txt +++ b/TODO.txt @@ -14,7 +14,6 @@ Version 0.10 ------------ * Remove backwards-compatability of `skimage.measure.regionprops` * 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/skimage/segmentation/random_walker_segmentation.py b/skimage/segmentation/random_walker_segmentation.py index ee4de3df..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. @@ -357,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: