From 80114c026c38aaaa1a4079058cb58beefeabee71 Mon Sep 17 00:00:00 2001 From: Marianne Corvellec Date: Sat, 20 Apr 2013 13:25:36 +0800 Subject: [PATCH] Used instead of deprecated function. --- doc/examples/plot_watershed.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/examples/plot_watershed.py b/doc/examples/plot_watershed.py index 50857b2c..e5e8893c 100644 --- a/doc/examples/plot_watershed.py +++ b/doc/examples/plot_watershed.py @@ -28,7 +28,8 @@ See Wikipedia_ for more details on the algorithm. import numpy as np import matplotlib.pyplot as plt -from skimage.morphology import watershed, is_local_maximum +from skimage.morphology import watershed +from skimage.feature import peak_local_max # Generate an initial image with two overlapping circles x, y = np.indices((80, 80)) @@ -42,7 +43,8 @@ image = np.logical_or(mask_circle1, mask_circle2) # Generate the markers as local maxima of the distance to the background from scipy import ndimage distance = ndimage.distance_transform_edt(image) -local_maxi = is_local_maximum(distance, image, np.ones((3, 3))) +local_maxi = peak_local_max(distance, indices=False, footprint=np.ones((3, 3)), + labels=image) markers = ndimage.label(local_maxi)[0] labels = watershed(-distance, markers, mask=image)