Skip to content

Conversation

@LucaMarconato
Copy link
Member

@LucaMarconato LucaMarconato commented Feb 10, 2026

Closes #1069

This PR (still work-in-progress) aims at implementing a function to generate a pyramidal image given a dask array, by relying on ome-zarr internal APIs and by extending functionalities currently not available via ome_zarr.scale.Scaler. Such a function is also provided by the multiscale-spatial-image package, but as explained in the linked issue we hit a performance roadblock.

ome-zarr-py does not support downscaling of the z dimension, nor downscaling via scale factors specified per dimension (both cases are supported by multiscale-spatial-image); these cases will be covered by this PR. The implementation could also live in ome-zarr-py (CC @will-moore @joshmoore @jo-mueller), I'd be happy if someone later can pick up the code so I can remove it from spatialdata and use it from upstream.

Side technical note:

  • the previous implementation in spatialdata uses xarray_coarsen (from multiscale-spatial-image) for images, (which is fully lazy), and itk_nearest (from multiscale-spatial-image) for labels (which is not lazy and therefore problematic). Since downscaling for images doesn't give problems, we could use the old implementation, but I'm reimplementing it with ome-zarr-py APIs anyway. So far it seems that both implementations lead to identical results.

@jo-mueller
Copy link

Hi @LucaMarconato ,

PR ome/ome-zarr-py#516 also addresses the issues with the downscaling in z (now built in for all methods) 👍

@LucaMarconato
Copy link
Member Author

That's perfect! Then I'll use that PR instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

to_multiscale() is not lazy for labels

2 participants