Use the open image for variable


I very beginner with Napari and python and maybe it’s stupide question…
I drag and drop one image to napari and I woukd like to use this image to do the analyse.
with FIJI we can use title=gettitle… it’s simple but with python I have no Idee.
maybe is not good way? or not possible or stupide!

thank you

There are no stupid questions! :blush:

You can get a list of images in viewer.layers. If you want the topmost/only layer, you do layer = viewer.layers[-1], then you can do image =, which will be either a NumPy array or Dask array, depending on which plugin loaded the image. You can also get the layer by name, layer = viewer.layers['(layer name)']. When you drag and drop this will be the filename, though you can also rename by clicking on the label name.

I hope this helps!

1 Like

I am less and less stupid in front of python thanks to you