This package provides a python wrapper and convenience functions for
cudaDeconv, which is a CUDA/C++
implementation of an accelerated Richardson Lucy Deconvolution
cudaDeconv was originally
written by Lin Shao and modified by Dan Milkie, at Janelia Research campus. This package
makes use of a shared library interface that I wrote for cudaDecon while
developing LLSpy, that adds a couple
additional kernels for affine transformations and camera corrections.
CUDA accelerated deconvolution with a handful of artifact-reducing features.
radially averaged OTF generation with interpolation for voxel size independence between PSF and data volumes
3D deskew, rotation, general affine transformations
CUDA-based camera-correction for sCMOS artifact correction
Install (Linux and Windows) from conda forge:
conda install -c conda-forge pycudadecon
see GPU requirements in Installation.
If you have a PSF and an image volume and you just want to get started, check
pycudadecon.decon() function, which should be able to handle most
from pycudadecon import decon image_path = '/path/to/some_image.tif' psf_path = '/path/to/psf_3D.tif' result = decon(image_path, psf_path)
For finer-tuned control, you may wish to make an OTF file from your PSF using
make_otf(), and then use the
context manager to setup the GPU for use with the
function. (Note all images processed in the same context must have the same
from pycudadecon import RLContext, rl_decon from glob import glob import tifffile image_folder = '/path/to/some_images/' imlist = glob(image_folder + '*488*.tif') otf_path = '/path/to/pregenerated_otf.tif' with tifffile.TiffFile(imlist) as tf: imshape = tf.series.shape with RLContext(imshape, otf_path, dz) as ctx: for impath in imlist: image = tifffile.imread(impath) result = rl_decon(image, output_shape=ctx.out_shape) # do something with result...
If you have a 3D PSF volume, the
manager facilitates temporary OTF generation…
# continuing with the variables from the previous example... psf_path = "/path/to/psf_3D.tif" with TemporaryOTF(psf) as otf: with RLContext(imshape, otf.path, dz) as ctx: for impath in imlist: image = tifffile.imread(impath) result = rl_decon(image, output_shape=ctx.out_shape) # do something with result...
… and that bit of code is essentially what the
function is doing, with a little bit of additional conveniences added in.
Each of these functions has many options and accepts multiple keyword arguments. For further information, see the documentation for the respective functions.