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

Wrong use of size parameter for points layer #209

Closed
LucaMarconato opened this issue Mar 18, 2024 · 2 comments · Fixed by #208
Closed

Wrong use of size parameter for points layer #209

LucaMarconato opened this issue Mar 18, 2024 · 2 comments · Fixed by #208

Comments

@LucaMarconato
Copy link
Member

For performance reasons we show circles using a napari points layer instead of using a napari shapes layer with ellipses.
It is important that the size of the points lead to the same visualization as the one that we would obtain using the ellipses with a certain radius.

This is not the case. Somehow the size parameter of the points, that should represent the diameter of the circles, lead to a incorrect visualization.

A minimal working example to tackle this should also test the case in which there are two coordinate system with a different scale. I suggest to use a dataset with a circle and a rasterized image of that circle and then scale this in a new coordinate system. The two circles, in each coordinate system, should coincide.

@LucaMarconato
Copy link
Member Author

I made a minimal working example here: https://github.com/giovp/spatialdata-sandbox/blob/main/toy/to_zarr.py.
It's a sdata object with two coordinate system. The circles and the rasterized version of the circles should coincide. This is the case when we set, in _viewer.py, CIRCLES_AS_POINTS = False (which uses ellipses for circles), as you can see from these screenshot.

Circles as ellipses, global coordinate system

image

Circles as ellipses, scaled coordinate system

image

Circles as points, global coordinate system

The visualization is correct also when CIRCLES_AS_POINTS = True when the coordinate transformation is an Identity(). Note that I have to zoom out since the point size has a upper bound in macOS.
image

Circles as points, scaled coordinate system

Instead, this is what happens when CIRCLES_AS_POINTS = True and the coordinate system is mapped via a transformation that is not an Identity.
image

@LucaMarconato
Copy link
Member Author

The minimal working example made it quite clear what was going on; now fixed here: 97fd8e7 (#208). Will be merged when #208 is merged.

@LucaMarconato LucaMarconato linked a pull request Mar 18, 2024 that will close this issue
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 a pull request may close this issue.

1 participant