Skip to content

Autocorrelation

Source

Autocorrelation function.

autocorrelation(image)

Compute the autocorrelation of an image.

This method is used to explore spatial correlations in images, in particular in the noise.

The autocorrelation is normalized to the zero-shift value, which is centered in the resulting images.

Parameters:

  • image (NDArray) –

    2D input image.

Returns:

  • ndarray –

    Autocorrelation of the input image.

autocorrelation_stack(image, axes, average_z=True)

Compute the autocorrelation of an image stack, averaged over samples.

The input is normalized to SC(Z)YX using axes, autocorrelation is computed per image, and the results are averaged over the sample dimension. Channels are kept separate.

Parameters:

  • image (NDArray) –

    Input image stack.

  • axes (str) –

    Axes of the input stack, a subset of STCZYX containing Y and X.

  • average_z (bool, default: True ) –

    If True, compute a 2D (YX) autocorrelation averaged over the sample and Z dimensions. If False, compute a 3D (ZYX) autocorrelation averaged over the sample dimension only. Ignored when the data has no Z axis.

Returns:

  • ndarray –

    Averaged autocorrelation, C(Z)YX with the channel dimension dropped when there is a single channel.