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