Napari/vispy does not render full field of view from zarr

I’ll begin by briefly saying thanks to all napari developers. The tool and its recent improvements (notably the visible-only layer loading) have made for some oohs and aahs at meetings in our department.

I have been working with a multiplex image dataset (single tissues labeled with up to 50 immunofluorescent stains, i.e. 50-channel images) where I have pre-processed an image pyramid for each channel into zarr format and visualize in napari 0.2.8 as follows:

# Convert pyramid to zarr
cache = Cache(3e9)  # Leverage three gigabytes of memory
cache.register()

viewer = napari.Viewer() # Using napari 0.2.8

base = imread('stain1.tiff')

pyramid = list(pyramid_gaussian(base, downscale=2, max_layer=3, multichannel=False))

file_name = 'pyramid.zarr'

zarr_root = zarr.open_group(file_name, mode='a')
for i in range(0, len(pyramid)):
    shape = pyramid[i].shape
    z = zarr_root.create_dataset(str(i), shape=shape, chunks=(300,300), dtype='float')
    z[:] = pyramid[i]
    
pyramid = [da.from_zarr(file_name + '/' + str(i)) for i in range(len(pyramid))]

viewer.add_image(pyramid, blending='additive', visible=False, is_pyramid=True)

I notice some truncation of the image when viewing the top pyramid level, as illustrated in this video: https://www.loom.com/share/468528b725db4e138eab7c3bd05144bb

I tried re-processing each channel with varying chunk sizes, e.g. (300,300), (512,512), (1000,1000), but the problem persisted.

I then tried @sofroniewn’s pathology example by first pre-processing the image into zarr format (https://github.com/sofroniewn/image-demos/blob/master/helpers/make_2D_zarr_pathology.py) then visualizing in napari (https://github.com/sofroniewn/image-demos/blob/master/examples/pathology.py) and experienced similar behavior, as illustrated in this video: https://www.loom.com/share/9a8887c2180e4e8e810c8196ef76a0e4

Notably, the pathology demo throws the following error:


…while my own use case does not.

Any insight into why this might be would be most helpful.

Thanks and all the best,

Erik

1 Like

Hmm this may relate to some of the issues described here Efficiently open qptiff images with Napari and here https://github.com/napari/napari/issues/458. I can start looking at these more as it seems like they are coming up a lot and a lot of people are trying to use our pyramid code right now

1 Like

Cheers, thanks for taking a look. Seems like the same issue.