Skip to content

Content-adaptive storage and processing of large volumetric microscopy data using the Adaptive Particle Representation (APR)

License

Notifications You must be signed in to change notification settings

AdaptiveParticles/pyapr

Repository files navigation

pyapr

build and deploy codecov License Python Version PyPI Downloads DOI

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
pixels.png apr.png
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

# 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)

apr_file.png

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)

view_apr.png

The View Level toggle allows you to see the adaptation (brighter = higher resolution).

view_level.png

Or view the result in 3D using APR-native maximum intensity projection raycast (cpu).

# launch raycast viewer
pyapr.viewer.raycast_viewer(apr, parts)

raycast.png

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!