SydneyBioX / BIDCell

Biologically-informed deep learning for cell segmentation of subcelluar spatial transcriptomics data
Other
33 stars 4 forks source link

Connecting BIDCell matrix and cell masks #16

Closed pakiessling closed 2 weeks ago

pakiessling commented 1 month ago

Hi, thank you for the tool. After adjusting the number of positive marker the results looks pretty good.

For further downstream processing like deriving protein intensity from images I need matched polygons for every cell in the matrix in pixel space.

I resized the _connected.tif to the size of the DAPI input image and calculated polygons from that. Is the cell with the value 1 in the tif the same as the first cell in the expr_mat.csv ?

In addition do you think this approach is right or should I perform some sort of reverse affine transformation on the polygons instead of resizing the image? Where do transform from pixel to micron space?

xhelenfu commented 1 month ago

Hello, thank you for your questions.

The values of cells in the tif file should correspond to the cell IDs in expr_mat.csv (the same value in each file match to the same cell).

I think it's fine to resize the _connected.tif to the size of the DAPI input, the resulting pixel resolution will be the same as the DAPI. The pixel size would depend on the platform (e.g., for Xenium a typical size is 0.2125 microns per pixel). One thing to note with applying image resizing is the cell ID values might be converted to in-between values due to interpolation. One straightforward solution would be to use nearest neighbour interpolation. Another approach might be to separately resize each cell and applying thresholding to convert values back to the original ID.