I was following your tutorial and in your original code it seems that cnt will reflect the last step (contour by y, not cv2). I modified to look at the different contours with each algorithm, but the step #### 4.4 Plot gene expression image only works with cnty and not cntcv2.
#Three different algorithms to detect contour, select the best one. Here we use cv2.
#-----------------1. Detect contour using cv2-----------------
cntcv2=tesla.cv2_detect_contour(img, apertureSize=5,L2gradient = True)
#-----------------2. Scan contour by x-----------------
spots=counts.obs.loc[:, ['pixel_x', 'pixel_y', "array_x", "array_y"]]
#shape="hexagon" for 10X Visium, shape="square" for ST
cntx=tesla.scan_contour(spots, scan_x=True, shape="hexagon")
#-----------------3. Scan contour by y-----------------
spots=counts.obs.loc[:, ['pixel_x', 'pixel_y', "array_x", "array_y"]]
#shape="hexagon" for 10X Vsium, shape="square" for ST
cnty=tesla.scan_contour(spots, scan_x=False, shape="hexagon")
#_----------------------
cnt = cnty
gives error:
Traceback (most recent call last):
File "", line 1, in
File "/home/jsepulveda/.local/lib/python3.9/site-packages/TESLAforST-1.2.4-py3.9.egg/TESLA/tumor_edge_core.py", line 19, in leading_edge_detection
cnt_info=cv2_detect_contour((target_img==0).astype(np.uint8), apertureSize=5,L2gradient = True, all_cnt_info=True)
File "/home/jsepulveda/.local/lib/python3.9/site-packages/TESLAforST-1.2.4-py3.9.egg/TESLA/contour_util.py", line 73, in cv2_detect_contour
cnt=cnt_info[0][0]
IndexError: list index out of range
Hi,
I was following your tutorial and in your original code it seems that cnt will reflect the last step (contour by y, not cv2). I modified to look at the different contours with each algorithm, but the step
#### 4.4 Plot gene expression image
only works with cnty and not cntcv2.Also, in this code:
6.2 Leading edge detection
gives error: Traceback (most recent call last): File "", line 1, in
File "/home/jsepulveda/.local/lib/python3.9/site-packages/TESLAforST-1.2.4-py3.9.egg/TESLA/tumor_edge_core.py", line 19, in leading_edge_detection
cnt_info=cv2_detect_contour((target_img==0).astype(np.uint8), apertureSize=5,L2gradient = True, all_cnt_info=True)
File "/home/jsepulveda/.local/lib/python3.9/site-packages/TESLAforST-1.2.4-py3.9.egg/TESLA/contour_util.py", line 73, in cv2_detect_contour
cnt=cnt_info[0][0]
IndexError: list index out of range