pyapr
Documentation can be found here.
Content-adaptive storage and processing of large volumetric microscopy data using the Adaptive Particle Representation (APR).
The APR is an adaptive image representation designed primarily for large 3D fluorescence microscopy datasets. By replacing pixels with particles positioned according to the image content, it enables orders-of-magnitude compression of sparse image data while maintaining image quality. However, unlike most compression formats, the APR can be used directly in a wide range of processing tasks - even on the GPU!
Pixels | APR |
---|
| |
Uniform sampling | Adaptive sampling |
image source,
illustration source
For more detailed information about the APR and its use, see:
pyapr is built on top of the C++ library LibAPR using pybind11.
Quick start guide
Convert images to APR using minimal amounts of code (see get_apr_demo and get_apr_interactive_demo for additional options).
import pyapr
from skimage import io
img = io.imread('my_image.tif')
apr, parts = pyapr.converter.get_apr(img)
pyapr.io.write('my_image.apr', apr, parts)
To return to the pixel representation:
img = pyapr.reconstruction.reconstruct_constant(apr, parts)
Inspect APRs using our makeshift image viewers (see napari-apr-viewer for less experimental visualization options).
apr, parts = pyapr.io.read('my_image.apr')
pyapr.viewer.parts_viewer(apr, parts)
The View Level
toggle allows you to see the adaptation (brighter = higher resolution).
Or view the result in 3D using APR-native maximum intensity projection raycast (cpu).
pyapr.viewer.raycast_viewer(apr, parts)
See the demo scripts for more examples.
Installation
For Windows 10, OSX, and Linux direct installation with OpenMP support should work via pip:
pip install pyapr
Note: Due to the use of OpenMP, it is encouraged to install as part of a virtualenv.
See INSTALL for manual build instructions.
License
pyapr is distributed under the terms of the Apache Software License 2.0.
Issues
If you encounter any problems, please file an issue with a short description.
Contact us
If you have a project or algorithm in which you would like to try using the APR, don't hesitate to get
in touch with us. We would be happy to assist you!