Segments
These functions
Generate Segments
navis_fastcore.generate_segments(node_ids, parent_ids, weights=None)
Generate linear segments maximizing segment lengths.
PARAMETER | DESCRIPTION |
---|---|
node_ids |
TYPE: |
parent_ids |
TYPE: |
weights |
TYPE: |
RETURNS | DESCRIPTION |
---|---|
segments | Segments as list of arrays, sorted from longest to shortest. Each segment starts with a leaf and stops with a branch point or root node. TYPE: |
Examples:
Segment Coordinates
navis_fastcore.segment_coords(node_ids, parent_ids, coords, weights=None, node_colors=None)
Generate coordinates for linear segments.
This is useful for plotting the skeleton of a neuron.
PARAMETER | DESCRIPTION |
---|---|
node_ids |
TYPE: |
parent_ids |
TYPE: |
coords |
TYPE: |
node_colors |
TYPE: |
RETURNS | DESCRIPTION |
---|---|
seg_coords | TYPE: |
colors | If 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])
>>> coords = np.random.rand(7, 3)
>>> fastcore.segment_coords(node_ids, parent_ids, coords)
[array([[5.30713899e-01, 8.26450947e-01, 2.46805326e-01],
[1.54144332e-04, 9.07823578e-01, 3.20199043e-01],
[6.64580597e-01, 3.23724555e-01, 3.18361918e-01],
[7.16579499e-01, 8.65568868e-02, 7.15686948e-01],
[5.94874740e-01, 5.95528161e-01, 8.14234930e-01]]),
array([[0.47814894, 0.84468164, 0.2765942 ],
[0.21748528, 0.36673489, 0.81449368],
[0.7165795 , 0.08655689, 0.71568695]])]