spectral_unmixing.register_stack

spectral_unmixing.register_stack(stack, *, registration_channel, method='phase_cross_correlation', zrange=None, pre_median_filter=False, post_median_filter=False, median_kernel_size=3, verbose=True)[source]

Register a TZCYX stack across time using shifts estimated from Z projections.

Parameters:
  • stack (array-like) – Input stack in canonical TZCYX order.

  • registration_channel (int) – Channel used to compute the time-wise registration shifts.

  • method ({“phase_cross_correlation”, “pystackreg”}, optional) – Backend used for shift estimation.

  • zrange (tuple[int, int] or None, optional) – Optional half-open Z range (start, stop) used for the registration projection.

  • pre_median_filter (bool, optional) – If True, apply a slice-wise median filter to the selected registration volume before max-Z projection. This affects only shift estimation, not the stack that is transformed.

  • post_median_filter (bool, optional) – If True, apply a 2D median filter to each projection after max-Z projection. This affects only shift estimation, not the stack that is transformed.

  • median_kernel_size (int, optional) – Median filter kernel size used by the optional pre/post filters.

  • verbose (bool, optional) – If True, print the estimated shifts line-wise for each time point.

Return type:

ndarray

Returns:

np.ndarray – Registered stack with the same TZCYX shape as the input.

Notes

Time-wise shifts are estimated from 2D max-Z projections of the selected registration channel. The resulting translations are then applied to the original unprojected TZCYX data.