diff --git a/fsl/data/mesh.py b/fsl/data/mesh.py index 8fdab521ddabce40e98448ca1f6342ce546e49dc..a96864d9afe61a023aa6eac70da070dcfd7d3036 100644 --- a/fsl/data/mesh.py +++ b/fsl/data/mesh.py @@ -291,9 +291,12 @@ class TriangleMesh(object): return_locations=True, multiple_hits=False) + if tris.size == 0: + return np.zeros((0, 3)), np.zeros((0,)) + # sort by ray. I'm Not sure if this is # needed - does trimesh do it for us? - rayIdxs = np.argsort(rays) + rayIdxs = np.asarray(np.argsort(rays), np.int) locs = locs[rayIdxs] tris = tris[rayIdxs]