Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,10 @@ src/morphobricks_preprocessing/
WindowLayoutError (shared by both);
window_reader.py WindowReader (#304): many windows of one image through a
bounded, thread-safe block_cache.BlockCache of decoded pieces (opt-in),
RunInputs.window_reader -> RunWindowReader by channel IDs;
RunInputs.window_reader -> RunWindowReader by channel IDs; it refuses at
open an OME-Zarr whose chunks leave no window within the limit (v0.10.1);
window_chunks.py check_window_chunks: check/run warn about such stores
(chunks_too_large_for_windows, e.g. one chunk per plane);
window_map.py map_plan / map_windows / iter_windows: a function over
windows in a bounded thread pool, results in window order, memory
planned and checked against a budget before any read (lazy-windows §5);
Expand Down Expand Up @@ -599,7 +602,8 @@ src/morphobricks_preprocessing/
changed right there, the proposal the Axes step starts from
notebook_zarr_copy.py the first screen's "Also save a copy as OME-Zarr" and the Axes step's
card that writes it once the roles are confirmed; ome_zarr_copy.py
the writers (OME-NGFF 0.4, written directly) and the copy's name
the writers (OME-NGFF 0.4, written directly, chunks of at most
1 x 1024 x 1024 since v0.10.1) and the copy's name
notebook_projection.py the Axes step's card for Z-stacks: choose the projection, write the
projected copies into the output folder (convert_experiment), open
them as the experiment; the greyed 3-D option
Expand Down
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,35 @@ refuses the skipped label images as unrecorded: refused, never silently wrong.

### Fixed

- **OME-Zarr copies are written in spatial chunks, so a later brick can read them in windows.**
`convert --store ome-zarr`, the notebook's OME-Zarr copy and `convert_experiment(...,
store="ome-zarr")` wrote each plane as one chunk (the whole Y and X). A windowed route
(fiberfeatures' `run.execution_route = "patch_window"`, through `RunInputs.window_reader`)
decodes a chunk whole for any window, so it refused the first patch of a large converted slide
(`WindowMemoryError`) after `check` had passed. Copies are now written in chunks of one plane by
at most 1024 x 1024 pixels (`1 x ... x min(Y, 1024) x min(X, 1024)`, bioformats2raw's default;
`ome_zarr_copy.CHUNK_SIDE`, `chunk_shape`), still uncompressed Zarr version 2 (OME-NGFF 0.4),
one level (no pyramid: the bricks read level 0 only). Each plane is written as it is read,
block by block within the memory limit, each block's part of each chunk written in place
(edge chunks at full size, zeros outside the image, as Zarr 2 stores them); a plane read in
blocks is never held whole. **Byte identity:** the pixels, the `.zattrs` and the conversion
record's other fields are unchanged, but a copy of an image larger than 1024 pixels along Y
or X is new bytes: its `0/.zarray` `chunks` and its chunk files (`0/<plane indices>/<row>/<col>`,
instead of one `0/<plane indices>/0/0` per plane), so its `copy_sha256` differs. Copies of planes of at
most 1024 x 1024 pixels are byte for byte as before. A conversion into a folder that already
holds a copy written before keeps that copy (its plan and content are unchanged): convert
into a new folder to get the chunked copies.
- **`check` and `run` warn about an OME-Zarr image no window reader can serve**
(`chunks_too_large_for_windows`, new module `window_chunks`): from the header, the least a
window reader needs for a window of one pixel, through a cache of one chunk
(`window_chunks.window_chunk_need`, `windows.smallest_window_memory`), against the memory
limit; the warning names the images and says to convert the originals again into a new folder
(for a copy written before v0.10.1) or to save the image with chunks of at most 1024 x 1024
pixels. `check` uses the default limit (1 GiB); `run` its `--memory-limit`. The same store is
refused when `WindowReader` / `RunInputs.window_reader` is opened on it with a cache that
leaves no room for one window (`WindowMemoryError`, naming the chunks and the fix), instead of
on its first window; a window refused for its memory names the chunks too.
`tests/test_ome_zarr_chunks.py`.
- **An entry output is reusable in a conda environment** (Spec ADR 0007 RE10). Conda installs
`setuptools` as an `.egg-info` with no `RECORD`, and `brick_identity` followed every
requirement of the brick, every extra included, down to it: every record written there was
Expand Down
Loading
Loading