Repository navigation
Trim stitched tiles when the overlap is zero along one axis - #195
Open
aaronkanzer wants to merge 1 commit into
Open
aaronkanzer wants to merge 1 commit into
aaronkanzer wants to merge 1 commit into
Conversation
The overlap was removed only when the Y overlap was nonzero, and with tile[a:-b] a zero overlap on one axis gives an empty slice. A grid with only X overlap was not trimmed, so the computed array did not match the dask shape, and a grid with only Y overlap stitched to zero width.
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.
as_array(stitched=True)gives the wrong array when the grid overlap is zero in one direction. For a 2x2 grid of 64x80 tiles:In
_read_one_image_for_large_arraythe overlap is removed only ifnp.any(overlap[0] > 0), which tests the Y overlap alone, so tiles with only X overlap are not trimmed and the result no longer matches the dask chunk shape. When the Y overlap is nonzero,tile[min:-max]withmax_index == 0on the X axis istile[:, 0:0], an empty slice.The fix tests
np.any(overlap > 0)and slices up totile.shape - max_index.Tested:
test_stitched_overlapwrites a 2x2 grid with overlaps (10, 10), (0, 10), (10, 0), (1, 3) and (0, 0), stitches it and compares shape and pixels with the expected layout.