Beispiel #1
0
def i_segment_meander_angle(tree):
    '''Return an iterator to a tree meander angle

    The meander angle is defined as the angle between to adjacent  segments.
    Applies neurom.morphmath.angle_3points to triplets of
    '''

    return tr.imap_val(lambda t: mm.angle_3points(t[1], t[0], t[2]), tr.itriplet(tree))
Beispiel #2
0
def i_segment_meander_angle(tree):
    '''Return an iterator to a tree meander angle

    The meander angle is defined as the angle between to adjacent  segments.
    Applies neurom.morphmath.angle_3points to triplets of
    '''

    return tr.imap_val(lambda t: mm.angle_3points(t[1], t[0], t[2]),
                       tr.itriplet(tree))
Beispiel #3
0
def trunk_section_length(tree):
    '''Length of the initial tree section

    Returns:
        Length of first section of tree or 0 if single point tree
    '''
    try:
        _it = tr.imap_val(mm.section_length, tr.isection(tree))
        return _it.next()
    except StopIteration:
        return 0.0
Beispiel #4
0
def i_segment_radial_dist(pos, tree):
    '''Return an iterator of radial distances of tree segments to a given point

    The radial distance is the euclidian distance between the mid-point of
    the segment and the point in question.

    Parameters:
        pos: origin to which disrances are measured. It must have at least 3
        components. The first 3 components are (x, y, z).

        tree: tree of raw data rows.

    '''
    return tr.imap_val(lambda s: mm.segment_radial_dist(s, pos), tr.isegment(tree))
Beispiel #5
0
def i_segment_radial_dist(pos, tree):
    '''Return an iterator of radial distances of tree segments to a given point

    The radial distance is the euclidian distance between the mid-point of
    the segment and the point in question.

    Parameters:
        pos: origin to which disrances are measured. It must have at least 3
        components. The first 3 components are (x, y, z).

        tree: tree of raw data rows.

    '''
    return tr.imap_val(lambda s: mm.segment_radial_dist(s, pos),
                       tr.isegment(tree))
Beispiel #6
0
def i_section_radial_dist(tree, pos=None, use_start_point=False):
    '''Return an iterator of radial distances of tree sections to a given point

    The radial distance is the euclidian distance between the either the
    end-point or rhe start point of the section and the point in question.

    Parameters:
        tree: tree object
        pos: origin to which distances are measured. It must have at least 3\
            components. The first 3 components are (x, y, z).\
            (default tree origin)

        use_start_point: If true, calculate distance from section start point,\
            else from end-point (default, False)

    '''
    pos = tree.value if pos is None else pos
    sec_idx = 0 if use_start_point else -1
    return tr.imap_val(lambda s: mm.point_dist(s[sec_idx], pos), tr.isection(tree))
Beispiel #7
0
def i_section_radial_dist(tree, pos=None, use_start_point=False):
    '''Return an iterator of radial distances of tree sections to a given point

    The radial distance is the euclidian distance between the either the
    end-point or rhe start point of the section and the point in question.

    Parameters:
        tree: tree object
        pos: origin to which distances are measured. It must have at least 3\
            components. The first 3 components are (x, y, z).\
            (default tree origin)

        use_start_point: If true, calculate distance from section start point,\
            else from end-point (default, False)

    '''
    pos = tree.value if pos is None else pos
    sec_idx = 0 if use_start_point else -1
    return tr.imap_val(lambda s: mm.point_dist(s[sec_idx], pos),
                       tr.isection(tree))
Beispiel #8
0
def i_segment_area(tree):
    ''' return an iterator of tree segment areas
    '''
    return tr.imap_val(mm.segment_area, tr.isegment(tree))
Beispiel #9
0
def i_segment_volume(tree):
    ''' return an iterator of tree segment volumes
    '''
    return tr.imap_val(mm.segment_volume, tr.isegment(tree))
Beispiel #10
0
def i_segment_radius(tree):
    ''' return an iterator of tree segment radii
    '''
    return tr.imap_val(mm.segment_radius, tr.isegment(tree))
Beispiel #11
0
def i_segment_length(tree):
    ''' return an iterator of tree segment lengths
    '''
    return tr.imap_val(mm.segment_length, tr.isegment(tree))
Beispiel #12
0
def path_length(tree):
    '''Get the path length from a sub-tree to the root node'''
    return np.sum(s for s in tr.imap_val(mm.segment_length,
                                         tr.isegment(tree, tr.iupstream)))
Beispiel #13
0
def i_segment_area(tree):
    ''' return an iterator of tree segment areas
    '''
    return tr.imap_val(mm.segment_area, tr.isegment(tree))
Beispiel #14
0
def i_segment_volume(tree):
    ''' return an iterator of tree segment volumes
    '''
    return tr.imap_val(mm.segment_volume, tr.isegment(tree))
Beispiel #15
0
def i_segment_radius(tree):
    ''' return an iterator of tree segment radii
    '''
    return tr.imap_val(mm.segment_radius, tr.isegment(tree))
Beispiel #16
0
def i_segment_length(tree):
    ''' return an iterator of tree segment lengths
    '''
    return tr.imap_val(mm.segment_length, tr.isegment(tree))
Beispiel #17
0
def path_length(tree):
    '''Get the path length from a sub-tree to the root node'''
    return np.sum(s for s in
                  tr.imap_val(mm.segment_length, tr.isegment(tree, tr.iupstream)))
Beispiel #18
0
def i_section_length(tree):
    """
    Return an iterator of tree section lengths
    """
    return tr.imap_val(mm.section_length, tr.isection(tree))
Beispiel #19
0
def i_section_length(tree):
    """
    Return an iterator of tree section lengths
    """
    return tr.imap_val(mm.section_length, tr.isection(tree))