navis.cell_body_fiber¶
- navis.cell_body_fiber(x, method='betweenness', reroot_soma=True, heal=True, threshold=0.95, inverse=False, inplace=False)[source]¶
Prune neuron to its cell body fiber.
Here, “cell body fiber” (CBF) refers to the tract connecting the soma to the backbone in unipolar neuron (common in e.g. insects). This function works best for typical neurons with clean skeletons.
- Parameters:
x (TreeNeuron | MeshNeuron | NeuronList) –
method ("longest_neurite" | "betweenness") –
- The method to use:
”longest_neurite” assumes that the main branch point is where the two largest branches converge
”betweenness” uses centrality to determine the point which most shortest paths traverse
reroot_soma (bool) – If True (recommended) and neuron has a soma, it will be rerooted to its soma.
heal (bool) – If True (recommended), will heal fragmented neurons. Fragmented neurons are not guaranteed to have correct CBFs.
threshold (float [0-1]) – For method “betweenness” only: threshold at which to cut the cell body fiber. Lower thresholds produce longer CBFs.
inverse (bool) – If True, will instead remove the cell body fiber.
inplace (bool, optional) – If False, pruning is performed on copy of original neuron which is then returned.
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:
Pruned neuron(s). Neurons without branches (i.e. w/ a single long segment) will be returned unaltered.
- Return type:
TreeNeuron/List
Examples
>>> import navis >>> n = navis.example_neurons(1) >>> cbf = navis.cell_body_fiber(n, inplace=False) >>> # Neuron now has only a single segment from the soma to the main fork >>> len(cbf.segments) 1
See also
navis.find_main_branchpoint()
Find the main branch point.
navis.betweeness_centrality()
Calculate the per-node betweeness centrality. This is used under the hood for
method='betweeness'
.