Function of sliding average through image stack

Function to calculate a sliding-window average through a stack of
images.  Intended for denoising aligned HRSTEM image series.