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:
- Adaptive particle representation of fluorescence microscopy images (nature communications)
- Parallel Discrete Convolutions on Adaptive Particle Representations of Images (IEEE Transactions on Image Processing)
pyapr is built on top of the C++ library LibAPR using pybind11.
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
# read image into numpy array
img = io.imread('my_image.tif')
# convert to APR using default settings
apr, parts = pyapr.converter.get_apr(img)
# write APR to file
pyapr.io.write('my_image.apr', apr, parts)
To return to the pixel representation:
# reconstruct pixel image
img = pyapr.reconstruction.reconstruct_constant(apr, parts)
Inspect APRs using our makeshift image viewers (see napari-apr-viewer for less experimental visualization options).
# read APR from file
apr, parts = pyapr.io.read('my_image.apr')
# launch viewer
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).
# launch raycast viewer
pyapr.viewer.raycast_viewer(apr, parts)
See the demo scripts for more examples.
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.
pyapr is distributed under the terms of the Apache Software License 2.0.
If you encounter any problems, please file an issue with a short description.
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!