Fix shrink_labels for 1D face strips in 2D distributed segmentation#1480
Open
sbamopoulos wants to merge 1 commit into
Open
Fix shrink_labels for 1D face strips in 2D distributed segmentation#1480sbamopoulos wants to merge 1 commit into
sbamopoulos wants to merge 1 commit into
Conversation
np.gradient on a 1D squeezed face returns a bare array, so np.linalg.norm(..., axis=0) became a scalar and zeroed every pixel. That broke tile-boundary stitching for 2D whole-slide runs without raising an error. Co-authored-by: Cursor <cursoragent@cursor.com>
2b403ad to
a87a483
Compare
2 tasks
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.
Summary
Fixes silent broken tile stitching for 2D
distributed_evalruns (whole-slide / flat images).Complements PR #1123 (merged in 4.2.1), which fixed the
generate_binary_structure(3, 1)rank crash. This PR fixes the remaining bug inshrink_labelsthat zeroes all face pixels on 1D face strips.Problem
During stitching,
block_face_adjacency_graphcallsshrink_labelson thin face arrays at tile boundaries.np.gradientreturnsnp.linalg.norm(..., axis=0)(1, H, W)→(H,W)(H,W)✓(1, W)→(W,)When
gradmagis a scalar and non-zero, this line zeros every pixel:Result: all faces are empty → no cross-tile label adjacency → masks are hard-cut at every tile boundary with no error raised.