HelenaLC / SpatialData

15 stars 7 forks source link

guessing multiscale is counter intuitive? #84

Open HelenaLC opened 2 hours ago

HelenaLC commented 2 hours ago

Thumbs up if you agree @Artur-man, else happy to discuss/learn about the reasoning behind the current implementation!

Artur-man commented 2 hours ago

ah very good point ... when I have discussed this with @melonora and @LucaMarconato, they mentioned to me that you first pick the scale that is closest (but higher) to the target resolution, from there, you rasterize and decrease the resolution to fit the targeted resolution.

Here is a good example:

This is the multiscale image of VisiumHD example (3, 21943, 23618), (3, 10971, 11809), (3, 5485, 5904), (3, 2742, 2952), (3, 1371, 1476)

Say that you wanna visualize the image with ... (2500, 2600) resolution. The closest resolution in the list of scales is (2742, 2952) then, if needed, you downgrade the resolution from (2742, 2952) to (2500, 2600), I thought it is better the change the resolution from a higher resolution rather than a lower resolution, meaning when you transform the (1371, 1476) image to (2500, 2600) you lose more information.

However, I am happy with which strategy you wanna go, at the end of the day the idea is to get a lower resolution image in the memory :D

melonora commented 5 minutes ago

Hello there! Please see https://github.com/scverse/spatialdata-plot/blob/0667ef8bf0633ad9574bbf4dd6e5defd60a6762f/src/spatialdata_plot/pl/utils.py#L1282C6-L1352 for the implementation in spatialdata-plot. This takes the figure width, height and dpi into account.

melonora commented 2 minutes ago

Thinking back I think for choosing the higher scale was mainly due to the fact that you would have to choose an interpolation so that would be another parameter.