A simple plugin to create and view APR images in napari
To get started, open an image of your choice (2D or 3D grayscale) in napari and open the convert_image_to_apr
panel. Select the image layer to convert, an appropriate data type, and hit Run
.
Note: choosing a data type smaller than the input type may lead to overflow and thus erroneous results.
Conversion parameters can often be left to their default values, thanks to the automatic parameter tuning. For very noisy images, it is sometimes useful to increase the smoothing
parameter. In order to get a more (or less) aggressive adaptation, change the relative error
parameter.
To save the result to file, simply save the newly created layer using the File
menu. We use the extension .apr
, although the file is actually written in hdf5
format (and can be opened/explored as such). In this example, the APR is roughly 80 times smaller than the original image on disk. APR files can be opened directly in napari, e.g. by drag and drop.
To better understand the workings of the APR on your data, you can use the APR Viewer
panel to change the View mode
for a selected APR layer to level
. This shows you a visualization of the adaptive resolution. Particles in the brightest regions correspond exactly to pixels (lossless), while each shade darker corresponds to downsampling by a factor of 2 in each dimension.
The Downsample
slider can be used to reduce the resolution of the displayed data for the selected layer. This can be used to explore large volumes in 3D, where rendering the full data requires too much memory.
Note: We do not offer APR-native rendering at this time, so this step will reconstruct the entire pixel volume (at the selected resolution). Thus, for large volumes, be sure to increase the downsampling before toggling the 3D viewer.
The data shown in these examples was taken from the Platynereis-ISH-Nuclei-CBG dataset available here.
This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template.
You can install napari-apr-viewer
via pip:
pip install napari-apr-viewer
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
Distributed under the terms of the Apache Software License 2.0 license, "napari-apr-viewer" is free and open source software
If you encounter any problems, please file an issue along with a detailed description.