Masking images #729
Replies: 2 comments
-
If anyone is curious, here are some options that work: The best (and obvious) answer to use spatialdata.rasterize() on the selected shapes. Convert the raster to binary. To do things extra manually, there's spatialdata.transformations.get_transformation(). For an array of polygon coordinates: shapely.get_coordinates(POLYGON.exterior), add a third column of 1 (for the translation). Then the transformed coordinates should be [tranformation matrix] x np.transpose([coordinates]). |
Beta Was this translation helpful? Give feedback.
-
Thanks @qu4drupole for the discussion and for sharing your solution, which is also the one that I recommend. I add an extra detail regarding |
Beta Was this translation helpful? Give feedback.
-
My objective: generate IF images cropped to an area of interest and masked by cell boundaries. Then use images to measure things, like colocalization.
I'm working with MERSCOPE data that looks like this:
Up to this point, I had been using other software to process and analyze the data. I can identify cells in my area of interest, through a merge with "table". From there, I'm not sure what the best option is to generate masked images. I can think of 2 options:
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions