scallops.visualize.registration.diagnose_registration

scallops.visualize.registration.diagnose_registration(imagestack, *sels, ax=None, title=None | str, **kwargs)

Overlays 2-d images extracted from a DataArray for visualizing alignment of images from different rounds or channels selected with the sel parameter. Up to six images can be selected and shown in different colors. The same Axes.X and Axes.Y indices should be used for every Selector.

Parameters:
  • imagestack (DataArray) – DataArray from which to extract 2-d images for plotting.

  • sels (None | Sequence[dict[str, Any]]) – Optional list, but only if imagestack is already of shape (1, 1, 1, y, x). Selectors to pass imagestack.sel, selects the (y, x) planes to be plotted.

  • ax (None | Axes) – Axes to plot on. If not passed, defaults to the current axes.

  • title (None | str) – Title to assign the Axes being plotted on.

  • kwargs – Additional keyword arguments to pass to imshow_plane.

Returns:

List of matplotlib Axes representing the overlayed images.

Example:
import numpy as np
import xarray as xr
from scallops.visualize.registration import diagnose_registration

# Create synthetic DataArray
image_shape = (3, 4, 1, 100, 100)  # (t, c, z, y, x)
imagestack = xr.DataArray(
    np.random.rand(*image_shape), dims=("t", "c", "z", "y", "x")
)

# Define selectors
selectors = [
    {"t": 0, "c": 0},
    {"t": 1, "c": 1},
    {"t": 2, "c": 2},
]

# Plot the registration diagnosis
axes = diagnose_registration(
    imagestack.squeeze(), *selectors, title="Registration Diagnosis"
)
plt.show()
Return type:

Sequence[Axes]