This notebook was translated from ImageJ Macro.
It shows how to create a Voronoi diagram out of a binary image in the GPU.
import pyclesperanto_prototype as cle
from skimage.io import imread, imsave, imshow
import matplotlib
import numpy as np
# initialize GPU
cle.select_device("GTX")
<Intel(R) Iris(R) Xe Graphics on Platform: Intel(R) OpenCL HD Graphics (1 refs)>
# load data
image = cle.asarray(imread('https://samples.fiji.sc/blobs.png'))
image
cle._ image
|
## Binarze image first
binary = cle.greater_constant(image, constant=128)
binary
cle._ image
|
## Label objects and fill gaps between them
labels = cle.voronoi_labeling(binary)
labels
cle._ image
|
voronoi = cle.detect_label_edges(labels)
voronoi
cle._ image
|