From 69fec94326e56ec009f62c7626422be71fbe3f08 Mon Sep 17 00:00:00 2001 From: Vighnesh Birodkar Date: Wed, 6 Aug 2014 02:46:29 +0530 Subject: [PATCH] rag copy in threshold cut --- skimage/graph/graph_cut.py | 1 + 1 file changed, 1 insertion(+) diff --git a/skimage/graph/graph_cut.py b/skimage/graph/graph_cut.py index 9c133bd3..bc694409 100644 --- a/skimage/graph/graph_cut.py +++ b/skimage/graph/graph_cut.py @@ -47,6 +47,7 @@ def cut_threshold(labels, rag, thresh): """ # Because deleting edges while iterating through them produces an error. + rag = rag.copy() to_remove = [(x, y) for x, y, d in rag.edges_iter(data=True) if d['weight'] >= thresh] rag.remove_edges_from(to_remove)