Skip to content

feat(annotation): per-label + merged tiling previews, end-to-end#147

Merged
clemsgrs merged 1 commit into
mainfrom
144-annotation-tiling-previews
Jun 22, 2026
Merged

feat(annotation): per-label + merged tiling previews, end-to-end#147
clemsgrs merged 1 commit into
mainfrom
144-annotation-tiling-previews

Conversation

@clemsgrs

Copy link
Copy Markdown
Owner

Render tiling previews for annotation-aware sampling, mirroring the coordinate artifacts 1:1.

What changed

  • PER_ANNOTATION: one tiling preview per active label, each drawn over that label's full-color mask backdrop with the selected tile grid, written under the per-annotation preview subdir (preview/tiling/{label}/{sample_id}.jpg).
  • SINGLE_OUTPUT: one merged tiling preview over the multi-label mask backdrop with the union tile grid, at the flat preview location (preview/tiling/{sample_id}.jpg).
  • Grid is the existing fixed black line (draw_grid default); no new grid-color config. Backdrop is drawn via write_coordinate_preview's mask-overlay path; the palette is built from the sampling pixel/color mapping.
  • Preview subdir selection routes through the shared is_flattened_annotation helper (Prefactor: shared annotation→path flattening helper for artifact and preview paths #142), so preview paths match coordinate artifact paths exactly (a label literally named tissue, and the merged/None case → flat root).
  • Rendered through the existing preview thread-pool executor (preview_executor / _finalize_pending_tiling_preview), one task per artifact, so renders never serialize on the compute hot path.
  • Zero-tile labels skip their preview but keep a manifest row with num_tiles=0, empty tiling_preview_path, and a populated mask_preview_path.
  • Identical under INDEPENDENT and JOINT selection; governed by preview.save_tiling_preview. The Annotation previews: multi-label mask preview, end-to-end #146 mask-preview behavior (repeated mask_preview_path) is unchanged.

Tests

  • New structural tests at the tile_slides() seam in tests/test_annotation_coverage.py: per-label preview counts/paths (both selection strategies), merged single-output preview at flat root, per-row tiling_preview_path, zero-tile skip (row kept with num_tiles=0 / empty preview / populated mask preview), tissue/None flattening, and the no-preview path.
  • Visual fixture in tests/test_overlay_semantics.py pinning the rendering: label mask backdrop under the fixed black grid line.

Acceptance criteria

  • PER_ANNOTATION: one tiling preview per active label, full-color mask backdrop + tile grid; path matches the coordinate artifact path via the shared helper.
  • SINGLE_OUTPUT: a single merged tiling preview over the multi-label mask backdrop with the union tile grid, at the flat preview location.
  • Tile grid is the fixed black line; no new grid-color config introduced.
  • Zero-tile labels skip their tiling preview but keep a manifest row with num_tiles=0, empty tiling_preview_path, populated mask_preview_path.
  • Tiling previews are generated via the existing preview executor, not serialized on the compute hot path.
  • Each row's tiling_preview_path is populated for non-empty results in both output modes.
  • Behavior is identical under INDEPENDENT and JOINT selection.
  • Structural tests at the tile_slides() seam cover both output modes; a visual fixture pins the rendering.

Closes #144

🤖 Generated with Claude Code

Add tiling previews for annotation-aware sampling, mirroring the coordinate
artifacts 1:1.

- PER_ANNOTATION: one tiling preview per active label, each drawn over that
  label's full-color mask backdrop with the selected tile grid, written under
  the per-annotation preview subdir.
- SINGLE_OUTPUT: one merged tiling preview over the multi-label mask backdrop
  with the union tile grid, at the flat preview location.
- Grid is the existing fixed black line (draw_grid default); no new grid-color
  config. The backdrop is drawn via write_coordinate_preview's mask overlay
  path (palette built from the sampling pixel/color mapping).
- Preview subdir selection routes through the shared is_flattened_annotation
  helper so preview paths match coordinate artifact paths exactly (tissue/None
  -> flat root).
- Rendered through the existing preview thread-pool executor (one task per
  artifact), so renders never serialize on the compute hot path.
- Zero-tile labels skip their preview but keep a manifest row with num_tiles=0,
  empty tiling_preview_path, and a populated mask_preview_path.
- Identical behavior under INDEPENDENT and JOINT selection; governed by
  preview.save_tiling_preview. Mask-preview behavior from #146 is unchanged.

Structural tests at the tile_slides() seam cover both output modes (file
counts/paths, per-row tiling_preview_path, zero-tile skip, tissue/None
flattening); a visual fixture pins the rendering (label backdrop under the
black grid).

Closes #144

Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.

Annotation previews: per-label + merged tiling previews, end-to-end

1 participant