Is "polygon_query" function working properly?
Hi,
I'm using napari_spatialdata to segment regions of interest. It seems the filtered table doesn't include the correct cell IDs. I noticed all polygon shapes changed into rectangles. I attached an example below. The triangle is the ROI I placed and the blue rectangle area shows cells obtained by polygon_query. I'm using Seurat for clustering etc. So, I export the filtered table and add annotations as metadata. This happens no matter what shapes of polygon I create. However, "sdata.pl.render_images().pl.render_shapes(color='annotation').pl.show(coordinate_systems=["x"])" displays the actual polygon.
Why does this discrepancy happen (is this happening only to me?) and is there any way to solve this problem? Thank you so much for your help!
Hi @yt723 thanks for reporting and happy to look into this but I will need some help in reproducing the bug please.
-
Does the bug appear also with the latest
mainofspatialdataandnapari-spatialdata? -
Could you please try reproducing the bug with the following dataset:
from spatialdata.datasets import blobs_annotating_element
sdata = blobs_annotating_element('blobs_polygons')
- If you can't reproduce with the dataset above, is there any change you could share the dataset you are using in your screenshot?
Thanks!
@LucaMarconato I also have this problem. Any updates on how to resolve? I am using the Nanostring CosMx sample data available from their website (https://nanostring.com/products/cosmx-spatial-molecular-imager/ffpe-dataset/cosmx-smi-human-pancreas-ffpe-dataset/) and am following along with this tutorial to annotate ROIs: https://spatialdata.scverse.org/en/latest/tutorials/notebooks/notebooks/examples/napari_rois.html.
Everything works as expected, code wise, just the final annotation is... off by quite a margin. See attached image for the polygon I drew (white-transparent) and the subsequent polygon_querry annotations (green and red). Blue cells are not annotated by polygon_query. I have this problem regardless of what kind of shape I draw (triangle, lasso, etc).
Thanks!
@LucaMarconato I also have this problem. Any updates on how to resolve? I am using the Nanostring CosMx sample data available from their website (https://nanostring.com/products/cosmx-spatial-molecular-imager/ffpe-dataset/cosmx-smi-human-pancreas-ffpe-dataset/) and am following along with this tutorial to annotate ROIs: https://spatialdata.scverse.org/en/latest/tutorials/notebooks/notebooks/examples/napari_rois.html.
Everything works as expected, code wise, just the final annotation is... off by quite a margin. See attached image for the polygon I drew (white-transparent) and the subsequent polygon_querry annotations (green and red). Blue cells are not annotated by polygon_query. I have this problem regardless of what kind of shape I draw (triangle, lasso, etc).
Thanks!
![]()
@yt723 @sanderson6445 I may have to try what you are doing soon (labeling and subsampling ROIs). Have you had success with resolving your issues?
@Pancreas-Pratik Sorry this issue skipped my attention. I will have a look and report back by the weekend.