diff --git a/skimage/feature/_canny.py b/skimage/feature/_canny.py index e98b88e2..4788b94d 100644 --- a/skimage/feature/_canny.py +++ b/skimage/feature/_canny.py @@ -109,15 +109,15 @@ def canny(image, sigma=1., low_threshold=None, high_threshold=None, mask=None): Examples -------- - >>> from skimage import filters + >>> from skimage import feature >>> # Generate noisy image of a square >>> im = np.zeros((256, 256)) >>> im[64:-64, 64:-64] = 1 >>> im += 0.2 * np.random.rand(*im.shape) >>> # First trial with the Canny filter, with the default smoothing - >>> edges1 = filter.canny(im) + >>> edges1 = feature.canny(im) >>> # Increase the smoothing for better results - >>> edges2 = filter.canny(im, sigma=3) + >>> edges2 = feature.canny(im, sigma=3) """ # diff --git a/skimage/measure/_ccomp.pyx b/skimage/measure/_ccomp.pyx index a9c4ab55..66c7f75f 100644 --- a/skimage/measure/_ccomp.pyx +++ b/skimage/measure/_ccomp.pyx @@ -409,18 +409,19 @@ def label(input, neighbors=None, background=None, return_num=False, Examples -------- + >>> import numpy as np >>> x = np.eye(3).astype(int) >>> print(x) [[1 0 0] [0 1 0] [0 0 1]] - - >>> print(m.label(x, connectivity=1)) + >>> from skimage.measure import label + >>> print(label(x, neighbors=4)) [[0 1 1] [2 3 1] [2 2 4]] - >>> print(m.label(x, connectivity=2)) + >>> print(label(x, neighbors=8)) [[0 1 1] [1 0 1] [1 1 0]] @@ -429,7 +430,7 @@ def label(input, neighbors=None, background=None, return_num=False, ... [1, 1, 5], ... [0, 0, 0]]) - >>> print(m.label(x, background=0)) + >>> print(label(x, background=0)) [[ 0 -1 -1] [ 0 0 1] [-1 -1 -1]] diff --git a/skimage/restoration/_denoise.py b/skimage/restoration/_denoise.py index a73f50e3..f8401808 100644 --- a/skimage/restoration/_denoise.py +++ b/skimage/restoration/_denoise.py @@ -314,7 +314,7 @@ def denoise_tv_chambolle(im, weight=50, eps=2.e-4, n_iter_max=200, >>> from skimage import color, data >>> img = color.rgb2gray(data.astronaut())[:50, :50] - >>> img += 0.5 * img.std() * np.random.randn(*astro.shape) + >>> img += 0.5 * img.std() * np.random.randn(*img.shape) >>> denoised_img = denoise_tv_chambolle(img, weight=60) 3D example on synthetic data: diff --git a/skimage/transform/_geometric.py b/skimage/transform/_geometric.py index e6e26930..78387cf1 100644 --- a/skimage/transform/_geometric.py +++ b/skimage/transform/_geometric.py @@ -1111,8 +1111,8 @@ def warp(image, inverse_map=None, map_args={}, output_shape=None, order=1, >>> scale = 0.1 >>> output_shape = (scale * cube_shape).astype(int) - >>> coords0, coords1, coords2 = \ - ... np.mgrid[:output_shape[0], :output_shape[1], :output_shape[2]] + >>> coords0, coords1, coords2 = np.mgrid[:output_shape[0], + ... :output_shape[1], :output_shape[2]] >>> coords = np.array([coords0, coords1, coords2]) Assume that the cube contains spatial data, where the first array element