mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-05 15:35:55 +08:00
rag copy in threshold cut
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user