squidpy.im.ImageContainer.concat

classmethod ImageContainer.concat(imgs, library_ids=None, combine_attrs='identical', **kwargs)[source]

Concatenate imgs in Z-dimension.

All imgs need to have the same shape and the same name to be concatenated.

Parameters:
  • imgs (Iterable[ImageContainer]) – Images that should be concatenated in Z-dimension.

  • library_ids (Optional[Sequence[str | None]]) – Name for each image that will be associated to each Z-dimension. This should match the library_id in the corresponding anndata.AnnData object. If None, the existing name of the Z-dimension is used for each image.

  • combine_attrs (str) – How to combine attributes of imgs. By default, all imgs need to have the same scale and crop attributes. Use combine_attrs = 'override' to relax this requirement. This might lead to a mismatch between ImageContainer and anndata.AnnData coordinates.

  • kwargs (Any) – Keyword arguments for xarray.concat().

Return type:

ImageContainer

Returns:

: Concatenated squidpy.img.ImageContainer with imgs stacks in Z-dimension.

Raises:

ValueError – If any of the imgs have more than 1 Z-dimension or if library_ids are not unique.