From 46d330591f96e0560778ef3535ee40dcdb87418d Mon Sep 17 00:00:00 2001 From: emmanuelle Date: Mon, 23 Jan 2012 19:47:16 +0100 Subject: [PATCH] ENH Tony's comments on random walker --- doc/examples/plot_random_walker_segmentation.py | 1 - skimage/segmentation/random_walker_segmentation.py | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/examples/plot_random_walker_segmentation.py b/doc/examples/plot_random_walker_segmentation.py index 960bde28..72a6fb7f 100644 --- a/doc/examples/plot_random_walker_segmentation.py +++ b/doc/examples/plot_random_walker_segmentation.py @@ -39,7 +39,6 @@ def microstructure(l=256): """ n = 5 x, y = np.ogrid[0:l, 0:l] - mask_outer = (x - l / 2) ** 2 + (y - l / 2) ** 2 < (l / 2) ** 2 mask = np.zeros((l, l)) generator = np.random.RandomState(1) points = l * generator.rand(2, n ** 2) diff --git a/skimage/segmentation/random_walker_segmentation.py b/skimage/segmentation/random_walker_segmentation.py index 207a052a..fb26f2bf 100644 --- a/skimage/segmentation/random_walker_segmentation.py +++ b/skimage/segmentation/random_walker_segmentation.py @@ -46,8 +46,10 @@ def _make_graph_edges_3d(n_x, n_y, n_z): Returns ------- - edges : ndarray of shape (2, n_x * n_y * (nz - 1) + - n_x * (n_y - 1) * nz + (n_x - 1) * n_y * nz) + edges : (2, N) ndarray + with the total number of edges N = n_x * n_y * (nz - 1) + + n_x * (n_y - 1) * nz + + (n_x - 1) * n_y * nz Graph edges with each column describing a node-id pair. """ vertices = np.arange(n_x * n_y * n_z).reshape((n_x, n_y, n_z)) @@ -102,8 +104,8 @@ def _clean_labels_ar(X, labels): def _buildAB(lap_sparse, labels): """ - Build the matrix A and rhs B of the linear system to solve. - A and B are two block of the laplacian of the image graph. + Build the matrix A and rhs B of the linear system to solve. + A and B are two block of the laplacian of the image graph. """ labels = labels[labels >= 0] indices = np.arange(labels.size)