Closed shriyasmith closed 3 months ago
Hi, thanks for your question. The output segmentation is a .tif file (with a name such as epoch_1_step_4000_connected.tif
), where each cell has its own cell ID value. To visualise cell boundaries, you can use something like
for cell_id in all_cell_ids:
border = np.zeros((size, size), dtype=np.uint8)
cell_id = int(cell_id)
mask = np.where(segmentation == cell_id, 1, 0).astype(np.uint8)
contours, _ = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_TC89_L1)
border = cv2.drawContours(image=border, contours=contours, contourIdx=-1, color=int(cell_id), thickness=1, lineType=cv2.LINE_8)
border[border>0] = cell_id
Thanks, I will give it a try!
Hi @shriyasmith where you able to draw the cell boundaries using bidcell output? I am not sure how to run the code given above:
On running the code below, I am getting an error that segmentation is not defined...
for cell_id in all_cell_ids:
border = np.zeros((13699, 22797), dtype=np.uint8)
cell_id = int(cell_id)
mask = np.where(segmentation == cell_id, 1, 0).astype(np.uint8)
contours, _ = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_TC89_L1)
border = cv2.drawContours(image=border, contours=contours, contourIdx=-1, color=int(cell_id), thickness=1, lineType=cv2.LINE_8)
border[border>0] = cell_id
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
NameError: name 'segmentation' is not defined
I appreciate if you could share your experience.
Thanks.
Hi team, congratulations to the beautiful work! I wonder how you draw the cell boundaries from the BIDcell output files? I'd appreciate a walkthrough that includes the steps for reading the files in the output directory, processing the data within, and then using that data to draw the cell boundaries. Thanks!