feat: add multiscale OME-Zarr output#96
Open
LDeakin wants to merge 23 commits into
Open
Conversation
Based on division factors, aspect ratio.
LDeakin
force-pushed
the
ld/feat/multiscale_zarr
branch
from
June 23, 2026 04:34
6f7a653 to
30f80f5
Compare
There was a problem hiding this comment.
Pull request overview
Adds multiscale OME-Zarr pyramid writing to the Zarr writer (without rechunking), with new CLI control to disable pyramid output and an expanded test suite covering multiscale behavior, metadata, and updated layout selection expectations.
Changes:
- Implement multiscale OME-Zarr pyramid output (multiple levels + OME multiscales metadata) with selectable downsampling methods.
- Update chunk/subchunk auto-selection/scoring for input-aligned layouts and add additional coverage cases.
- Add
--no-multiscaleCLI option to disable pyramid generation for Zarr outputs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/anu_ctlab_io/zarr/_writer.py |
Implements multiscale pyramid creation/writing, downsampling utilities, and updated layout/encoding handling for OME-Zarr writes. |
tests/test_zarr_write.py |
Adds extensive multiscale tests (level stopping rules, metadata transforms, odd chunk behavior, downsample methods) and updates expectations for revised layout scoring. |
cli/src/anu_ctlab_io_cli/_cli.py |
Adds --no-multiscale to disable multiscale pyramid output when writing Zarr. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+901
to
+905
| counts = np.zeros_like(values, dtype=np.uint8) | ||
| for index in range(values.shape[0]): | ||
| counts[index] = np.sum((values == sorted_values[index]) & valid, axis=0) | ||
| counts = np.take_along_axis(counts, order, axis=0) | ||
| counts[~sorted_valid] = 0 |
- Uses block-local downsampling while all non-final chunks divide cleanly by 2. - Rechunks only when the current chunk grid would shift global downsample positions. - Level 0 storage layout is now independent of multiscale
- Direct task -> zarr writing for /2 downsampling - Output chunk parallelism on subsequent scales, reading Zarr inputs directly (no dask, direct unaligned zarr pythobn reads)
Since HDF5 reading is aligned on that path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is quick multiscale output, no rechunking. Each input chunk generates all downsampled chunks. Subchunks can be a bit suboptimal due to zarr-developers/zarr-specs#370
CLI