fix: support raster labels above uint16#2
Closed
stanbot8 wants to merge 1 commit into
Closed
Conversation
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.
Preview. Text in square brackets becomes links in the submission.
Two implementations exist. This one uses 1 canvas and only removes the label-count limit. The other implementation uses opt-in lazy tiles to limit output memory and includes this commit first. Compare the remaining limits.
Summary
In [issue 987],
rasterize(..., return_regions_as_labels=True)rejects more than65,535labels. Select the output dtype from the maximum label. Closes issue 987.Design
Use the existing
_get_uint_dtype()helper, as proposed in the [maintainer direction]. Small outputs remainuint16. Larger outputs useuint32oruint64only when required.The change is in [
rasterize.py].Tests
1 boundary test rasterizes
65,536indexed points. It preserves label65,536inuint32output.The focused rasterization suites pass with
28tests. The complete suite passes with1,365tests,7skips, and1expected failure. An isolated installed wheel passes the same boundary case.The test is in [
test_rasterize.py].Commands
uv run pytest tests/core/operations/test_rasterize.py::test_rasterize_points_selects_label_dtype -q