Edges of labels#
When processing biological objects in image such as cells and nuclei, it may make sense to identify all pixels that lie on the surface of an object. This notebook demonstrates how to select pixels on the border of nuclei, just in case we would like to measure intensity in the nuclear envelope.
import pyclesperanto_prototype as cle import numpy as np from skimage.io import imread
image = cle.asarray(imread("../../data/mitosis_mod.tif")[0:40,25:65]) image
We then segment the nuclei.
label_image = cle.voronoi_otsu_labeling(image, spot_sigma=2, outline_sigma=1) label_image
From the nuclei label image we can extract another label image which contains all pixels that are on the edge of the labels.
edge_label_image = cle.reduce_labels_to_label_edges(label_image) edge_label_image
In case one wanted to measure in thicker areas along the borders, we could expand the borders.
thicker_edges = cle.dilate_labels(edge_label_image, radius=1) thicker_edges
For visualization purposes we can also view the original image with the label borders on top.
cle.imshow(image, continue_drawing=True) cle.imshow(edge_label_image, alpha=0.6, labels=True)