Dividing the display in the Viewer window


I recently started to work with napari, and it is amazing! I am working on some functions which allows you to easily create cell type based segmentation masks and overlay them with the .tif images for quality control.

I am quite new to Qt and UI, and I am wondering if there is a way to divide the display, so it would be possible to look at different tissue samples at the same time without opening a new Viewer (like the grid view, shown on the attached picture below). My problem is that I would like to overlay masks on each sample, without having to save them together first, so it stays interactive (e.g. to first to look at the created celltype masks on both samples next to each other, then remove them and place a new mask. I also added an example picture below).

This is my first question here, so please let me know if you need more details. Thank you for your help!

How grid view works

What I would like to achieve

1 Like

Hi @raviola-byte! You’re in luck! Sort of! =P

The grid view mode has a stride argument that is not accessible from the UI (yet), but can be accessed programmatically. You can do:


(You can do this both from your script, if that’s how you’re launching napari, or by launching the console using the button on the bottom left.)

This will overlay layers two by two, so as long as you keep the corresponding image with the corresponding mask/points, things will line up. It’s a little hacky because the layer ordering becomes super critical to not overlay non-sensical things together, but it works well, I use this quite often.

Longer term, we are working to make layers work as a tree, so that strided mode would stride the groups, but keep grouped layers together. See this issue for details.

Does this solve your problem?

1 Like

Thank you @jni!

I think this is the closet solution for what I want to achieve at the moment, so with strictly set rules it does what I want. Although it becomes a bit more manual, as the original code loads about 40 layers from a multipage .tif, to see the different marker expressions, I am pretty sure I’ll be able to find a solution with the stride argument which suit my needs. I think in the future grouping layers would be perfect.

1 Like