Modify extent of query #472
-
Hi, I had this thought and wanted to know if it is possible with how the query function sits. I had a look through the function and seems like it may take a little work. Right now when doing a query (spatial or bounding box) overlaps are identified with the shape by any pixel overlap. For instance, if i drew a roi (polygon) in space and wanted to do a query for spots in Visium data that are in this polygon. It will return spots that are just a 1-pixel overlap and above. I was wondering if we can use some of the area information to call only those spots that overlap say with 50% (for example) with the specific polygon of interest? How hard would something like this be to implement? a |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @tawaunl, a quick way to address your use case could be to call the (new) Would this be enough? If more users request this we could also maybe integrate this in the APIs/extend this to different overlaps, but for the moment I would manually go for the approach above. |
Beta Was this translation helpful? Give feedback.
-
I have some details to add. I have now added a In alternative, I made a little demo with the code hidden in this commit https://github.com/scverse/spatialdata-notebooks/blob/9ea096ff0e047321cbc83ae24b8f571e1956b8ba/notebooks/examples/napari_rois.ipynb (see the end of the notebook), where I compute fraction of overlap between regions being queried by polygon ROIs. The example is a bit technical; it could be simplified by using directly |
Beta Was this translation helpful? Give feedback.
I have some details to add.
I have now added a
to_circles()
API that makes it easier to convert labels, multiscale labels, polygons and multipolygons to circles. This would facilitate writing the queries if you use the circles approach above.In alternative, I made a little demo with the code hidden in this commit https://github.com/scverse/spatialdata-notebooks/blob/9ea096ff0e047321cbc83ae24b8f571e1956b8ba/notebooks/examples/napari_rois.ipynb (see the end of the notebook), where I compute fraction of overlap between regions being queried by polygon ROIs. The example is a bit technical; it could be simplified by using directly
geopandas
API instead ofaggregate
, while continuing using spa…