jianhuupenn / TESLA

Deciphering tumor ecosystems at super-resolution from spatial transcriptomics with TESLA
MIT License
45 stars 11 forks source link

contour issue #11

Open jinyeong1316 opened 9 months ago

jinyeong1316 commented 9 months ago

Hi,

I am currently working with biopsy samples in Xenium. In my FFPE slides, I have 3-4 masses for each sample. After using the cv2_detect_contour function, I noticed that only one mass was successfully detected and contoured, while the others were not.

I know you suggested for contouring using coordinates, but unfortunately, the Xenium data does not include information about x-array and y-arrays.

Could you help me to handle this?

jianhuupenn commented 8 months ago

You can try this:

cnt_info=tesla.cv2_detect_contour(img, apertureSize=5, L2gradient = True, all_cnt_info=True)
binary=np.zeros((img.shape[0:2]), dtype=np.uint8)
for tmp in cnt_info:
    if tmp[2]>100:
        cnt=tmp[0]
        cv2.drawContours(binary, [cnt], -1, (1), thickness=-1)