navis.despike_skeleton¶
- navis.despike_skeleton(x, sigma=5, max_spike_length=1, inplace=False, reverse=False)[source]¶
Remove spikes in skeleton (e.g. from jumps in image data).
For each node A, the euclidean distance to its next successor (parent) B and that node’s successor C (i.e A->B->C) is computed. If , node B is considered a spike and realigned between A and C.
- Parameters:
x (TreeNeuron | NeuronList) – Neuron(s) to be processed.
sigma (float | int, optional) – Threshold for spike detection. Smaller sigma = more aggressive spike detection.
max_spike_length (int, optional) – Determines how long (# of nodes) a spike can be.
inplace (bool, optional) – If False, a copy of the neuron is returned.
reverse (bool, optional) – If True, will also walk the segments from proximal to distal. Use this to catch spikes on e.g. terminal nodes.
parallel (bool) – If True and input is NeuronList, use parallel processing. Requires pathos.
n_cores (int, optional) – Numbers of cores to use if
parallel=True
. Defaults to half the available cores.progress (bool) – Whether to show a progress bar. Overruled by
navis.set_pbars
.omit_failures (bool) – If True will omit failures instead of raising an exception. Ignored if input is single neuron.
- Returns:
Despiked neuron(s). Only if
inplace=False
.- Return type:
TreeNeuron/List
Examples
>>> import navis >>> n = navis.example_neurons(1) >>> despiked = navis.despike_skeleton(n)