def _orient_list(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.
Flips the streamlines in place (as needed) and returns a reference to the
updated list.
"""
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]:
out[idx] = sl[::-1]
return out
评论列表
文章目录