scverse / spatialdata

An open and interoperable data framework for spatial omics data
https://spatialdata.scverse.org/
BSD 3-Clause "New" or "Revised" License
230 stars 43 forks source link

Extent calculation doesn't account for radius of Points #693

Open timtreis opened 1 month ago

timtreis commented 1 month ago

Just fixed https://github.com/scverse/spatialdata-plot/pull/334 and noticed that the extent calculation does not account for the radius of points. In the first version of this picture we calculated this within spatialdata-plot but that has since moved upstream. It's realistically not super noticeable if these are small, but f.e. in our test case it stands out:

image

Can be mitigated through the pad_extent parameter in sdata.pl.show(), but figured I'd report anyway.

LucaMarconato commented 1 month ago

That's strange; you are using spatialdata.get_extent() right? In the API the radius is taken into account in the extent calculation: https://github.com/scverse/spatialdata/blob/8323e158d76e5ebefb033aa99900294ed1e4668a/src/spatialdata/_core/data_extent.py#L51