<jupyter_start><jupyter_text>Count proximal labels in an other label image<jupyter_code>import numpy as np
import pyclesperanto_prototype as cle

cle.get_device()<jupyter_output><empty_output><jupyter_text>Our starting point is a label image and another label image, where some of the labels in the first image are selected from.<jupyter_code>label_image = cle.artificial_tissue_2d()
cle.imshow(label_image, labels=True)
random_vector = np.random.random((1, int(label_image.max() + 1)))
sparse_labels = cle.exclude_labels_with_values_out_of_range(random_vector, label_image, minimum_value_range=0, maximum_value_range=0.3)
cle.imshow(sparse_labels, labels=True)<jupyter_output><empty_output><jupyter_text>We now count for every label in `label_image`, how many labels are proximal to it in the `sparse_labels` image. For measuring the distance, we use the centroid distance.<jupyter_code>count_map = cle.proximal_other_labels_count_map(label_image, sparse_labels, maximum_distance=25)
cle.imshow(count_map)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08397683397683398, 'fraction_numerical': 0.007722007722007722, 'mean_word_length': 9.067961165048544, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, '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': '243843', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 350, 'n_tokens_neox': 339, 'n_words': 83, 'path': 'docs/25_neighborhood_relationships_between_cells/other_proximal_labels_count.ipynb', 'repo_name': 'rayanirban/BioImageAnalysisNotebooks', 'size': '1036'}