def map_segments(neurite, fun): '''map a function to the segments in a tree''' if isinstance(neurite, Section): neurite = Neurite(neurite) return [s for ss in neurite.iter_sections() for s in fst.sectionfunc.map_segments(fun, ss)]
def map_segments(neurite, fun): '''map a function to the segments in a tree''' if is_new_style(neurite): if isinstance(neurite, Section): neurite = Neurite(neurite) return [s for ss in neurite.iter_sections() for s in secfun.map_segments(fun, ss)] else: fun = seg.segment_function(as_tree=False)(fun) return list(iter_neurites(neurite, fun))