scallops.io.read_image
- scallops.io.read_image(path, dask=False, scene_id=None, tmp_dir=None, **kwargs)
Read a single image from various supported formats. This function reads image data from a single file or zarr group. It supports various file formats including tiff, nd2, and other Bio- Formats supported formats. The returned data is represented as a xarray DataArray with dimensions (t, c, z, y, x).
To read a directory of images, see:
read_experiment().- Parameters:
path (str | Path | Group) – Path to the image file or zarr group.
dask (bool) – Whether the returned DataArray should be a dask or numpy array.
scene_id (None | str | int) – A valid scene id or index to read a specific scene from the image.
tmp_dir (str | None) – Temporary directory to save non-local nd2 files (default is None).
kwargs – Additional arguments to pass to the bioio.BioImage constructor.
- Returns:
DataArray with the dimensions (t, c, z, y, x).
- Example:
- Return type:
DataArray
import scallops.io # Read an image image_path = "path/to/your/image.tiff" image = scallops.io.read_image(image_path) # Optionally, specify a scene id scene_id = 0 image_with_scene = scallops.io.read_image(image_path, scene_id=scene_id)