Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

distance between two groups of centroids #289

Open
jackyko1991 opened this issue Mar 17, 2023 · 0 comments
Open

distance between two groups of centroids #289

jackyko1991 opened this issue Mar 17, 2023 · 0 comments

Comments

@jackyko1991
Copy link

I am following this guide to measure the distance between two spare cell types: https://github.com/clEsperanto/pyclesperanto_prototype/blob/master/demo/neighbors/distance_to_other_labels.ipynb

This works fine but I am trying to repeat the method with distance matrix to their centroids

# generate distance matrix
distance_matrix = cle.generate_distance_matrix(cen_A, cen_B)

TCell count: 294
CancerCell count: 691

Give the distance matrix as follows:
output

Then I try to filter out the long distance cells with connection matrix:

connection_matrix = cle.smaller_or_equal_constant(distance_matrix, constant=10)

connection

But seems the function touch_matrix_to_mesh is not designed for this type of mesh, but only works within in same label group

mesh = cle.create_like(imageA)
cle.touch_matrix_to_mesh(cen_A, connection_matrix, mesh)
fig, ax = plt.subplots(1,1,figsize=(15,15))
ax.set_axis_off()
ax.imshow(exposure.rescale_intensity(imageA, in_range=(pl, pu),out_range=(0,255)),cmap='Greens',alpha=0.7)
ax.imshow(exposure.rescale_intensity(imageB, in_range=(pl, pu),out_range=(0,255)),cmap='Reds',alpha=0.7)
cle.imshow(mesh, labels=True, plot=ax, alpha=0.5)

mesh

Is there some workaround for the task?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant