Reject float-dtype labels with clear error in render_labels#650
Merged
Reject float-dtype labels with clear error in render_labels#650
Conversation
Previously render_labels passed float-dtype label arrays straight into skimage's map_array, which raised a cryptic "TypeError: The dtype of an array to be remapped should be integer." with no spatialdata-plot frame, no element name, and no hint to cast. Add an early ValueError in _render_labels (after multiscale resolution) that names the element, reports the dtype, and shows a cast example. Closes #606
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #650 +/- ##
==========================================
+ Coverage 76.85% 76.89% +0.04%
==========================================
Files 11 11
Lines 3275 3277 +2
Branches 773 774 +1
==========================================
+ Hits 2517 2520 +3
Misses 457 457
+ Partials 301 300 -1
🚀 New features to boost your workflow:
|
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
render_labelspreviously passed float-dtype label arrays straight into skimage'smap_array, which raised a crypticTypeError: The dtype of an array to be remapped should be integer.with no spatialdata-plot frame, no element name, and no hint to cast.ValueErrorin_render_labels(after multiscale resolution, before rasterize) that names the element, reports the dtype, and shows a cast example.Closes #606