Skip to content

​​Problems encountered in boundary analysis​​ #353

@Liaox-a

Description

@Liaox-a

Thank you for your wonderful tools!

When I used Spateo to identify the boundary lines between cell types, I found that when the boundary line identified by st.dd.identify_boundarywas discontinuous, st.dd.format_boundary_linecould not recognize the input pt_startand pt_end. The reason might be that ctrscontained multiple elements in this case. Although I could manually remove the discontinuous segments of the boundary line, I would still like to consult you on whether there is a better solution.

Image

#user input
pt_start = (285,255)
pt_end = (259,280)
#digitize boundary related area
fmt_bdl_ls, fmt_bdl_img = st.dd.format_boundary_line(bdl_img, pt_start, pt_end)
st.dd.boundary_gridding(
adata=adata,
spatial_key="spatial",
boundary_line_img=fmt_bdl_img,
boundary_line_list=fmt_bdl_ls,
n_layer = 3,
layer_width=8,
init = True,
)


ValueError Traceback (most recent call last)
Cell In[232], line 6
3 pt_end = (259,280)
5 #digitize boundary related area
----> 6 fmt_bdl_ls, fmt_bdl_img = st.dd.format_boundary_line(bdl_img, pt_start, pt_end)
7 st.dd.boundary_gridding(
8 adata=adata,
9 spatial_key="spatial",
(...)
14 init = True,
15 )

File /share/appspace_data/shared_groups/BGI/USERS/liaox/.conda/envs/spateo/lib/python3.8/site-packages/spateo/digitization/utils_old.py:88, in format_boundary_line(boundary_line_img, pt_start, pt_end)
85 for pt in ctrs[0]: # should only contain a single contour
86 ctrs_pt_list.append((pt[0][0], pt[0][1]))
---> 88 start_idx = ctrs_pt_list.index(pt_start)
89 end_idx = ctrs_pt_list.index(pt_end)
90 formatted_bdl_list = ctrs_pt_list[min(start_idx, end_idx) : max(start_idx, end_idx) + 2]

ValueError: (285, 255) is not in list

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions