Morphology¶
Functions related to analysing or manipulating neuron morphology.
navis_fastcore.classify_nodes(node_ids, parent_ids)
¶
Classify nodes.
| PARAMETER | DESCRIPTION |
|---|---|
node_ids
|
TYPE:
|
parent_ids
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
node_type
|
Node types: - 0: root - 1: leaf - 2: branch point - 3: slab (intermediate node)
TYPE:
|
Examples:
navis_fastcore.synapse_flow_centrality(node_ids, parent_ids, presynapses, postsynapses, mode='sum')
¶
Calculate synapse flow centrality for this neuron.
Please note that this implementation currently produces slightly different results than the implementation in navis. I'm not sure why that is but the differences seem to be negligible.
| PARAMETER | DESCRIPTION |
|---|---|
node_ids
|
TYPE:
|
parent_ids
|
TYPE:
|
presynapses
|
TYPE:
|
postsynapses
|
TYPE:
|
mode
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
cc
|
Synapse flow centrality for each node.
TYPE:
|
navis_fastcore.strahler_index(node_ids, parent_ids, method='standard', to_ignore=None, min_twig_size=None)
¶
Calculcate Strahler Index.
| PARAMETER | DESCRIPTION |
|---|---|
node_ids
|
TYPE:
|
parent_ids
|
TYPE:
|
method
|
TYPE:
|
to_ignore
|
TYPE:
|
min_twig_size
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
strahler_index
|
Strahler Index for each node.
TYPE:
|
Examples:
navis_fastcore.subtree_height(node_ids, parent_ids, weights=None)
¶
Calculate the height of the subtree below each node.
A node's height is the geodesic distance from it down to the farthest leaf below it. Leafs therefore have a height of 0, and a root has the length of the longest root-to-leaf path in its component.
| PARAMETER | DESCRIPTION |
|---|---|
node_ids
|
TYPE:
|
parent_ids
|
TYPE:
|
weights
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
heights
|
Height of each node, in the same order as
TYPE:
|
Examples:
>>> import navis_fastcore as fastcore
>>> import numpy as np
>>> node_ids = np.arange(8)
>>> parent_ids = np.array([-1, 0, 1, 2, 1, 4, 5, 5])
>>> fastcore.subtree_height(node_ids, parent_ids)
array([4., 3., 1., 0., 2., 1., 0., 0.], dtype=float32)
See Also
:func:geodesic_farthest
Answers a different question: its directed mode looks towards
the root, and its undirected mode can leave the subtree entirely.
navis_fastcore.prune_twigs(node_ids, parent_ids, threshold, weights=None, mask=None)
¶
Prune twigs shorter than a given threshold.
| PARAMETER | DESCRIPTION |
|---|---|
node_ids
|
TYPE:
|
parent_ids
|
TYPE:
|
threshold
|
TYPE:
|
weights
|
TYPE:
|
mask
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
keep
|
Node IDs to keep.
TYPE:
|
Examples:
>>> import navis_fastcore as fastcore
>>> import numpy as np
>>> node_ids = np.arange(7)
>>> parent_ids = np.array([-1, 0, 1, 2, 1, 4, 5])
>>> fastcore.prune_twigs(node_ids, parent_ids, 2)
array([0, 1, 4, 5, 6])
>>> mask = np.array([True, True, True, False, True, True, True])
>>> fastcore.prune_twigs(node_ids, parent_ids, 2, mask=mask)
array([0, 1, 2, 3, 4, 5, 6])