Skip to content

Commit

Permalink
fix skeleton node classification in subset_neuron:
Browse files Browse the repository at this point in the history
previously, we only fixed roots and leafs but had forgotten that branch
points could also become slabs if a twig was removed entirely
  • Loading branch information
schlegelp committed Oct 21, 2024
1 parent 2c4b7d8 commit be21cb6
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions navis/morpho/subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,8 @@ def _subset_treeneuron(x, subset, keep_disc_cn, prevent_fragments):
)

# Make sure any new roots or leafs are properly typed
# We won't produce new slabs but roots and leaves might change
x.nodes.loc[x.nodes.parent_id < 0, "type"] = "root"
x.nodes.loc[
(~x.nodes.node_id.isin(x.nodes.parent_id.values) & (x.nodes.parent_id >= 0)),
"type",
] = "end"
# We won't produce new slabs but roots, branches and leaves might change
graph.classify_nodes(x, inplace=True)

# Filter connectors
if not keep_disc_cn and x.has_connectors:
Expand Down

0 comments on commit be21cb6

Please sign in to comment.