A multi-dimensional, high performance deconvolution framework written in Julia Lang for CPUs and GPUs.
42 Stars
Updated Last
5 Months Ago
Started In
May 2020


A package for microscopy image based deconvolution via Optim.jl. This package works with N dimensional Point Spread Functions and images. The package was created with microscopy in mind but since the code base is quite general it is possible to deconvolve different kernels as well.
Documentation Build Status Code Coverage


Type ]in the REPL to get to the package manager:

julia> ] add DeconvOptim


The documentation of the latest release is here. The documentation of current master is here. For a quick introduction you can also watch the presentation at the JuliaCon 2021.


A quick example is shown below.

using DeconvOptim, TestImages, Colors, ImageIO, Noise, ImageShow

# load test image
img = Float32.(testimage("resolution_test_512"))

# generate simple Point Spread Function of aperture radius 30
psf = Float32.(generate_psf(size(img), 30))

# create a blurred, noisy version of that image
img_b = conv(img, psf)
img_n = poisson(img_b, 300)

# deconvolve 2D with default options
@time res, o = deconvolution(img_n, psf)

# deconvolve 2D with no regularizer
@time res_no_reg, o = deconvolution(img_n, psf, regularizer=nothing)

# show final results next to original and blurred version
Gray.([img img_n res])

Results Quick Example


Have a quick look into the examples folder. We demonstrate the effect of different regularizers. There is also a CUDA example. Using regularizers together with a CUDA GPU is faster but unfortunately only a factor of ~5-10. For 3D the speed-up is larger.


For CUDA we only provide a Total variation regularizer via TV_cuda. The reason is that Tullio.jl is currently not very fast with CuArrays and especially the derivative of such functions.

Performance Tips


The regularizers are generated with metaprogramming when TV() (or any other regularizer) is called. To prevent that the code compile every time again, define the regularizer once and use it multiple times without newly defining it:

reg = TV()

And in the new cell then use:

res, o = deconvolution(img_n, psf, regularizer=reg)


Feel free to file an issue regarding problems, suggestions or improvement ideas for this package! We would be happy to deconvolve real data! File an issue if we can help deconvolving an image/stack. We would be also excited to adapt DeconvOptim.jl to your special needs!


I would like to thank Rainer Heintzmann for the great support and discussions during development. Furthermore without Tullio.jl and @mcabbott this package wouldn't be as fast as it is. His package and ideas are the basis for the implementations of the regularizers.

Related Packages

  • ThreeDeconv: works great, CPU performance is much slower, GPU performance is slower
  • Deconvolution.jl: rather simple package with Wiener and Lucy Richardson deconvolution.