Skip to main content

Content-adaptive image processing using the Adaptive Particle Representation

Project description

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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pyapr-1.0.7-cp311-cp311-win_amd64.whl (3.8 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

pyapr-1.0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pyapr-1.0.7-cp311-cp311-macosx_10_9_x86_64.whl (4.4 MB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyapr-1.0.7-cp310-cp310-win_amd64.whl (3.8 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

pyapr-1.0.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pyapr-1.0.7-cp310-cp310-macosx_10_9_x86_64.whl (4.4 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyapr-1.0.7-cp39-cp39-win_amd64.whl (3.8 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

pyapr-1.0.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pyapr-1.0.7-cp39-cp39-macosx_10_9_x86_64.whl (4.4 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyapr-1.0.7-cp38-cp38-win_amd64.whl (3.8 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

pyapr-1.0.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pyapr-1.0.7-cp38-cp38-macosx_10_9_x86_64.whl (4.4 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page