I have a sequence of labels in a 3D layer that the user needs to inspect. The idea is to pass this sequence to the viewer and when the user presses a key the viewer selects this label and displays a z-slice containing the label. I understand I have to use the decorator @viewer.bind_key but I don’t find what method to call in order to select the particular label and to display the particular z-slice. Could you please give me a few pointers?
Hi @aseedb sorry for the delay in reply.
I’m not quite sure what you mean by the “sequence of labels” and how you want to select one, maybe you could add a screenshot/ movie or code snippet and that would help.
You might find some of what you need in the
viewer.dims.point napari.components.Dims - napari, which contains the index of the currently viewer slice
@viewer.bind_key('z') def print_z_slice(viewer): print(viewer.dims.point)