Skip to content

Read stored arrays through worldarray - #48

Merged
davidackerman merged 1 commit into
mainfrom
feature/worldarray
Oct 21, 2026
Merged

davidackerman merged 1 commit into
mainfrom
feature/worldarray

Conversation

@davidackerman

Copy link
Copy Markdown
Member

Stored arrays are now opened and placed by worldarray (worldarray>=0.1,<1, on PyPI). It's the tensorstore reader chunkmirage shares with cellmap-flow, cellmap-analyze and mesh-n-bone. Its spec and its fixture of metadata layouts are the contract, and it was built from this repo's tensorstore_source.py.

The adapter:

  • TensorStoreSource.from_array turns worldarray's ArrayMeta into chunkmirage's ArrayInfo and adds what only chunkmirage needs:

    • xarray coordinate arrays, when nothing else placed the array (placed_by is None);
    • CF packing;
    • the spec's overrides and kind.

    Metadata conflicts are opened with metadata_conflicts="warn", so a stale attribute doesn't make an image unservable.

  • from_path is wa.open(path, units=None) on the shared context; groups go through wa.open_pyramid.

  • ngff.py reads nodes through wa.detect and Node.ome_attrs, and opens fields and coordinate arrays through wa.open_tensorstore.

  • tensorstore_source.py goes from 646 lines to 198. Store access, format detection, the zarr compressor cleaning and every placement parser now live in worldarray. The three access tests and the sequence half of one scene test are removed, since worldarray's own tests cover them.

What changes for users:

  • A precomputed scale opens by its key (vol/4_4_40) or as vol/s<N>.
  • A one-channel precomputed volume is served as z, y, x; its channel axis is dropped.
  • N5 newly read: a bare-list pixelResolution, units given as one string, and an axes attribute.
  • zarr v3 dimension_units and a scale attribute are read as the voxel size.
  • A dataset path with more than one part (seg/s0) is found in an ancestor group.
  • An OME scale that disagrees with the array's own voxel_size now warns, and OME wins. An OME scale of the wrong length is refused; main ignored it.
  • A bucket with listing off is read through its refusals, and AWS_ENDPOINT_URL is honoured.

worldarray already places an array with no placement metadata the way #47 does, so placements don't move with this switch.

Before this PR, worldarray's fixture cases were run against both readers. The browser reader (web/src/sources.ts) still differs on several N5 and OME cases. Those are its own bugs, for a separate PR that copies the fixture into web/test.

Docs: a "Why worldarray" note in docs/design.md, the opening of "Stored sources" in docs/concepts/formats.md, and the CHANGELOG's Sources section. uv.lock adds only worldarray; I left out the unrelated wheel-list churn from my older local uv.

…, on PyPI), the tensorstore reader chunkmirage shares with cellmap-flow, cellmap-analyze and mesh-n-bone, specified with a fixture of metadata layouts as the contract: TensorStoreSource.from_array maps its ArrayMeta to an ArrayInfo, adding what only chunkmirage needs (xarray coordinate arrays where nothing placed the array, placed_by None, CF packing, the spec's overrides and kind, metadata conflicts warned rather than raised), from_path is wa.open in the array's own units on the shared context, groups wa.open_pyramid; ngff.py reads nodes through wa.detect and Node.ome_attrs and opens fields and coordinate arrays through wa.open_tensorstore; tensorstore_source.py goes from 640 lines to 200 (access, detection, the zarr compressor cleaning and every placement parser are worldarray's now), and the three access tests and the sequence half of a scene test, which worldarray's own tests cover, are removed; what changes with it: a precomputed scale opened by its key or as s<N>, a one-channel precomputed volume served as z, y, x, N5 bare-list pixelResolution, units strings and axes attributes, zarr v3 dimension_units and a scale attribute, nested dataset paths, an OME scale disagreeing with voxel_size warned, one of the wrong length refused, buckets with listing off, AWS_ENDPOINT_URL; design.md says why, formats.md and the CHANGELOG say so
@davidackerman
davidackerman marked this pull request as ready for review October 21, 2026 23:58
@davidackerman
davidackerman merged commit 209f503 into main Oct 21, 2026
2 checks passed
@davidackerman
davidackerman deleted the feature/worldarray branch October 21, 2026 23:58
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