示例#1
0
文件: view.py 项目: jdcourcol/NeuroM
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)]
示例#2
0
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))