Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DeconWithGrid.groovy #37

Merged
merged 2 commits into from
Feb 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,46 +1,39 @@
#@ OpService ops
#@ UIService ui
#@ ConvertService convert
#@ DatasetService data

import net.imglib2.type.numeric.real.FloatType;
import net.imagej.ops.Op
import net.imglib2.outofbounds.OutOfBoundsConstantValueFactory
import net.imagej.ops.deconvolve.RichardsonLucyF
import net.imglib2.util.Util

// create the sample image
base = ops.run("create.img", [150, 100], new FloatType())
formula = "p[0]^2 * p[1]"
ops.image().equation(base, formula)

ui.show(base);
ui.show("input image", base);

// create kernel
kernel_small = ops.run("create.img", [3,3], new FloatType())
kernel_big = ops.run("create.img", [20,20], new FloatType())

ops.image().equation(kernel_small, "p[0]")
ops.image().equation(kernel_big, "p[0]")

// convolve with large and small kernel
convolved_small = ops.filter().convolve(base, kernel_small)
// convolve with large kernel
convolved_big = ops.filter().convolve(base, kernel_big)

ui.show(convolved_small);
ui.show(convolved_big);
ui.show("convolved", convolved_big);

base_deconvolved = ops.run(RichardsonLucyF.class, convolved_small, kernel_small, null, new OutOfBoundsConstantValueFactory<>(Util.getTypeFromInterval(kernel_small).createVariable()), 10)
// deconvolve with Richardson Lucy
base_deconvolved_big=ops.create().img(convolved_big, new FloatType())
base_deconvolved_big = ops.deconvolve().richardsonLucy(base_deconvolved_big, convolved_big, kernel_big, null, new OutOfBoundsConstantValueFactory<>(Util.getTypeFromInterval(kernel_big).createVariable()), 10)

// 50 iterations richardson lucy
base_deconvolved_big = ops.run(RichardsonLucyF.class, convolved_big, kernel_big, 50);
// deconvolve with non-circulant Richardson Lucy
base_deconvolved_big_noncirc=ops.create().img(convolved_big, new FloatType())
base_deconvolved_big_noncirc = ops.deconvolve().richardsonLucy(base_deconvolved_big_noncirc, convolved_big, kernel_big, null, null, null, null, null, 50, true, false)

// 50 iterations non-circulant richardson lucy
base_deconvolved_big_noncirc = ops.run(RichardsonLucyF.class, convolved_big, kernel_big, null, null,null, null, null,50,true,false );

// 50 iterations non-circulant accelerated richardson lucy
base_deconvolved_big_acc_noncirc = ops.run(RichardsonLucyF.class, convolved_big, kernel_big, null, null,null, null, null, 50, true, true)
// deconvolve with accelerated non-circulalant Richardson LUcy
base_deconvolved_big_acc_noncirc=ops.create().img(convolved_big, new FloatType())
base_deconvolved_big_acc_noncirc = ops.deconvolve().richardsonLucy(base_deconvolved_big_acc_noncirc, convolved_big, kernel_big, null, null, null, null, null, 50, true, true)

ui.show("RL",base_deconvolved_big)
ui.show("RLNon-Circ",base_deconvolved_big_noncirc)
ui.show("RL Acc/Non-Circ",base_deconvolved_big_acc_noncirc)
ui.show("RL Acc/Non-Circ",base_deconvolved_big_acc_noncirc)
Loading