Skip to content

feat: one OME-ZARR with image + label pyramids by default (+ hatch-vcs) - #8

Merged
lguerard merged 4 commits into
mainfrom
feat/labels-in-zarr-pyramids
Jun 22, 2026
Merged

feat: one OME-ZARR with image + label pyramids by default (+ hatch-vcs)#8
lguerard merged 4 commits into
mainfrom
feat/labels-in-zarr-pyramids

Conversation

@lguerard

Copy link
Copy Markdown
Contributor

Builds on the OME-ZARR/napari plugins. Five commits:

  1. build: derive version from git tags via hatch-vcs — the tag is now the single source of truth, no manual version bumps. __version__ reads it via importlib.metadata.
  2. feat: add_pyramid (add levels to an existing store) and write_labels (store a label image inside an OME-ZARR under NGFF labels/).
  3. feat: tile_process default — when input is a .zarr and no write_to, labels are written back into the input store under labels/<name>/ as a pyramid, so image + segmentation live in one OME-ZARR. Lazy/streamed (OOM-safe). overlap now defaults to 16. Pyramids downsample X/Y only — Z kept full-res.
  4. docs: document the new methods + workflow (mkdocs + pdoc auto).

Notes

  • write_to= still overrides to a separate single-resolution store; array inputs use an auto-temp.
  • Plugging a different segmentation method = swapping fn.
  • Tests: full suite green (23 passed), ruff clean, mkdocs build --strict clean. Also fixed two pre-existing zarr-v3 test-API calls (Group.zeros).

After merge, tagging v0.3.0 publishes automatically (hatch-vcs → 0.3.0).

🤖 Generated with Claude Code

lguerard and others added 4 commits June 22, 2026 15:27
Stop hand-maintaining the version. hatch-vcs reads it from the latest
git tag at build time (v0.3.0 -> 0.3.0) and __version__ reads it back
through importlib.metadata, so the tag is the single source of truth
and releases need no manual version bump.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Refactor the pyramid-writing into shared helpers and expose two new
functions:

- add_pyramid(group): add downsampled resolution levels to an existing
  single-resolution zarr in place, lazily (reuses existing multiscales
  metadata/axes when present)
- write_labels(image_store, labels): store a label image inside an
  OME-ZARR under the NGFF labels/<name>/ group as its own multi-scale
  pyramid, with image-label metadata and registration in labels/.zattrs
  so image + segmentation live in one store

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
tile_process now, by default, writes its labels back into the input
.zarr store under the NGFF labels/<name>/ group as a multi-scale
pyramid (image + segmentation in one file). write_to still overrides
to a separate single-resolution store; array inputs use an auto-temp.

- labels stream into the store via write_labels/da.to_zarr (OOM-safe)
- pyramids downsample X/Y only; Z (and C/T) stay full-resolution, as
  microscopy stacks are anisotropic
- add register_labels helper (pyramid + image-label meta + register)
- overlap now defaults to 16 for out-of-the-box boundary context
- fix tests for Z-preserving pyramids, overlap default, zarr-v3 API

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Document add_pyramid, write_labels and register_labels on the plugin
API page, and rewrite the guide around the new default (tile_process
stores image + label pyramids in one OME-ZARR), XY-only downsampling,
and plugging in any segmentation function. pdoc picks the functions up
automatically.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lguerard
lguerard merged commit 1e6fe66 into main Jun 22, 2026
1 check passed
@lguerard
lguerard deleted the feat/labels-in-zarr-pyramids branch June 22, 2026 13:56
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.

1 participant