- class squidpy.im.ImageContainer(img=None, layer='image', lazy=True, scale=1.0, **kwargs)
Container for in memory arrays or on-disk images.
xarray.Datasetto store several image layers with the same x, y and z dimensions in one object. Dimensions of stored images are
(y, x, z, channels). The channel dimension may vary between image layers.
This class also allows for lazy loading and processing using
dask, and is given to all image processing functions, along with
anndata.AnnDatainstance, if necessary.
str) – Image layer in
imgthat should be processed. If None and only 1 layer is present, it will be selected.
Where to save channel dimension when reading from a file or loading an array. Valid options are:
’channels_last’ - load the last non-spatial dimension as channels.
’z_last’ - load the last non-spatial dimension as Z-dimension.
’default’ - same as ‘channels_last’, but for 4-dimensional arrays, tries to also load the first dimension as channels if the last non-spatial dimension is 1.
a sequence of dimension names matching the shape of
('y', 'x', 'z', 'channels'). ‘y’, ‘x’ and ‘z’ must always be present.
library_id – Name for each Z-dimension of the image. This should correspond to the
bool) – Whether to use
daskto lazily load image.
chunks – Chunk size for
dask. Only used when
lazy = True.
copy – Whether to copy the underlying data if
imgis an in-memory array.
add_img(img[, layer, dims, library_id, ...])
Add a new image to the container.
apply(func[, layer, new_layer, channel, ...])
Apply a function to a layer within this container.
Trigger lazy computation in-place.
concat(imgs[, library_ids, combine_attrs])
Return a copy of self.
crop_center(y, x, radius, **kwargs)
Extract a circular crop.
crop_corner(y, x[, size, library_id, scale, ...])
Extract a crop from the upper-left corner.
features_custom(func, layer[, channels, ...])
Calculate features using a custom function.
features_histogram(layer[, library_id, ...])
Compute histogram counts of color channel values.
Calculate segmentation features using
features_summary(layer[, library_id, ...])
Calculate summary statistics of image channels.
features_texture(layer[, library_id, ...])
Calculate texture features.
from_adata(adata[, img_key, library_id, ...])
Load an image from
generate_equal_crops([size, as_array, squeeze])
Decompose image into equally sized crops.
generate_spot_crops(adata[, spatial_key, ...])
anndata.AnnData.obs_namesand extract crops.
interactive(adata[, spatial_key, ...])
load(path[, lazy, chunks])
Load data from a Zarr store.
Rename a layer.
Save the container into a Zarr store.
show([layer, library_id, channel, ...])
Show an image within this container.
subset(adata[, spatial_key, copy])
anndata.AnnDatausing this container.
Re-assemble image from crops and their positions.