Flatten the 'merged' annotation label to the output root#155
Merged
Conversation
is_flattened_annotation is the single source of truth for the annotation->path rule. It already collapses None and the 'tissue' sentinel to the flat root, but not 'merged' — the union-of-classes output mode that carries no single class. merged artifacts are already written flat internally (their TilingResult.annotation is None), but the process_list row is labelled 'merged' so it is not mistaken for tissue. Consumers that read that label back and feed it to the path rule were therefore forced to blank 'merged' to None to keep the artifact flat, which also erased the tissue-vs-merged distinction. Treating 'merged' as flattened here lets the informative label flow through unchanged while still landing at the flat root. The change is inert within hs2p itself (no call site ever passes the literal 'merged' — merged results carry annotation=None), so it only unblocks downstream consumers. Extends the flattening test to cover 'merged' (and that 'Merged' / 'merged_x' still get their own subdir).
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.
What
Make
is_flattened_annotationtreat"merged"as flat (alongsideNoneand"tissue"), so the union-of-classes output mode lands at the flat output root rather than a straymerged/subdirectory.Why
is_flattened_annotationis the single source of truth for the annotation→path rule. Merged artifacts are already written to the flat root internally — a mergedTilingResultcarriesannotation=None— but the process_list row is labelled"merged"(by_build_success_process_row) so it isn't mistaken for plain tissue.That left consumers in a bind: to honor the flat layout they had to blank
"merged"→Nonebefore feeding it to the path rule, which also erased the tissue-vs-merged distinction in the label they surface to users. Flattening"merged"here lets the informative label flow through unchanged while still resolving to the flat root.Safety
The change is inert within hs2p: no call site ever passes the literal
"merged"into the rule — merged results carryannotation=None, andis_flattened_annotationis only ever called with aTilingResult.annotation(None/"tissue"/ a real class). So no hs2p artifact path moves. It only unblocks downstream consumers (e.g. slide2vec) that read the"merged"process_list label.Tests
test_annotation_path_flatteningnow asserts"merged"flattens, and that look-alikes ("Merged","merged_x") still get their own subdir.test_standalone_mask_pyramid.pyones, which import ascripts/generate_tissue_mask_pyramid.pythat is absent from the tree — unrelated to this change).