xnn.cnn.models.base.low_pass_filter#

xnn.cnn.models.base.low_pass_filter(x, scale, stride=1)[source]#

Gaussian blur of the spatial axes, optionally followed by a stride.

The anti-aliasing filter of Sec. 4.4.2: a downsampling by scale is preceded by a Gaussian of standard deviation 0.5 sqrt(scale^2 - 1) voxels (the width that turns the voxel-sized sampling kernel into one of scale voxels), truncated at 2.5 standard deviations and normalized to unit sum. Applied channel by channel, so it commutes with every fiber transformation and preserves equivariance. The Gaussian is separable, so the zero-padded, strided 3D convolution is applied as one banded matrix per axis.

Parameters:
  • x (Tensor) – Fields of shape (..., X, Y, Z).

  • scale (float) – Downsampling factor the blur prepares for; scale <= 1 returns x unchanged (then stride must be 1).

  • stride (int, optional) – Stride of the subsampling applied together with the blur, by default 1.

Returns:

The filtered fields, (..., X', Y', Z').

Return type:

Tensor