Regional properties of label

Regional properties of label#

In this notebook we charcterize labels according to the mean and standard deviation of their propteries, such as size. If similarly sized objects are neighbors, the standard deviation of their size is low. If labels of different size are neighbors the standard deviation of their size is higher. This could be used to identify regions in tissues where cells of different size meet.

from skimage.io import imread
import pyclesperanto_prototype as cle
import stackview

The data we use here was derived from maize_clsm.tif was taken from here, an image shared by David Legland under CC-BY 4.0 license

image = imread("../../data/maize_clsm.tif")

stackview.insight(image)
shape(640, 639)
dtypeuint8
size399.4 kB
min0
max255

A corresponding label image looks like this:

labels = imread("../../data/maize_clsm_labels.tif")
labels = cle.exclude_small_labels(labels, maximum_size=200)
labels = cle.extend_labeling_via_voronoi(labels)
labels
cle._ image
shape(640, 639)
dtypeuint32
size1.6 MB
min1.0
max254.0

Measuring size#

First we need to quantify size of the objects. We can immediately visualize these measurements as parametric image.

size_map_image = cle.pixel_count_map(labels)

size_map_image
cle._ image
shape(640, 639)
dtypefloat32
size1.6 MB
min201.0
max14283.0

Regional properties#

We can now summarize those measurments locally, e.g. by measuring the mean size of every cell an its corresponding touching neighbors.

cle.mean_of_touching_neighbors_map(size_map_image, labels)
cle._ image
shape(640, 639)
dtypefloat32
size1.6 MB
min369.33334
max7611.5

We can also compute the standard deviation of size, which highlights the borders between the regions with cells of different size.

cle.standard_deviation_of_touching_neighbors_map(size_map_image, labels)
cle._ image
shape(640, 639)
dtypefloat32
size1.6 MB
min43.538486
max3917.1946