_fixes.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:pyAFQ 作者: yeatmanlab 项目源码 文件源码
def _orient_generator(out, roi1, roi2):
    """
    Helper function to `orient_by_rois`

    Performs the inner loop separately. This is needed, because functions with
    `yield` always return a generator
    """
    for idx, sl in enumerate(out):
        dist1 = cdist(sl, roi1, 'euclidean')
        dist2 = cdist(sl, roi2, 'euclidean')
        min1 = np.argmin(dist1, 0)
        min2 = np.argmin(dist2, 0)
        if min1[0] > min2[0]:
            yield sl[::-1]
        else:
            yield sl
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号