scverse / scverse/spatialdata

Align pyramid downscaling with `ome-zarr-py` (`nearest` for labels; tighten tests)

Open
#1,070 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
394
Forks
95
Avg merge
4d 3h
Merged PRs (30d)
7

Description

Summary

https://github.com/scverse/spatialdata/pull/1068 adds image-pyramid generation via ome-zarr-py internals as an alternative to multiscale-spatial-image. After https://github.com/ome/ome-zarr-py/pull/516 lands, we can further align and simplify our implementation.

Our pyramid tests currently permit sizable differences from label pyramids produced by multiscale-spatial-image due to mismatched downscaling:

  • multiscale-spatial-image: “nearest” (for labels)
  • spatialdata/ome-zarr-py: “resize” (order 0 to preserve label values)

Note: even after the ome-zarr-py PR merges, per-axis scale factors remain unsupported in ome-zarr-py. This should ideally be upstreamed. Until then, we will keep a custom downscaling function, leveraging the new ome-zarr-py APIs introduced by the PR.

Action items

  • After https://github.com/ome/ome-zarr-py/pull/516 is merged:
    • Use “nearest” for labels and align image defaults accordingly.
    • Tighten test tolerances (reduce or eliminate fraction_non_equal for i > 0).
    • Adopt ome-zarr-py’s 3D downscaling APIs to minimize custom logic.
  • Propose upstream support for per-axis scale factors in ome-zarr-py and simplify our code once available. Or choose to maintain this functionality in our code.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

First verify that ome-zarr-py PR 516 has landed, then inspect the image-pyramid implementation added in spatialdata PR 1068 and the existing pyramid tests. Align label downscaling and image defaults with ome-zarr-py, adopt its 3D APIs where applicable, and tighten the tests by reducing or removing fraction_non_equal for levels above zero. Per-axis scale-factor support remains a separate upstream concern.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.