def get_sphere(coords, r=<NUM_LIT:4>, vox_dims=(<NUM_LIT:2>, <NUM_LIT:2>, <NUM_LIT:2>), dims=(<NUM_LIT>, <NUM_LIT>, <NUM_LIT>)):
r = float(r)<EOL>xx, yy, zz = [slice(-r / vox_dims[i], r / vox_dims[<EOL>i] + <NUM_LIT>, <NUM_LIT:1>) for i in range(len(coords))]<EOL>cube = np.vstack([row.ravel() for row in np.mgrid[xx, yy, zz]])<EOL>sphere = cube[:, np.sum(np.dot(np.diag(<EOL>vox_dims), cube) ** <NUM_LIT:2>, <NUM_LIT:0>) ** <NUM_LIT> <= r]<EOL>sphere = np.round(sphere.T + coords)<EOL>return sphere[(np.min(sphere, <NUM_LIT:1>) >= <NUM_LIT:0>) &<EOL>(np.max(np.subtract(sphere, dims), <NUM_LIT:1>) <= -<NUM_LIT:1>), :].astype(int)<EOL>
Return all points within r mm of coordinates. Generates a cube
   and then discards all points outside sphere. Only returns values that
   fall within the dimensions of the image.