{"name":"bbii-decon","display_name":"bbii-decon","visibility":"public","icon":"","categories":[],"schema_version":"0.2.0","on_activate":null,"on_deactivate":null,"contributions":{"commands":[{"id":"bbii-decon.napari_experimental_provide_function","title":"bbii_deconvolution","python_name":"bbii_decon:napari_experimental_provide_function","short_title":null,"category":null,"icon":null,"enablement":null}],"readers":null,"writers":null,"widgets":[{"command":"bbii-decon.napari_experimental_provide_function","display_name":"bbii_deconvolution","autogenerate":true}],"sample_data":null,"themes":null,"menus":{},"submenus":null,"keybindings":null,"configuration":[]},"package_metadata":{"metadata_version":"2.1","name":"bbii-decon","version":"0.0.1","dynamic":null,"platform":["UNKNOWN"],"supported_platform":null,"summary":"Projected Barzilai-Borwein Image Deconvolution with Infeasible Iterates (BBii-Decon)","description":"# BBii-Decon\n\n[![License](https://img.shields.io/pypi/l/bbii-decon.svg?color=green)](https://github.com/gdellaire/bbii-decon/raw/main/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/bbii-decon.svg?color=green)](https://pypi.org/project/bbii-decon)\n[![Python Version](https://img.shields.io/pypi/pyversions/bbii-decon.svg?color=green)](https://python.org)\n[![tests](https://github.com/gdellaire/bbii-decon/workflows/tests/badge.svg)](https://github.com/gdellaire/bbii-decon/actions)\n[![codecov](https://codecov.io/gh/gdellaire/bbii-decon/branch/main/graph/badge.svg)](https://codecov.io/gh/gdellaire/bbii-decon)\n[![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/bbii-decon)](https://napari-hub.org/plugins/bbii-decon)\n\nProjected Barzilai-Borwein Image Deconvolution with Infeasible Iterates (BBii-Decon)\n\n\nThe 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). \n\nThe 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.\n\nThe 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.\n\n### GPU-acceleration\n\nFor 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). \n\nThis plugin supports accelerated processing using the [cupy](https://cupy.dev) library. To make use of it, please follow \n[the instructions](https://docs.cupy.dev/en/stable/install.html#installing-cupy-from-conda-forge) to install cupy. \nInstallation may look like this:\n```\nconda create --name cupy_p38 python=3.8\nconda activate cupy_p38\nconda install -c conda-forge cupy cudatoolkit=10.2\n```\n\nIf cupy installation worked out, you will find another checkbox in the user interface. By activating it, processing \nshould become faster by factor 5-10, depending on processed image data and use GPU hardware.\n\n![img.png](https://github.com/gdellaire/BBii-Decon/raw/main/demo/use_GPU_checkbox.png)\n\n## Usage - napari\n\nYou can use the BBii deconvolution from within napari by clicking the menu `Plugins > bbii-decon > bbii deconvolution`. \nIn the dialog, select the PSF, the image to process (a) and click on `Run`. After a moment, the deconvolved image (b) \nwill show up.\n\n![img.png](https://github.com/gdellaire/BBii-Decon/raw/main/demo/screenshot_napari.png)\n\n## Usage from python\n\nYou can also call the function from python. There is a full working example in [this notebook](demo/BBii_Decon_2D_2021.ipynb).\n\n```\nfrom bbii_decon import bbii\n\nbbii(PSF, image, number_of_iterations = 15, tau = 1.0e-08, rho = 0.98)\n```\n\n\n## Citation\n1) [Kathleen Fraser, Dirk V. Arnold, and Graham Dellaire (2014). Projected Barzilai-Borwein\nmethod with infeasible iterates for nonnegative least-squares image deblurring. In Proceedings\nof the Eleventh Conference on Computer and Robot Vision (CRV 2014), Montreal, Canada, pp.\n189--194.](https://ieeexplore.ieee.org/abstract/document/6816842)\n\n----------------------------------\n\nThis [napari] plugin was generated with [Cookiecutter] using [@napari]'s [cookiecutter-napari-plugin] template.\n\n\n\n## Installation\n\nYou can install `bbii-decon` via [pip]:\n\n pip install bbii-decon\n\n\n## Installation for developers\n\nClone the github repository:\n\n```\nconda install git\n\ngit clone https://github.com/gdellaire/BBii-Decon.git\n\ncd BBii-Decon\n\npip install -e .\n```\n\n## Deployment to pypi\n\nFor deploying the plugin to the python package index (pypi), one needs a [pypi user account](https://pypi.org/account/register/) \nfirst. For deploying the plugin to pypi, one needs to install some tools:\n\n```\npython -m pip install --user --upgrade setuptools wheel\npython -m pip install --user --upgrade twine\n```\n\nThe 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:\n\n```\npython setup.py sdist bdist_wheel\n```\n\nThis command ships the just generated to pypi:\n\n```\npython -m twine upload --repository pypi dist/*\n```\n\n[Read more about distributing your python package via pypi](https://realpython.com/pypi-publish-python-package/#publishing-to-pypi).\n\n\n## Contributing\n\nContributions are very welcome. Tests can be run with [tox], please ensure\nthe coverage at least stays the same before you submit a pull request.\n\n## License\n\nDistributed under the terms of the [BSD-3] license,\n\"bbii-decon\" is free and open source software\n\n## Issues\n\nIf you encounter any problems, please [file an issue] along with a detailed description.\n\n[napari]: https://github.com/napari/napari\n[Cookiecutter]: https://github.com/audreyr/cookiecutter\n[@napari]: https://github.com/napari\n[MIT]: http://opensource.org/licenses/MIT\n[BSD-3]: http://opensource.org/licenses/BSD-3-Clause\n[GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt\n[GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt\n[Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0\n[Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt\n[cookiecutter-napari-plugin]: https://github.com/napari/cookiecutter-napari-plugin\n\n[file an issue]: https://github.com/gdellaire/bbii-decon/issues\n\n[napari]: https://github.com/napari/napari\n[tox]: https://tox.readthedocs.io/en/latest/\n[pip]: https://pypi.org/project/pip/\n[PyPI]: https://pypi.org/\n\n\n","description_content_type":"text/markdown","keywords":null,"home_page":"https://github.com/gdellaire/bbii-decon","download_url":null,"author":"Graham Dellaire, Robert Haase","author_email":"dellaire@Dal.Ca","maintainer":null,"maintainer_email":null,"license":"BSD-3-Clause","classifier":["Development Status :: 2 - Pre-Alpha","Intended Audience :: Developers","Framework :: napari","Topic :: Software Development :: Testing","Programming Language :: Python","Programming Language :: Python :: 3","Programming Language :: Python :: 3.7","Programming Language :: Python :: 3.8","Programming Language :: Python :: 3.9","Operating System :: OS Independent","License :: OSI Approved :: BSD License"],"requires_dist":["napari-plugin-engine (>=0.1.4)","numpy","pypher"],"requires_python":">=3.7","requires_external":null,"project_url":["Bug Tracker, https://github.com/gdellaire/bbii-decon/issues","Documentation, https://github.com/gdellaire/bbii-decon#README.md","Source Code, https://github.com/gdellaire/bbii-decon","User Support, https://github.com/gdellaire/bbii-decon/issues"],"provides_extra":null,"provides_dist":null,"obsoletes_dist":null},"npe1_shim":true}