Skip to content

WIP: Introduce plate class#570

Draft
jo-mueller wants to merge 132 commits into
ome:masterfrom
jo-mueller:introduce-plate-class
Draft

WIP: Introduce plate class#570
jo-mueller wants to merge 132 commits into
ome:masterfrom
jo-mueller:introduce-plate-class

Conversation

@jo-mueller

Copy link
Copy Markdown
Collaborator

This is a first draft of an implementation of how writing plates could look like in a class-based API world, built around the NgffMultiscales class proposed in #515

jo-mueller and others added 30 commits January 21, 2026 11:26
jo-mueller and others added 22 commits April 8, 2026 09:19
enh: add correct translation transforms for legacy reader

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

docs: Update docstrings

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

fix: fix docstring

chore: Catch more specific errors

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

fix: safer type casting

fix: fix type-declarations

enh: support image-label metadata
refactor: fix import

refactor: Move image classes into submodule
[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

chore: remove unnnecessary __main__ in test

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

chore: pre-commit fixes

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

tests: fix import

tests: add reader tests for new classes

tests: fix typo
[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
chore: typo

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

chore: fix header levels

chore: fix mutable default values in writers

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
tests: fix passed and tested scales

enh: type cast

chore: remove unused variable

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

chore: remove unused variable

chore: remove redundant error flag

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

fix: fix docstring

chore: Catch more specific errors

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

fix: safer type casting

fix: fix type-declarations

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

chore: remove unnnecessary __main__ in test

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

chore: pre-commit fixes

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

tests: fix import

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
@jo-mueller jo-mueller added the enhancement New feature or request label Apr 9, 2026
@jo-mueller

jo-mueller commented Apr 10, 2026

Copy link
Copy Markdown
Collaborator Author

@will-moore if you're interested, this would be roughly my idea on how a class-based API could look like for writing HCS data (see classes/hcs.py)

In essence, one would have to create a dictionary of NgffMultiscales objects from #515 like this beforehand:

plate_dict = {
  ("A", 1): [ngff_rowA_col1_fov1, ngff_rowA_col1_fov2, ...], 
  ("A", 2): [ngff_rowA_col2_fov1, ngff_rowA_col2_fov2, ...],
  ("B", 1): [ngff_rowB_col1_fov1, ngff_rowB_col1_fov2, ...]
}

ngff_plate = NgffHCSPlate(plate_dict)
ngff_plate.to_ome_zarr(...)

this would then internally populate the omzp metadata, and dump everything to disk.

@will-moore

Copy link
Copy Markdown
Member

So, you have to have the whole plate in memory / dask-arrays before you write?
That makes sense from an API point of view, but I'm not sure how practicable that is if you're writing a lot of data.

When we export Plates with omero-cli-zarr, we write each Image to disk at a time. https://github.com/ome/omero-cli-zarr/blob/9f844b877d8e19e42a69d7ba43f7dc086680fbec/src/omero_zarr/raw_pixels.py#L290
so it would be nice if that was an option.

In your plate_dict both row and column names should be strings. It might be nicer to simply use a key like "A/1" ?

@jo-mueller

Copy link
Copy Markdown
Collaborator Author

So, you have to have the whole plate in memory / dask-arrays before you write?
That makes sense from an API point of view, but I'm not sure how practicable that is if you're writing a lot of data.

Kind of. Under the hood, everything is coerced to a dask array, so the memory footprint should be low. Or at least not larger than whatever a user has in memory in the first place.

When we export Plates with omero-cli-zarr, we write each Image to disk at a time.

The to_ome_zarr function does effectively that. It iterates over all NgffMultiscales instances and if compute is True (which it defaults to) then every image is written at a time. You could set it to False and then write everything concurrently, but I'm not sure what one would gain from it 🤔

@imagesc-bot

Copy link
Copy Markdown

This pull request has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/how-to-convert-czi-zeiss-to-ome-zarr-in-the-context-of-high-content-screening/120809/6

@jo-mueller jo-mueller mentioned this pull request May 6, 2026
6 tasks
@jo-mueller jo-mueller mentioned this pull request May 18, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants