def test_segment_intersection(): xyz=np.array([[1,1,1],[2,2,2],[2,2,2]]) center=[10,4,10] radius=1 assert_equal(tm.intersect_sphere(xyz,center,radius), False) xyz=np.array([[1,1,1],[2,2,2],[3,3,3],[4,4,4]]) center=[10,10,10] radius=2 assert_equal( tm.intersect_sphere(xyz,center,radius), False) xyz=np.array([[1,1,1],[2,2,2],[3,3,3],[4,4,4]]) center=[2.1,2,2.2] radius=2 assert_equal( tm.intersect_sphere(xyz,center,radius), True)
def test_segment_intersection(): xyz = np.array([[1, 1, 1], [2, 2, 2], [2, 2, 2]]) center = [10, 4, 10] radius = 1 assert_equal(tm.intersect_sphere(xyz, center, radius), False) xyz = np.array([[1, 1, 1], [2, 2, 2], [3, 3, 3], [4, 4, 4]]) center = [10, 10, 10] radius = 2 assert_equal(tm.intersect_sphere(xyz, center, radius), False) xyz = np.array([[1, 1, 1], [2, 2, 2], [3, 3, 3], [4, 4, 4]]) center = [2.1, 2, 2.2] radius = 2 assert_equal(tm.intersect_sphere(xyz, center, radius), True)
def compute_intersecting_dpy(tracks, voxel, R): from dipy.tracking.metrics import intersect_sphere s_idx = [] for idx in np.arange(len(tracks)): if intersect_sphere(tracks[idx],voxel,R)==True: s_idx.append(idx) return np.array(s_idx,dtype=int)