feat(annotation): per-label + merged tiling previews, end-to-end#147
Merged
Conversation
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]>
This was referenced Jun 22, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Render tiling previews for annotation-aware sampling, mirroring the coordinate artifacts 1:1.
What changed
preview/tiling/{label}/{sample_id}.jpg).preview/tiling/{sample_id}.jpg).draw_griddefault); no new grid-color config. Backdrop is drawn viawrite_coordinate_preview's mask-overlay path; the palette is built from the sampling pixel/color mapping.is_flattened_annotationhelper (Prefactor: shared annotation→path flattening helper for artifact and preview paths #142), so preview paths match coordinate artifact paths exactly (a label literally namedtissue, and the merged/Nonecase → flat root).preview_executor/_finalize_pending_tiling_preview), one task per artifact, so renders never serialize on the compute hot path.num_tiles=0, emptytiling_preview_path, and a populatedmask_preview_path.preview.save_tiling_preview. The Annotation previews: multi-label mask preview, end-to-end #146 mask-preview behavior (repeatedmask_preview_path) is unchanged.Tests
tile_slides()seam intests/test_annotation_coverage.py: per-label preview counts/paths (both selection strategies), merged single-output preview at flat root, per-rowtiling_preview_path, zero-tile skip (row kept withnum_tiles=0/ empty preview / populated mask preview), tissue/None flattening, and the no-preview path.tests/test_overlay_semantics.pypinning the rendering: label mask backdrop under the fixed black grid line.Acceptance criteria
num_tiles=0, emptytiling_preview_path, populatedmask_preview_path.tiling_preview_pathis populated for non-empty results in both output modes.tile_slides()seam cover both output modes; a visual fixture pins the rendering.Closes #144
🤖 Generated with Claude Code