navis.strahler_index¶
- navis.strahler_index(x, method='standard', to_ignore=[], min_twig_size=None)[source]¶
Calculate Strahler Index (SI).
Starts with SI of 1 at each leaf and walks to root. At forks with different incoming SIs, the highest index is continued. At forks with the same incoming SI, highest index + 1 is continued.
- Parameters:
x (TreeNeuron | MeshNeuron | NeuronList) –
method ('standard' | 'greedy', optional) – Method used to calculate Strahler indices: ‘standard’ will use the method described above; ‘greedy’ will always increase the index at converging branches whether these branches have the same index or not.
to_ignore (iterable, optional) – List of node IDs to ignore. Must be the FIRST node of the branch. Excluded branches will not contribute to Strahler index calculations and instead be assigned the SI of their parent branch.
min_twig_size (int, optional) – If provided, will ignore twigs with fewer nodes than this. Instead, they will be assigned the SI of their parent branch.
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:
Adds “strahler_index” as column in the node table (for TreeNeurons) or as .”strahler_index property (for MeshNeurons).
- Return type:
neuron
See also
navis.segment_analysis()
This function provides by-segment morphometrics, including Strahler indices.
Examples
>>> import navis >>> n = navis.example_neurons(2, kind='skeleton') >>> n.reroot(n.soma, inplace=True) >>> _ = navis.strahler_index(n) >>> n[0].nodes.strahler_index.max() 6 >>> m = navis.example_neurons(1, kind='mesh') >>> _ = navis.strahler_index(m) >>> m.strahler_index.max() 5