mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-29 11:26:57 +08:00
Hold pixel count in mean boundary RAG edges
This value is needed to combine edges when merging nodes.
This commit is contained in:
@@ -406,6 +406,8 @@ def rag_boundary(labels, edge_map, connectivity=2):
|
||||
rag = RAG()
|
||||
rag.add_weighted_edges_from(_edge_generator_from_csr(graph_matrix),
|
||||
weight='weight')
|
||||
rag.add_weighted_edges_from(_edge_generator_from_csr(count_matrix),
|
||||
weight='count')
|
||||
|
||||
for n in rag.nodes():
|
||||
rag.node[n].update({'labels': [n]})
|
||||
|
||||
@@ -215,3 +215,4 @@ def test_rag_boundary():
|
||||
assert set(g.edges()) == set([(1, 2), (1, 3), (2, 4), (3, 4)])
|
||||
assert g[1][3]['weight'] == 0.25
|
||||
assert g[2][4]['weight'] == 0.34375
|
||||
assert g[1][3]['count'] == 16
|
||||
|
||||
Reference in New Issue
Block a user