harpy.im.add_image#
- harpy.im.add_image(sdata, arr, output_image_name, dims=None, chunks=None, transformations=None, scale_factors=None, c_coords=None, overwrite=False)#
Add an image element to a SpatialData object.
This function allows you to add an image element to
sdata. Ifsdatais backed by a zarr store, the resulting image element will be backed to the zarr store, otherwisearrwill be persisted in memory. All layers of the Dask graph associated witharrwill therefore be materialized upon callingadd_image.- Parameters:
sdata (
SpatialData) – The SpatialData object to which the new image element will be added.arr (
Array) – The array containing the image data to be added.output_image_name (
str) – The name of the output image element where the image data will be stored.dims (
tuple[str,...] |None(default:None)) – A tuple specifying the dimensions of the image data (e.g., (“c”, “z”, “y”, “x”)). If None, defaults will be inferred.chunks (
str|tuple[int,...] |int|None(default:None)) – Specification for chunking the data.transformations (
dict[str,BaseTransformation] |None(default:None)) – Transformations that will be added to resultingoutput_image_name.scale_factors (
Sequence[dict[str,int] |int] |None(default:None)) – Scale factors to apply for multiscale data. If specifiedoutput_image_namewill be multiscale.c_coords (
list[str] |None(default:None)) – Names of the channels. If None, channel names will be named sequentially as 0,1,…overwrite (
bool(default:False)) – If True, overwritesoutput_image_nameif it already exists insdata.
- Return type:
- Returns:
: The
sdataobject with the image element added.