jianhuupenn / TESLA

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

contour issue #11

Open jinyeong1316 opened 5 months ago

jinyeong1316 commented 5 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 4 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)