clEsperanto / pyclesperanto_prototype

GPU-accelerated bio-image analysis focusing on 3D+t microscopy image data
http://clesperanto.net
BSD 3-Clause "New" or "Revised" License
208 stars 44 forks source link

Get the Contours array from `voronoi_labeling()` function #323

Closed xiachenrui closed 9 months ago

xiachenrui commented 9 months ago

Hi,

I really enjoy using pyclesperanto_prototype !

When I run voronoi_labeling() in my data, I also want to get the Contours coordinates of each tile. I am not sure how to extract it from the output (labels). Any suggestion will be helpful !

binary = cle.greater_constant(image, constant=0.3)
labels = cle.voronoi_labeling(binary)
type(labels)
>>> pyclesperanto_prototype._tier0._pycl.OCLArray

Best, Rui

StRigaud commented 9 months ago

Hi @xiachenrui

Thanks for the praise!

I think the function you seek is the following https://github.com/clEsperanto/pyclesperanto_prototype/blob/b465c8669f8e9326874139cf4b9c9af22c22757c/pyclesperanto_prototype/_tier11/_reduce_labels_to_label_edges.py#L6

this takes a labeled image like yours and return the edges of each label.

xiachenrui commented 9 months ago

Thanks for your kind help ! I think that is I want !