From be21cb6f19ee708d6b7db4ed96e264b550345262 Mon Sep 17 00:00:00 2001 From: Philipp Schlegel Date: Mon, 21 Oct 2024 16:46:58 +0100 Subject: [PATCH] fix skeleton node classification in subset_neuron: previously, we only fixed roots and leafs but had forgotten that branch points could also become slabs if a twig was removed entirely --- navis/morpho/subset.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/navis/morpho/subset.py b/navis/morpho/subset.py index 82c5b438..39ed58a5 100644 --- a/navis/morpho/subset.py +++ b/navis/morpho/subset.py @@ -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: