<jupyter_start><jupyter_text>Basic statistics with pyclesperantoA common use case for image processing in the biology context is deriving statistics of segmented objects. clEsperanto offers a function for that: [statistics_of_labelled_pixels](https://clij.github.io/clij2-docs/reference_statisticsOfLabelledPixels).<jupyter_code>import pyclesperanto_prototype as cle

from skimage.io import imread, imsave, imshow
import matplotlib
import numpy as np

# initialize GPU
cle.select_device("RTX")
print("Used GPU: " + cle.get_device().name)
# load data
image = imread('https://samples.fiji.sc/blobs.png')

# segment the image
labels = cle.voronoi_otsu_labeling(image, spot_sigma=3.5)
cle.imshow(labels, labels=True)<jupyter_output><empty_output><jupyter_text>Deriving basic statistics of labelled objects<jupyter_code>statistics = cle.statistics_of_labelled_pixels(image, labels)
statistics<jupyter_output><empty_output><jupyter_text>We can use [pandas](https://pandas.pydata.org/) to process that kind of tabular data.<jupyter_code>import pandas as pd
table = pd.DataFrame(statistics)
table
table.describe()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0960352422907489, 'fraction_numerical': 0.0026431718061674008, 'mean_word_length': 7.875, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '448882', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 381, 'n_tokens_neox': 370, 'n_words': 85, 'path': 'demo/basics/label_statistics.ipynb', 'repo_name': 'tlambert-forks/pyclesperanto_prototype', 'size': '1135'}