Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist color channels in rasterize() #544

Merged
merged 7 commits into from
May 25, 2024

Conversation

clwgg
Copy link
Contributor

@clwgg clwgg commented Apr 11, 2024

Fixes scverse/spatialdata-plot#249

Please see the above spatialdata-plot issue for a problem description.

This is just a draft of how this issue could be addressed. I could see several different routes this could be tackled, including:

  • splitting the tests into a separate function
  • using if schema in (Image2DModel, Image3DModel): logic instead of the current try: except:
  • using get_channels() instead of xdata.coords["c"].values, although this is a bit awkward since xdata is not the correct type for get_channels(), so one would have to either modify get_channels() or call it on data instead of xdata which feels a little less clean

Let me know what you think!

clwgg added 2 commits April 11, 2024 10:59
Otherwise named channels will get lost during rasterize, which
interferes with referencing them by name when plotting.
Copy link
Member

@giovp giovp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @clwgg , looks good! would you mind adding a release note here? https://github.com/scverse/spatialdata/blob/main/CHANGELOG.md thanks!

@giovp giovp requested a review from LucaMarconato April 23, 2024 08:18
Copy link

codecov bot commented May 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.55%. Comparing base (db6a55b) to head (9d4f98e).
Report is 84 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #544   +/-   ##
=======================================
  Coverage   92.55%   92.55%           
=======================================
  Files          42       42           
  Lines        6000     6001    +1     
=======================================
+ Hits         5553     5554    +1     
  Misses        447      447           
Files Coverage Δ
src/spatialdata/_core/operations/rasterize.py 83.93% <100.00%> (+0.08%) ⬆️
src/spatialdata/datasets.py 100.00% <100.00%> (ø)

@LucaMarconato
Copy link
Member

Thanks @clwgg! I went for "using if schema in (Image2DModel, Image3DModel): logic instead of the current try: except:"; merging now 😊

@LucaMarconato LucaMarconato merged commit 2a38051 into scverse:main May 25, 2024
6 of 7 checks passed
@clwgg clwgg deleted the rasterize_channel_persistence branch July 31, 2024 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

channel selection in render_images() depends on rasterize
3 participants