From 27831d8e2ffd683d802572b1b71340268002f430 Mon Sep 17 00:00:00 2001 From: Vighnesh Birodkar Date: Mon, 23 Jun 2014 22:26:53 +0530 Subject: [PATCH] Formatting and docstring changes --- skimage/graph/graph_cut.py | 4 ++-- skimage/graph/rag.py | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/skimage/graph/graph_cut.py b/skimage/graph/graph_cut.py index 1105d423..6cdd9f83 100644 --- a/skimage/graph/graph_cut.py +++ b/skimage/graph/graph_cut.py @@ -3,7 +3,7 @@ import numpy as np def threshold_cut(label_image, rag, thresh): - """Combines regions seperated by weight less than threshold. + """Combine regions seperated by weight less than threshold. Given an image's labels and its RAG, outputs new labels by combining regions whose nodes are seperated by a weight less @@ -46,7 +46,7 @@ def threshold_cut(label_image, rag, thresh): comps = nx.connected_components(rag) - map_array = np.arange(label_image.max()+1, dtype=np.int) + map_array = np.arange(label_image.max() + 1, dtype=np.int) for i, nodes in enumerate(comps): for node in nodes: for label in rag.node[node]['labels']: diff --git a/skimage/graph/rag.py b/skimage/graph/rag.py index 24c82a19..673e7ead 100644 --- a/skimage/graph/rag.py +++ b/skimage/graph/rag.py @@ -96,10 +96,11 @@ def rag_meancolor(image, label_image, connectivity=2): Parameters ---------- - image : (width, height, 3) or (width, height, depth, 3) ndarray + image : ndarray Input image. - label_image : (width, height) or (width, height, depth) ndarray - The array with labels. + label_image : ndarray + The array with labels. This should have one dimention lesser than + `image` connectivity : float, optional Pixels with a squared distance less than `connectivity`from each other are considered adjacent.