def segment_radial_distances(neurites, neurite_type=NeuriteType.all, origin=None):
def _seg_rd(sec, pos):<EOL><INDENT>'''<STR_LIT>'''<EOL>mid_pts = np.divide(np.add(sec.points[:-<NUM_LIT:1>], sec.points[<NUM_LIT:1>:])[:, :<NUM_LIT:3>], <NUM_LIT>)<EOL>return np.sqrt([morphmath.point_dist2(p, pos) for p in mid_pts])<EOL><DEDENT>dist = []<EOL>for n in iter_neurites(neurites, filt=is_type(neurite_type)):<EOL><INDENT>pos = n.root_node.points[<NUM_LIT:0>] if origin is None else origin<EOL>dist.extend([s for ss in n.iter_sections() for s in _seg_rd(ss, pos)])<EOL><DEDENT>return dist<EOL>
Lengths of the segments in a collection of neurites