Mikro-Napari
Arkitekt aims to provide first-class support for Napari, a popular image viewer for Python.
This support is provided through the mikro-napari
plugin/package that enables your local
Napari installation to communicate with Arkitekt.
About Napari
Napari (Sofroniew et al. 2022) is an open-source, multi-dimensional image viewer for Python. It has gained traction in the expert bioimage space especially because of its ability to visualize large scale, multi-dimensional images, interactively rendering 3D data with GPU acceleration. (“3rd Napari Survey Report” , Napari Developers, 2022)
A native Python solution, Napari is often integrated into Python-based analysis scripts, where analytical results need to be displayed interactively to inspect. To this end, Napari provides different types of layers for different types of data including images, points, lines, shapes. T This layered approach to data is useful for overlaying annotations or segmentations on top of image data.
Installation
Mikro-Napari provides support for Napari 0.4.17 and above. You can choose from two options:
-
Install it directly from the napari plugin store
This is the easiest way to install the plugin and works also great with napari prebundled binaries. Just follow the instructions on the plugin page, and you should be ready to go.
-
Install it directly from the command line:
If you are familiar with command line and you have napari installed in a python (Python > 3.9) environment, you can also install the plugin directly from the command line. Just run the following command:
pip install mikro-napari
pip install napari==0.4.17 pyqt5 # if you do not have napari installed yet (currently we have only tested with 0.4.17 but 0.4.18 should also work)This also allows you to start the napari application directly from the command line:
mikro-napari
As the napari plugin specifications are rapidly evolving, we currently follow the napari guidelines to recommend to install the plugin directly from the command line, and to use the unbundled version of napari (the "pip" install version.) This recommendation might change in the future.
Usage
Mikro-Napari is designed to not interfere with your exisiting Napari installation, until you explicitly connect it to your Arkitekt server. This happens through interacticting through the MagicBar (see below).
A few words about this connection process:
- The Magic Bar:
What you see in the bottom left corner is the
Magic Bar
, a widget provided by the mikro-napari plugin, and the core UI element that allows apps to connect to Arkitekt. While developers can choose to implement their own UI elements to connect to Arkitekt, the MagicBar is a common UI element that is provided by the arkitekt package, and you will encounter it in almost all apps that currently conncan connectect to Arkitekt. - The Connection screen: On initial setup you will see a screen that allows you to connect to your Arkitekt server. If you run Arkitekt locally you will see your instance automatically detected. For remote instances, advertised Instances will be automatically detected and should be listed in the dropdown menu. If your instance is not advertised, you can also enter the URL manually.
- Login in the Browser: To connect to your Arkitekt instance, you need to login. This is done in the browser, and you will be redirected to the login page of your Arkitekt instance. Please allow requests to the firewall.
Once you are connected, you can start using Arkitekt. The MagicBar will show you the current status of your connection, and of course you can always disconnect from your Arkitekt instance, and use Napari as you are used to.
How to use Napari with Arkitekt
In its current iteration the Mikro Napari Plugin does not provide any functionality to call other apps directly from Napari, this interaction is currently only possible through the Orkestrator UI. Which will help you to create workflows that include Napari. (e.g. to use deep learning models to segment your images, and then visualize the results in Napari, shown here)
Visualizing your data in Napari
To visualize your data in Napari, you can simple search for the Show on Napari
node, and reserve it in your dashboard. Once you have reserved the node,
you can run it directly from the image pane where it will appear in the bottom right corner. If you leave the "show roi layer" on, you should even see
the ROIs that you have created in the browser.
A few words about this process:
-
Lazy Loading: When calling the "Show on Napari" node, not the whole image is downloaded, but we can take the advantage of the lazy loading capabilities of both Arkitekt and Napari to only show you the visible parts.
-
ROIs: If you have created ROIs in the browser, you can also visualize them in Napari. Just make sure that you have the "Show ROI Layer" option enabled, when assigning the node. Importantly you will notice that if you mark rois on the ROI layer they are live syncing with your server and the browser, and potentially other napari instances that are connected to the same server. Neat right?
-
Alterations: Whatever alterations you make to the image in Napari, will stay in Napari. So if you want to save your alterations back to the server, you need to use the "Upload to Arkitekt" node. More on that later.