harpy.im.get_dataarray#
- harpy.im.get_dataarray(sdata, element_name, scale=None)#
Retrieve the highest-resolution
xarray.DataArrayfrom an element insdata.imagesorsdata.labels.If
sdata.images[element_name]orsdata.labels[element_name]is axarray.DataTree, this function returns the requested pyramidxarray.DataArray. IfscaleisNone, the base scale ("scale0") is returned. If the element is already axarray.DataArray,scaleis ignored.- Parameters:
sdata (SpatialData) – The SpatialData object containing image and/or labels elements.
element_name (str) – The name of the element to retrieve.
scale (str | None) – Pyramid level to retrieve when the element is stored as a multiscale
xarray.DataTree. IfNone,"scale0"is used.
- Return type:
- Returns:
: The resolved
xarray.DataArraycorresponding to the requested element.- Raises:
KeyError – If the element does not exist in
sdata.imagesorsdata.labels.ValueError – If the element exists but is stored in an unsupported format.