Skip to content

Add streaming iter_image_summaries (contiguity required) - #81

Merged
guijacquemet merged 1 commit into
mainfrom
claude/streaming-image-summaries
Nov 7, 2026
Merged

guijacquemet merged 1 commit into
mainfrom
claude/streaming-image-summaries

Conversation

@guijacquemet

Copy link
Copy Markdown
Contributor

What and why

Implements the owner's decision on issue #58: a new streaming API, contiguity required (refused otherwise), eager API unchanged.

  • iter_image_summaries(records, percentile) is a generator. It holds one image's planes at a time, yields that image's ImageSummary when the next image starts, and drops the histograms. Each summary equals the eager one (same _summary).
  • Precondition: all Z/T rows of an image are contiguous. Rows are never sorted or staged. Refused with ValueError: an image whose rows are not together, a source file under two label sets, repeated plane_id, and different channel counts.
  • Summaries come in first-appearance order, which equals the eager order for rows sorted by condition, repeat and path.
  • Error contract (documented in the docstring, contract §7.1 and CHANGELOG): channel counts are only compared as images are read, so an error can follow summaries already yielded. A run that raised is incomplete and its output must be discarded.
  • image_summaries behaviour is unchanged. Only the percentile check moved into a shared helper.
  • No benchmark was run, so no performance claim is made.

Regression tests (tests/test_summaries.py)

  • test_streaming_summaries_equal_the_eager_ones, test_streaming_emits_one_image_at_a_time_and_drops_its_histograms, test_streaming_refuses_rows_that_are_not_together, and the other test_streaming_* tests.
  • On old main source the test module fails at collection: ImportError, because iter_image_summaries does not exist. All pass on the new code.

Checks

python tools/check.py: 720 passed, 2 skipped (tests/test_rgb.py:80, optional csbdeep not installed; not claimed as passed), 4 warnings (pre-existing, in test_pooling.py). The code-rules and ruff step is clean.

Part of #58? Fully implements the decided scope (streaming API plus refusal), so: Fixes #58 for the decided scope. The issue's benchmarks and external-sort mode were not part of the decision.


Generated by Claude Code

…ries (#58)

New generator API that holds one image's planes at a time and requires the
Z/T rows of an image to be contiguous; non-contiguous input is refused, not
staged or sorted. image_summaries is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scma6W3LC11s3qjXHZuGDm
@guijacquemet
guijacquemet merged commit 939813b into main Nov 7, 2026
8 checks passed
@guijacquemet
guijacquemet deleted the claude/streaming-image-summaries branch November 7, 2026 14:36
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.

[Sad Catapella N7][Performance] image_summaries eagerly retains all FOV histograms instead of supporting bounded-memory per-image aggregation

2 participants