- pymaid.prune_by_length(x, min_length=0, max_length=inf, inplace=False)¶
Remove segments of given length.
pymaid.graph_utils._generate_segments()to generate segments that maximize segment lengths.
x (CatmaidNeuron/List) –
min_length (int | float) – Twigs shorter than this length [um] will be pruned.
max_length (int | float) – Segments longer than this length [um] will be pruned.
inplace (bool, optional) – If False, pruning is performed on copy of original neuron which is then returned.
- Return type
If you want to keep/remove just the N longest neurites instead of using a length cut-off.
Use if you are looking to remove only terminal branches of a given size.
>>> import pymaid >>> n = pymaid.get_neurons(16) >>> # Remove neurites longer than 100mirons >>> n_pr = pymaid._prune_by_length(n, ... min_length=0, ... max_length=100, ... inplace=False) >>> n.n_nodes > n_pr.n_nodes True