linumpy.registration.phase_correlation#

Phase-correlation registration for tile pairs.

Functions#

pair_wise_phase_correlation(…)

Find the translation between image pairs using phase correlation and cross-correlation.

cross_correlation(vol1, vol2[, mask])

Compute the normalized cross-correlation between two ndarrays.

apply_hanning_window(im, padshape)

Apply an hanning window to image.

Module Contents#

linumpy.registration.phase_correlation.pair_wise_phase_correlation(vol1: numpy.ndarray, vol2: numpy.ndarray, n_peaks: int = ..., return_cc: Literal[False] = ...) list[int][source]#
linumpy.registration.phase_correlation.pair_wise_phase_correlation(vol1: numpy.ndarray, vol2: numpy.ndarray, n_peaks: int = ..., return_cc: Literal[True] = ...) tuple[list[int], float]

Find the translation between image pairs using phase correlation and cross-correlation.

Parameters:
  • vol1 (ndimage) – Fixed image / volume

  • vol2 (ndimage) – Moving image / volume

  • n_peaks (int) – Number of phase correlation peaks to sample

  • return_cc (bool) – Return cross-correlation score

Returns:

Translation of vol2 -/- vol1 in each direction

Return type:

list

Notes

  • Works in 2D for now. Needs to be tested in 3D.

References

Preibisch S. et al. (2008) Fast Stitching of Large 3D Biological Datasets (ImageJ Proceesings)

linumpy.registration.phase_correlation.cross_correlation(vol1, vol2, mask=None)[source]#

Compute the normalized cross-correlation between two ndarrays.

Parameters:
  • vol1 (ndarray) – Fixed volume

  • vol2 (ndarray) – Moving volume

  • mask (ndarray) – Mask where the cross-correlation is computed. Assumed to be everywhere.

Returns:

Cross correlation between the volumes

Return type:

float

Notes

  • If a mask is given, the weighted NCC is computed instead of the NCC.

  • vol1, vol2 and mask should have the same shape.

  • mask is normalized before using it in the NCC computation.

linumpy.registration.phase_correlation.apply_hanning_window(im, padshape)[source]#

Apply an hanning window to image.

Parameters:
  • im (ndarray) – ndarray to modify

  • padshape (ndarray or tuple of int) – Padding size for each dimension.

Returns:

Modified ndarray.

Return type:

ndarray