A pixel image in spatstat is always stored on
a rectangular grid of pixels, but its value may be NA
on some pixels, indicating that the image is not defined at those
pixels.
This function assigns a value to every pixel in the rectangular grid.
For each pixel a in the grid, if the value of X is not
defined at a, the function finds the nearest other pixel b
at which the value of X is defined, and takes the pixel value at
b as the new pixel value at a.