pub(crate) fn sphere_kernel_sparse(
grid: &Grid,
radius: f64,
) -> Vec<(usize, f64)>Expand description
sphere_kernel.m’s sphere in image space: a sphere of radius mm with partial-volume edge
voxels (each split into 20³ sub-voxels), on MATLAB’s -N/2:N/2-1 grid, fftshifted
(circshift by floor(N/2)) and normalised to sum 1. Returned sparsely as (flat index, value) for the nonzero voxels, in column-major order. Only voxels within one voxel of the
sphere are visited, so small radii (mSMV’s kernel_lim.m and its minimum-radius kernel) are
cheap; the values are those of the full-grid loop.