You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The behavior is undocumented and not intuitive. As it was intentionally introduced, there seems to exist a use case, but in other use cases it is a potential source of bugs. Some control over it is already provided through the flag return_regions_as_labels=False.
We should document it.
We should rethink whether it is safer to change the default of return_regions_as_labels, especially if it is for internal use.
We must either make sure all functions calling rasterizepass the correct value for return_regions_as_labels that is appropriate in each case, or further expose the flag to their callers.
A possible fix would be to make transform_to_data_extent call rasterize(…, return_regions_as_labels=True)
Describe the bug
When applying
transform_to_data_extent
on a SpatialData with labels, they are merged into images.To Reproduce
Steps to reproduce the behavior:
Expected behavior
All element types should be preserved. Labels should stay in labels.
Additional context
This is caused by the following line:
spatialdata/src/spatialdata/_core/operations/rasterize.py
Lines 330 to 331 in 6694c91
The behavior is undocumented and not intuitive. As it was intentionally introduced, there seems to exist a use case, but in other use cases it is a potential source of bugs. Some control over it is already provided through the flag
return_regions_as_labels=False
.return_regions_as_labels
, especially if it is for internal use.rasterize
pass the correct value forreturn_regions_as_labels
that is appropriate in each case, or further expose the flag to their callers.A possible fix would be to make
transform_to_data_extent
callrasterize(…, return_regions_as_labels=True)
spatialdata/src/spatialdata/_core/operations/_utils.py
Lines 118 to 128 in 6694c91
The text was updated successfully, but these errors were encountered: