twocan.prep_zarr

twocan.prep_zarr(IF_arr: ndarray, IMC_arr: ndarray, IF_panel: List[str], IMC_panel: List[str]) SpatialData[source]

Create a SpatialData object from IF and IMC arrays with their channel panels.

This function takes raw image arrays and their corresponding channel names to create a properly formatted SpatialData object containing both modalities. The function handles both 2D and 3D input arrays, automatically adding a channel dimension if needed.

Parameters:
  • IF_arr (np.ndarray) – Immunofluorescence array of shape (H, W) or (C, H, W). If 2D, will be expanded to (1, H, W).

  • IMC_arr (np.ndarray) – Imaging mass cytometry array of shape (H, W) or (C, H, W). If 2D, will be expanded to (1, H, W).

  • IF_panel (List[str]) – List of channel names for IF data. Must match the number of channels in IF_arr.

  • IMC_panel (List[str]) – List of channel names for IMC data. Must match the number of channels in IMC_arr.

Returns:

SpatialData object containing both modalities with proper channel information and coordinate systems.

Return type:

sd.SpatialData