Skip to content

Commit

Permalink
bug: filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-grim committed Nov 19, 2024
1 parent 8d161a7 commit b7ba0c4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/deep_neurographs/fragment_filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def remove_curvy(fragments_graph, max_length, ratio=0.5):
length = fragments_graph.edges[i, j]["length"]
endpoint_dist = fragments_graph.dist(i, j)
if endpoint_dist / length < ratio and length < max_length:
print(i, j)
deleted_ids.add(fragments_graph.edges[i, j]["swc_id"])
delete_fragment(fragments_graph, i, j)
return len(deleted_ids)
Expand Down Expand Up @@ -218,7 +219,10 @@ def remove_xyz_entries(fragments_graph, i, j):
"""
for xyz in fragments_graph.edges[i, j]["xyz"]:
del fragments_graph.xyz_to_edge[tuple(xyz)]
try:
del fragments_graph.xyz_to_edge[tuple(xyz)]
except KeyError:
pass
return fragments_graph


Expand Down

0 comments on commit b7ba0c4

Please sign in to comment.