# sigpy.gridding¶

sigpy.gridding(input, coord, shape, kernel='spline', width=2, param=1)[source]

Gridding of points specified by coordinates to array.

Let $$y$$ be the input, $$x$$ be the output, $$c$$ be the coordinates, $$W$$ be the kernel width, and $$K$$ be the interpolation kernel, then the function computes,

$x[i] = \sum_{j : \| i - c[j] \|_\infty \leq W / 2} K\left(\frac{i - c[j]}{W / 2}\right) y[j]$

There are two types of kernels: ‘spline’ and ‘kaiser_bessel’.

‘spline’ uses the cardinal B-spline functions as kernels. The order of the spline can be specified using param. For example, param=1 performs linear interpolation. Concretely, for param=0, $$K(x) = 1$$, for param=1, $$K(x) = 1 - |x|$$, and for param=2, $$K(x) = \frac{9}{8} (1 - |x|)^2$$ for $$|x| > \frac{1}{3}$$ and $$K(x) = \frac{3}{4} (1 - 3 x^2)$$ for $$|x| < \frac{1}{3}$$.

These function expressions are derived from the reference wikipedia page by shifting and scaling the range to -1 to 1. When the coordinates specifies a uniformly spaced grid, it is recommended to use the original scaling with width=param + 1 so that the interpolation weights add up to one.

‘kaiser_bessel’ uses the Kaiser-Bessel function as kernel. Concretely, $$K(x) = I_0(\beta \sqrt{1 - x^2})$$, where $$I_0$$ is the modified Bessel function of the first kind. The beta parameter can be specified with param. The modified Bessel function of the first kind is approximated using the power series, following the reference.

Parameters: input (array) – Input array. coord (array) – Coordinate array of shape […, ndim] width (float or tuple of floats) – Interpolation kernel full-width. kernel (str) – Interpolation kernel, {“spline”, “kaiser_bessel”}. param (float or tuple of floats) – Kernel parameter. Output array. output (array)

References