Hold pixel count in mean boundary RAG edges

This value is needed to combine edges when merging nodes.
This commit is contained in:
Juan Nunez-Iglesias
2016-01-08 22:11:31 +11:00
parent 30145ab7f4
commit 802214d5ac
2 changed files with 3 additions and 0 deletions
+2
View File
@@ -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]})
+1
View File
@@ -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