// Filter out points too far from volume region voxels
dists = _compute_nearest(rr_voi, rr, return_dists=True)[1]
// Maximum distance from center of mass of a voxel to any of its corners
maxdist = linalg.norm(vox_mri_t["trans"][:3, :3].sum(0) / 2.)
return dists <= maxdist
def _make_volume_source_space(surf, grid, exclude, mindist, mri=None,
After Change
idx = np.empty(rr.shape[::-1], np.int64)
for ii in range(3):
good &= rr_vox[:, ii] < mgz_data.shape[ii] - 0.5
idx[ii] = np.clip(np.round(rr_vox[:, ii]).astype(np.int64),
0, mgz_data.shape[ii] - 1)
good &= mgz_data[tuple(idx)] == vol_id
return good