<jupyter_start><jupyter_text>Lists of nonzero pixel coordinatesWhen working with adjacency matrices (also known as touch-matrices, proximal-neighbor-matrices and n-nearest-neighbor matrices) and also with images resulting from minima and maxima detection, a common task is to retrieve lists of coordinates from a given input image where the input image contained non-zero values. In numpy, the corresponding operation is called [nonzero](https://numpy.org/doc/stable/reference/generated/numpy.nonzero.html) and in clesperanto the function [spots_to_pointlist](https://clij.github.io/clij2-docs/reference_spotsToPointList) does the same. `spots_to_pointlist` assumes a binary image as input which only contains `1` and `0` though.**Note**: A major difference between numpy and clesperanto becomes apparent in this case: clesperanto's dimension ordering/naming is different: While `np.nonzero` returns this list of coordinates:```[[y0,y1,y2],[x0,x1,x2]]```clesperanto will return this list:```[[x0,x1,x2],[y0,y1,y2]]```Use `cle.flip(pointlist, flip_x=False)` to convert a `pointlist` retrieved from clesperanto to one that equals the list in numpy.<jupyter_code>import numpy as np
import pyclesperanto_prototype as cle

cle.get_device()<jupyter_output><empty_output><jupyter_text>2D case<jupyter_code>label_image = np.asarray([
    [1,0,0,1],
    [0,0,1,0],
    [0,1,0,0]
])
print(label_image)
label_image.nonzero()
cl_label_image = cle.push(label_image)
print(cl_label_image)
cle.spots_to_pointlist(cl_label_image)
cle.flip(cle.spots_to_pointlist(cl_label_image), flip_x=True)<jupyter_output><empty_output><jupyter_text>3D case<jupyter_code>label_image = np.asarray([[
        [1,0,0,1],
        [0,0,1,0],
        [0,1,0,0]
    ],[
        [0,0,0,0],
        [0,1,0,0],
        [0,0,0,0]
]])
print(label_image)
label_image.nonzero()
cl_label_image = cle.push(label_image)
print(cl_label_image)
cle.spots_to_pointlist(cl_label_image)
cle.flip(cle.spots_to_pointlist(cl_label_image), flip_x=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12148148148148148, 'fraction_numerical': 0.02617283950617284, 'mean_word_length': 6.340579710144928, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '205726', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 737, 'n_tokens_neox': 709, 'n_words': 161, 'path': 'demo/basics/nonzero.ipynb', 'repo_name': 'cavenel/pyclesperanto_prototype', 'size': '2025'}