Open simonmfr opened 1 month ago
Hi, here the problem seems not to be related to the table but to the fact that no instance of 's1_r0_polygons'
is returned after the polygon query (hence no table row associated to the returned instances).
Without the data it's difficult to understand what is going on; which version of the spatialdata
and napari-spatialdata
io are you using?
Could you take some screenshot or even better record a short gif showing how you annotate the region with napari? Thank you.
Hi, thanks for the quick reply. Here's a gif showing how I create the manual annotations. I save the layer using shift+E. Does that help?
package versions: anndata 0.10.8 napari 0.4.19.post1 napari_builtins 0.4.19.post1 napari_matplotlib 2.0.1 napari_plugin_engine 0.2.0 napari_spatialdata 0.5.0.post1 scanpy 1.10.2 spatialdata 0.2.1 spatialdata_io 0.1.3.post0
Thanks for sharing the recording. Here are my considerations.
These are the coordinates of the box that you drew:
These are instead the coordinates that you print in the notebook:
The mismatch could be in principle due to a bug in handing of coordinate transformations or in the query function, but here I think this is not the cause. I think the origin of the bug is that, as you can see from this screenshot:
you are getting an error when pressing Shift + E due to a bug, that seems to be stopping the saving when the object is not backed from disk. We will track the bug here: https://github.com/scverse/napari-spatialdata/issues/271.
I suggest to trying saving the SpatialData
object by calling sdaa.write(your_path)
, and then reading it again with SpatialData.read(your_path)
before calling Interactive()
. The error above should disappear.
Also, a double check is to open again napari
after you saved the shapes and closed it. If shape not where you drew it, then the bug is probably not in the query function; if the shape is where you drew it, probably it is.
Thank you, and sorry for the delay. Even when loading a saved SpatialData file with associated Zarr store I found that the output of sd.polygon_query()
with filter_tables=True
does not contain any table. I've now found a temporary workaround with other another software but I'm happy to assist you reproducing the bug.
Glad that you found a workaround. Yes, helping reproducing the bug would be helpful thank you.
Could you please use one of these 3 datasets? Thanks.
from spatialdata.datasets import blobs_annotating_element
sdata = blobs_annotating_element('blobs_polygons')
sdata = blobs_annotating_element('blobs_labels')
sdata = blobs_annotating_element('blobs_circles')
Using this tutorial for MERFISH data, I found that the output of polygon_query(sdata, my_napari_annotation) does not contain any filtered table, despite my_napari_annotation covering multiple cells. Is there something missing in my code?
With filter_table=False, I get the unfiltered table, which is not what I am looking for. This is similar to https://github.com/scverse/spatialdata/issues/532
Much appreciated!
Details: