jianhuupenn / TESLA

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

[TESLA] multiple tumor/edge detectioins in one section #16

Open jpark27 opened 3 months ago

jpark27 commented 3 months ago

Dear @jianhuupenn,

Hello! Hope you been well. I happen to have a slide that has two tumours and have been struggling to grasp [1] multiple contours [2] individually detect tumor/edge detection. Any insights would be really helpful to me.

[1] Task: accurately draw contours for two tumor chunks (1&2)

[2] current limitation in TESLA (1) : only grab big chunk ([2]) and ignore smaller chunk [1]. image image

cnt=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: if tmp[2]>100: cnt=tmp[0] cv2.drawContours(binary, [cnt], -1, (1), thickness=-1) #cnt_enlarged = tesla.scale_contour(cnt, 1.05) #binary_enlarged = np.zeros(img.shape[0:2]) #cv2.drawContours(binary_enlarged, [cnt_enlarged], -1, (1), thickness=-1)

img_new = img.copy() cv2.drawContours(img_new, [cnt], -1, (255), thickness=50) img_new=cv2.resize(img_new, ((resize_width, resize_height)))

image

[3] current limitation in TESLA (2):