Fast Richardson-Lucy deconvolution of 3D volume data using GPU or CPU with napari plugin.
Project description
Red lionfish (RL) deconvolution
Richardson-Lucy deconvolution for fishes, scientists and engineers.
Richardson-Lucy is an iterative deconvolution algorithm that is useful for removing point spread function (PSF) or optical transfer function artifacts in experimental images.
The method was originally developed for astronomy, to remove optical effects and simultaneously reduce poisson noise in 2D images.
It has a version that runs on CPU and another that runs on GPU using OpenCL through Reikna library. By default it uses the GPU OpenCL version. If data is too big for doing GPU deconvolution, it will do the calculation in blocks, therefore preventing memory issues.
Installation
It is strongly recommended to install this package under a python anaconda or miniconda environment. This is because some calculations use PyOpenCL, and this is best installed in a conda environment.
conda install reikna pyopencl -c conda-forge
pip install redlionfish
In Linux , the package ocl-icd-system
is also useful.
conda install reikna pyopencl ocl-icd-system -c conda-forge
pip install redlionfish
Napari plugin
If you follow the installation instructions above, and install the napari in the same conda environment then the plugin should be immediately available in the Menu -> Plugins -> RedLionfish.
Alternatively, you can use the Napari's plugin installation in Menu -> Plugins -> Install/Uninstall Plugins.... If you chose to use this method, GPU acceleration will not be available and it will use the CPU backend.
Anaconda/miniconda installation
At the moment of this writting this package is NOT AVAILABLE available yet in conda-forge. This work is under progress.
Manual installation using the conda package file.
Download the appropriate conda package .bz2 at https://github.com/rosalindfranklininstitute/RedLionfish/releases
In the command line, successively run:
conda install <filename.bz2>
conda update --all -c conda-forge
The second line is needed because you are installing from a local file, conda installer will not install dependencies. Right after this you should run the update command given.
Manual installation (advanced and for developers)
Please note that in order to use OpenCL GPU accelerations, PyopenCL must be installed. The best way to get it working is to install it under a conda environment.
conda install reikna pyopencl
or
conda install reikna pyopencl ocl-icd-system -c conda-forge
(Linux)
Clone/donload from source https://github.com/rosalindfranklininstitute/RedLionfish/
and run
python setup.py install
Debug
If you want to test and modify the code then you should probably install instead using:
python setup.py develop
Coding
Please feel free to browse /test folder for examples.
In your code, add the import.
import RedLionfishDeconv
in order to use the functions.
The most useful function is perhaps the following.
def doRLDeconvolutionFromNpArrays(data_np , psf_np ,*, niter=10, method='gpu', useBlockAlgorithm=False, callbkTickFunc=None, resAsUint8 = False)
This will do the Richardson-Lucy deconvolution on the data_np (numpy, 3 dimensional data volume) using the provided PSF data volume, for 10 iterations. GPU method is generally faster but it may fail. If it does fail, the program will automatically use the CPU version from scipy.imaging.
Manually building the conda package
For this installation, ensure that the conda-build package is installed
conda install conda-build
In windows, simply execute
conda-create-package.bat
Or, execute the command-line to create the installation package for RedLionfish
conda-build --output-folder ./conda-built-packages -c conda-forge conda-recipe
and the conda package will be created in folder conda-built-packages.
Otherwise, navigate to conda-recipe
, and execute on the command-line conda build .
It will take a while to complete.
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
Built Distribution
File details
Details for the file RedLionfish-0.5.tar.gz
.
File metadata
- Download URL: RedLionfish-0.5.tar.gz
- Upload date:
- Size: 20.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2590ac98a91e0ace4d081af8a424d7f7018f48ac8fe55a176378200249d95ece |
|
MD5 | eadd48876876254e5a9e58706bea9a95 |
|
BLAKE2b-256 | 5ac4a642f9cc7ff274e0d40fbac66ab3ebf1a47b1b0e4f1bf610a5957d8a653c |
File details
Details for the file RedLionfish-0.5-py3-none-any.whl
.
File metadata
- Download URL: RedLionfish-0.5-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 396a8ea783fd1860f424748c58f92b0b76112366f1059921db1f367142adcaf8 |
|
MD5 | 44635728feb8513afffdd964da314ef1 |
|
BLAKE2b-256 | 5284c44c2fc5d02a8e793b3127ebcfbc648856a2825db77fe2c1100ea771f38a |