diff --git a/skimage/filter/__init__.py b/skimage/filter/__init__.py index ab74ced7..48fff2aa 100644 --- a/skimage/filter/__init__.py +++ b/skimage/filter/__init__.py @@ -14,28 +14,30 @@ del skimage_deprecation from ..filters.lpi_filter import inverse, wiener, LPIFilter2D from ..filters._gaussian import gaussian from ..filters.edges import (sobel, hsobel, vsobel, sobel_h, sobel_v, - scharr, hscharr, vscharr, scharr_h, scharr_v, - prewitt, hprewitt, vprewitt, prewitt_h, prewitt_v, - roberts, roberts_positive_diagonal, - roberts_negative_diagonal, roberts_pos_diag, - roberts_neg_diag) + scharr, hscharr, vscharr, scharr_h, scharr_v, + prewitt, hprewitt, vprewitt, prewitt_h, prewitt_v, + roberts, roberts_positive_diagonal, + roberts_negative_diagonal, roberts_pos_diag, + roberts_neg_diag) from ..filters._rank_order import rank_order from ..filters._gabor import gabor_kernel, gabor from ..filters.thresholding import (threshold_adaptive, threshold_otsu, threshold_yen, - threshold_isodata) + threshold_isodata) from ..filters import rank from ..filters.rank import median from .._shared.utils import deprecated from .. import restoration denoise_bilateral = deprecated('skimage.restoration.denoise_bilateral')\ - (restoration.denoise_bilateral) + (restoration.denoise_bilateral) denoise_tv_bregman = deprecated('skimage.restoration.denoise_tv_bregman')\ - (restoration.denoise_tv_bregman) + (restoration.denoise_tv_bregman) denoise_tv_chambolle = deprecated('skimage.restoration.denoise_tv_chambolle')\ - (restoration.denoise_tv_chambolle) + (restoration.denoise_tv_chambolle) # Backward compatibility v<0.11 + + @deprecated('skimage.feature.canny') def canny(*args, **kwargs): # Hack to avoid circular import diff --git a/skimage/filters/__init__.py b/skimage/filters/__init__.py index e78510f1..9dd0b4df 100644 --- a/skimage/filters/__init__.py +++ b/skimage/filters/__init__.py @@ -16,17 +16,19 @@ from .rank import median from .._shared.utils import deprecated, copy_func from .. import restoration denoise_bilateral = deprecated('skimage.restoration.denoise_bilateral')\ - (restoration.denoise_bilateral) + (restoration.denoise_bilateral) denoise_tv_bregman = deprecated('skimage.restoration.denoise_tv_bregman')\ - (restoration.denoise_tv_bregman) + (restoration.denoise_tv_bregman) denoise_tv_chambolle = deprecated('skimage.restoration.denoise_tv_chambolle')\ - (restoration.denoise_tv_chambolle) + (restoration.denoise_tv_chambolle) gaussian_filter = copy_func(gaussian, name='gaussian_filter') gaussian_filter = deprecated('skimage.filters.gaussian')(gaussian_filter) gabor_filter = copy_func(gabor, name='gabor_filter') gabor_filter = deprecated('skimage.filters.gabor')(gabor_filter) # Backward compatibility v<0.11 + + @deprecated('skimage.feature.canny') def canny(*args, **kwargs): # Hack to avoid circular import @@ -70,5 +72,5 @@ __all__ = ['inverse', 'threshold_otsu', 'threshold_yen', 'threshold_isodata', - 'threshold_li', + 'threshold_li', 'rank'] diff --git a/skimage/filters/_gabor.py b/skimage/filters/_gabor.py index 43f0e9de..211571f9 100644 --- a/skimage/filters/_gabor.py +++ b/skimage/filters/_gabor.py @@ -95,7 +95,7 @@ def gabor_kernel(frequency, theta=0, bandwidth=1, sigma_x=None, sigma_y=None, def gabor(image, frequency, theta=0, bandwidth=1, sigma_x=None, - sigma_y=None, n_stds=3, offset=0, mode='reflect', cval=0): + sigma_y=None, n_stds=3, offset=0, mode='reflect', cval=0): """Return real and imaginary responses to Gabor filter. The real and imaginary parts of the Gabor filter kernel are applied to the diff --git a/skimage/filters/_gaussian.py b/skimage/filters/_gaussian.py index 21fdfde8..ad4e621d 100644 --- a/skimage/filters/_gaussian.py +++ b/skimage/filters/_gaussian.py @@ -10,7 +10,7 @@ __all__ = ['gaussian'] def gaussian(image, sigma, output=None, mode='nearest', cval=0, - multichannel=None): + multichannel=None): """Multi-dimensional Gaussian filter Parameters diff --git a/skimage/filters/tests/test_gabor.py b/skimage/filters/tests/test_gabor.py index bc49fde8..0ed26ab0 100644 --- a/skimage/filters/tests/test_gabor.py +++ b/skimage/filters/tests/test_gabor.py @@ -15,7 +15,7 @@ def test_gabor_kernel_size(): kernel = gabor_kernel(0, theta=0, sigma_x=sigma_x, sigma_y=sigma_y) assert_equal(kernel.shape, (size_y, size_x)) - kernel = gabor_kernel(0, theta=np.pi/2, sigma_x=sigma_x, sigma_y=sigma_y) + kernel = gabor_kernel(0, theta=np.pi / 2, sigma_x=sigma_x, sigma_y=sigma_y) assert_equal(kernel.shape, (size_x, size_y)) @@ -39,7 +39,7 @@ def test_gabor_kernel_sum(): for sigma_x in range(1, 10, 2): for sigma_y in range(1, 10, 2): for frequency in range(0, 10, 2): - kernel = gabor_kernel(frequency+0.1, theta=0, + kernel = gabor_kernel(frequency + 0.1, theta=0, sigma_x=sigma_x, sigma_y=sigma_y) # make sure gaussian distribution is covered nearly 100% assert_almost_equal(np.abs(kernel).sum(), 1, 2) @@ -50,9 +50,9 @@ def test_gabor_kernel_theta(): for sigma_y in range(1, 10, 2): for frequency in range(0, 10, 2): for theta in range(0, 10, 2): - kernel0 = gabor_kernel(frequency+0.1, theta=theta, + kernel0 = gabor_kernel(frequency + 0.1, theta=theta, sigma_x=sigma_x, sigma_y=sigma_y) - kernel180 = gabor_kernel(frequency, theta=theta+np.pi, + kernel180 = gabor_kernel(frequency, theta=theta + np.pi, sigma_x=sigma_x, sigma_y=sigma_y) assert_array_almost_equal(np.abs(kernel0), diff --git a/skimage/filters/tests/test_gaussian.py b/skimage/filters/tests/test_gaussian.py index 5130beca..2d78ce6c 100644 --- a/skimage/filters/tests/test_gaussian.py +++ b/skimage/filters/tests/test_gaussian.py @@ -30,23 +30,23 @@ def test_multichannel(): a = np.zeros((5, 5, 3)) a[1, 1] = np.arange(1, 4) gaussian_rgb_a = gaussian(a, sigma=1, mode='reflect', - multichannel=True) + multichannel=True) # Check that the mean value is conserved in each channel # (color channels are not mixed together) assert np.allclose([a[..., i].mean() for i in range(3)], - [gaussian_rgb_a[..., i].mean() for i in range(3)]) + [gaussian_rgb_a[..., i].mean() for i in range(3)]) # Test multichannel = None with expected_warnings(['multichannel']): gaussian_rgb_a = gaussian(a, sigma=1, mode='reflect') # Check that the mean value is conserved in each channel # (color channels are not mixed together) assert np.allclose([a[..., i].mean() for i in range(3)], - [gaussian_rgb_a[..., i].mean() for i in range(3)]) + [gaussian_rgb_a[..., i].mean() for i in range(3)]) # Iterable sigma gaussian_rgb_a = gaussian(a, sigma=[1, 2], mode='reflect', - multichannel=True) + multichannel=True) assert np.allclose([a[..., i].mean() for i in range(3)], - [gaussian_rgb_a[..., i].mean() for i in range(3)]) + [gaussian_rgb_a[..., i].mean() for i in range(3)]) if __name__ == "__main__": diff --git a/skimage/util/tests/test_apply_parallel.py b/skimage/util/tests/test_apply_parallel.py index ec0dba78..47dd0de8 100644 --- a/skimage/util/tests/test_apply_parallel.py +++ b/skimage/util/tests/test_apply_parallel.py @@ -14,8 +14,8 @@ def test_apply_parallel(): # apply the filter expected1 = threshold_adaptive(a, 3) result1 = apply_parallel(threshold_adaptive, a, chunks=(6, 6), depth=5, - extra_arguments=(3,), - extra_keywords={'mode': 'reflect'}) + extra_arguments=(3,), + extra_keywords={'mode': 'reflect'}) assert_array_almost_equal(result1, expected1) @@ -56,6 +56,6 @@ def test_apply_parallel_nearest(): a = np.arange(144).reshape(12, 12).astype(float) expected = gaussian(a, 1, mode='nearest') result = apply_parallel(wrapped, a, chunks=(6, 6), depth={0: 5, 1: 5}, - mode='nearest') + mode='nearest') assert_array_almost_equal(result, expected)