Skip to main content

Projected Barzilai-Borwein Image Deconvolution with Infeasible Iterates (BBii-Decon)

Project description

BBii-Decon

License PyPI Python Version tests codecov napari hub

Projected Barzilai-Borwein Image Deconvolution with Infeasible Iterates (BBii-Decon)

The projected Barzilai-Borwein method of image deconvolution utilizing infeasible iterates (BBii-Decon), utilizes Barzilai-Borwein (BB) or projected BB (PBB) method and enforces a nonnegativity constraint, but allows for infeasible iterates between projections. This algorithm (BBii) results in faster convergence than the basic PBB method, while achieving better quality images, with reduced background than the unconstrained BB method (1).

The code represented is based on the original BBii algorithm written in MatLab by Kathleen Fraser and Dirk Arnold, which was ported to python 3.8 by Graham Dellaire, Dirk Arnold and Kathleen Fraser for non-commercial use.

The first implementation shown here is for 2D deconvolution using a known 2D PSF of 256 X 256 pixels, and images of at least 256 pixels in one dimension. One file implements just the deconvolution of a blurred image, while the second file contains a modification of the BBii-Decon algorithm that has a built in heuristic for measuring image reconstruction error relative to a ground truth image. For general 2D deconvolution, either a theoretical 2D PSF (if you know the optical properties of your system) or the central in focus image of a fluorescent bead taken with the same imaging setup (lens, magnification, camera) can produce a suitable PSF.

GPU-acceleration

For most 2D deconvolution, optimal results are obtained with 10 iterations of the algorithm. However, if processing takes too long, acceleration using graphics processing units (GPUs) may make sense, especially for processing larger images with >10 iterations or 3D images. (Note: At this time BBii-Decon is optimized for 2D deconvolution, with a 3D implementation planned in future).

This plugin supports accelerated processing using the cupy library. To make use of it, please follow the instructions to install cupy. Installation may look like this:

conda create --name cupy_p38 python=3.8
conda activate cupy_p38
conda install -c conda-forge cupy cudatoolkit=10.2

If cupy installation worked out, you will find another checkbox in the user interface. By activating it, processing should become faster by factor 5-10, depending on processed image data and use GPU hardware.

img.png

Usage - napari

You can use the BBii deconvolution from within napari by clicking the menu Plugins > bbii-decon > bbii deconvolution. In the dialog, select the PSF, the image to process (a) and click on Run. After a moment, the deconvolved image (b) will show up.

img.png

Usage from python

You can also call the function from python. There is a full working example in this notebook.

from bbii_decon import bbii

bbii(PSF, image, number_of_iterations = 15, tau = 1.0e-08, rho = 0.98)

Citation

  1. Kathleen Fraser, Dirk V. Arnold, and Graham Dellaire (2014). Projected Barzilai-Borwein method with infeasible iterates for nonnegative least-squares image deblurring. In Proceedings of the Eleventh Conference on Computer and Robot Vision (CRV 2014), Montreal, Canada, pp. 189--194.

This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template.

Installation

You can install bbii-decon via pip:

pip install bbii-decon

Installation for developers

Clone the github repository:

conda install git

git clone https://github.com/gdellaire/BBii-Decon.git

cd BBii-Decon

pip install -e .

Deployment to pypi

For deploying the plugin to the python package index (pypi), one needs a pypi user account first. For deploying the plugin to pypi, one needs to install some tools:

python -m pip install --user --upgrade setuptools wheel
python -m pip install --user --upgrade twine

The following command allows us to package the souce code as a python wheel. Make sure that the 'dist' and 'build' folders are deleted before doing this:

python setup.py sdist bdist_wheel

This command ships the just generated to pypi:

python -m twine upload --repository pypi dist/*

Read more about distributing your python package via pypi.

Contributing

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.

License

Distributed under the terms of the BSD-3 license, "bbii-decon" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Project details


Download files

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

Source Distribution

bbii-decon-0.0.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

bbii_decon-0.0.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file bbii-decon-0.0.1.tar.gz.

File metadata

  • Download URL: bbii-decon-0.0.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for bbii-decon-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1a15fc525f109090d76292f308c8bcbceef7fa59b200a2bbca3a6929eb75f06d
MD5 514ca18f1bd5bd991f70bf0303b2acb2
BLAKE2b-256 712964be52d2ce6d87d0ae93a5d657ed97e45a7378170c7d09719df11883cfe7

See more details on using hashes here.

File details

Details for the file bbii_decon-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: bbii_decon-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for bbii_decon-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4fcd36793df7003e7874c9aa8b018e559891a6fc1178a5d35e3975222ec9f8f2
MD5 14c409e1e6be4ef9c4c5293e6512feb8
BLAKE2b-256 b9d89384adebd498cc08a2de9c3b04f35c036e4936e0926eb47275d9e3b9b7e2

See more details on using hashes here.

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