I am trying to understand how Napari works with Pyramid images, as well as zarr files. I have the following understanding, is it correct?:
Pyramid images (stored as a .zarr file):
When I execute viewer.add_image(‘example_pyramid.zarr’, multiscale=True), Napari first inspect the current size of the viewer, and then, based on the current size, it decides which level of the pyramid to load (for example, it could decide to load the lowest resolution of the pyramid first), and proceed to load all the “chunks” of the zarr file that corresponds to the selected pyramid level.
Once it finishes loading and visualizing the selected level of the pyramid, it waits for some user interaction. If the user zooms-in, Napari computes the new view_port and determines which region of the image the user wants to see, and based on that result, it only loads/visualize the required “chunks” of the zarr file.
If the user does a lot of zoom-in/out, does Napari cache the results?, or does it always load all the “chunks” according to the zoom level, even if the user already visited a previous zoom level?
According to the documentation, Napari uses VisPy for rendering the images. Therefore, every time the user zoom-in/out in a particular region of the image, Napari load the corresponding “chunks” and send the data to the GPU, am I right?..does this mean there is a lot of communication back-and-forth between the CPU and GPU?.
Image stored as a zarr file
- Let’s say I have a big image store as a zarr file (only the image in high resolution, without any pyramid data). If I call viewer.add_image(‘example_high_resolution.zarr’, multiscale=False), Napari would see that the image is big, it would throw a warning saying “UserWarning: data shape (26752, 10240) exceeds GL_MAX_TEXTURE_SIZE 8192 in at least one axis and will be downsampled.
Rendering is currently in 2D mode.”…Does this mean Napari will compute the pyramid images and it will visualize instead one of the lower levels of the pyramid?
Thank you very much for all your help, and please excuse me for asking so many question , I really like the project and I would like to understand its inner working so that I can start contributing to it in the near future