Fix export of masks with multi-theC as multi-channel labels #178
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.
This commit is from #174 (being tested there by Jason) but is picked to a separate PR so we can merge and release...
If masks have theC set (and there is more than 1 value for
theC) then we export a multi-channel mask image (don't squeeze out the C dimension).cc @jburel
This bug was introduced in 101b0e1, released in v0.6.0 (June 2024)
To test, create or find an Image with Polygons that have different values for
theC. E.g. on merge-ci Image:23117:Export the image, then export polygons to labels, using
--overlaps=dtype_maxbecause some Shapes with the same C value are overlapping:Now view with:
Click on
labels/0link to view the labels in validator, then click the vizarr icon to view labels in vizarr.You should see that this is a multichannel image, with labels on different channels.
By default, vizarr will scale rendering so that the brightest label (e.g. value 1 or value 2) is saturated. For any overlapping labels, the overlap is assigned to max, e.g. 127, so the other labels (e.g. value 1 or value 2) will be almost black, unless you boost the levels:
Without this PR, all the labels are exported to a single channel: