Skip to content

Preserve zarr version in register command#198

Open
mattersoflight wants to merge 3 commits intomainfrom
preserve-zarr-version-register
Open

Preserve zarr version in register command#198
mattersoflight wants to merge 3 commits intomainfrom
preserve-zarr-version-register

Conversation

@mattersoflight
Copy link
Collaborator

Add version parameter to create_empty_hcs_zarr() and detect input zarr version in register_cli() to ensure output version matches input (v2→v2, v3→v3). This maintains compatibility with both OME-NGFF v0.4 (zarr v2) and v0.5 (zarr v3) datasets.

Changes follow the pattern from waveOrder PR#519:

  • Add optional version parameter to create_empty_hcs_zarr (default "0.4")
  • Pass version to open_ome_zarr when creating output plate
  • Detect input version from source plate in register_cli
  • Backward compatible: existing calls use default "0.4"

Pair-coded-with: Soorya Pradeep <@Soorya19Pradeep>

Add version parameter to create_empty_hcs_zarr() and detect input
zarr version in register_cli() to ensure output version matches input
(v2→v2, v3→v3). This maintains compatibility with both OME-NGFF v0.4
(zarr v2) and v0.5 (zarr v3) datasets.

Changes follow the pattern from waveOrder PR#519:
- Add optional version parameter to create_empty_hcs_zarr (default "0.4")
- Pass version to open_ome_zarr when creating output plate
- Detect input version from source plate in register_cli
- Backward compatible: existing calls use default "0.4"

Pair-coded-with: Soorya Pradeep <@Soorya19Pradeep>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Convert shape, scale, and chunks to native Python types for zarr v3
  compatibility (zarr v3 requires native Python ints/floats, not numpy types)
- Fix position existence checking by using try/except instead of unreliable
  zgroup membership check
- Fix channel appending to apply to all positions, not just the last one

Fixes KeyError when accessing positions and TypeError when creating arrays
with numpy int64 values in zarr v3 format.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@Soorya19Pradeep
Copy link
Contributor

I have tested the PR on a Hummingbird dataset with the following conditions:
(1) zarr v2 input to zarr v2 output
(2) zarr v3 input to zarr v3 output
(3) multiple positions submitting multiple slurm jobs
(4) single position registration
(5) multiple source channels transfer
to verify that the PR works as expected.

@Soorya19Pradeep Soorya19Pradeep force-pushed the preserve-zarr-version-register branch from 16b5a89 to bea47c9 Compare February 27, 2026 17:28
@Soorya19Pradeep
Copy link
Contributor

I have added the changes to concatenate to the same PR, as this is a very small number of lines of code as well. It was tested on zarr version 3 dataset with multiple positions.

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.

2 participants