Skip to content

Instantly share code, notes, and snippets.

@bnorthan
Last active December 27, 2017 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bnorthan/4f581527e080fa75b1871239e8e7ec77 to your computer and use it in GitHub Desktop.
Save bnorthan/4f581527e080fa75b1871239e8e7ec77 to your computer and use it in GitHub Desktop.
Deconvolution with theoretical PSF
public class InteractiveDeconvolveTheoreticalTest<T extends RealType<T> & NativeType<T>> {
final static ImageJ ij = new ImageJ();
public static <T extends RealType<T> & NativeType<T>> void main(final String[] args) throws IOException {
String libPathProperty = System.getProperty("java.library.path");
System.out.println("Lib path:" + libPathProperty);
ij.launch(args);
String inputName = "C:/Users/bnorthan/Dropbox/Deconvolution_Test_Set/FromJeanYves/Slide_17015-02_512_2.tif";
@SuppressWarnings("unchecked")
Img<T> img = (Img<T>) ij.dataset().open(inputName).getImgPlus().getImg();
Img<FloatType> imgF = ij.op().convert().float32(img);
// create the diffraction based image
Img<FloatType> psf = (Img) ij.op().create().kernelDiffraction(new FinalDimensions(64, 64, 50), 1.4, 550E-09,
1.3, 1.5, 162.5E-9, 280E-9, 0, new FloatType());
ij.ui().show("bars ", img);
ij.ui().show("psf", psf);
int iterations = 30;
// run Ops Richardson Lucy
Img<FloatType> deconvolved = (Img<FloatType>) ij.op().deconvolve().richardsonLucyTV(imgF, psf, null, null, null,
null, null, iterations, true, true, 0.0002f);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment