Skip to content

apsk14/rdmpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linear Revolution-Invariance: Modeling and Deblurring Spatially-Varying Imaging Systems

Paper

UPDATES:

  • [April 18th 2023] Updated to LRI v3! Changes include...
    • Fixed LRI scaling issues.
    • Added padded_lsi for true linear convolutions.
    • Added full_deblur which implements the full linear blur (no assumptions) with every PSF.

Background

Official implementation of Linear Revolution-Invariant modeling and deblurring.

LRI forward modeling allows one to compute the output of any rotationally symmetric imaging system given only a few of its PSFs or its Seidel aberration coefficients. Simiarly, LRI deblurring offers a fast and more accurate alternative to deconvolution (e.g., Wiener filter, Richardson-Lucy) by accounting for radially-varying blur. LRI deblurring only requires a single calibration image of a few randomly scattered PSFs. This repository implements both LRI forward modeling and LRI deblurring via two functions blur and deblur.

This repository is still in early stages and will constantly be updated with new functionality and bug-fixes. In light of this please run a git pull before every use. It will soon be a PyPI package directly installable with pip.

Useage

For a quick example of the basic utility of this package please see simple_example.ipynb. For a more in-depth overview and some real-life data see example.ipynb. For full documentation of each function see functions.py.

There are 4 main functions of interest in this package. They can all be found in functions.py. Each function can be run using the LRI (linear revolution invariant) or LSI (linear shift-invariant) assumption. This is specified by the model parameter which is either 'lri' or 'lsi'

1) blind_deblur

If no PSFs are available, one can simply pass their blurry image into blind_deblur to get a deblurred estimate.

deblurred_image, psf_estimate, seidel_coeffs = blind_deblur(blurred_image)

and that's it!!

2) calibrate

Here we pass in either a calibration image such as test_images/calibration_image.tif or Seidel aberration coefficients (i.e., [sphere, astigmatism, coma, field curvature, distortion]). We get back a stack of the rotational fourier transforms (see paper appendix E) of PSFs along a radial line and the Seidel coefficients.

seidel_coeffs, psf_stack = calibrate(calib_image, model, dim, seidel_coeffs=None)

3a) blur

With PSFs in hand we can simulate the blurring of an imaging system using the LRI forward model. We simply pass in a test object such as test_images/baboon.png and our PSF stack obtained from the calibration step.

blurred_image = blur(object, psf_stack, model)

3b) deblur

Alternatively we can choose to invert the LRI forward model to instead perform image deblurring. Again we only need the PSF stack from step 1 in addition to the blurry image we would like to deblur.

deblurred_image = deblur(blurred_image, psf_stack, model)

The necessary packages to run this code are:

  • numpy
  • pytorch
  • scipy
  • skimage
  • PIL
  • cv2
  • matplotlib
  • tqdm

Contact

Please reach out to apkohli@berkeley.edu with any questions or concerns!

About

Official implementation of Ring Deconvolution Microscopy from https://arxiv.org/abs/2206.08928

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages