From 76f4644d3e2fc202056e55663f0596467d535d1b Mon Sep 17 00:00:00 2001 From: andmccall <56968719+andmccall@users.noreply.github.com> Date: Fri, 9 Feb 2024 09:48:38 -0500 Subject: [PATCH 1/2] Update DeconWithGrid.groovy Was looking at the groovy example scripts and noticed this one didn't work. Looks like RichardsonLucyF changed to RicahdrsonLucyC at some point --- .../Deconvolution/DeconWithGrid.groovy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/resources/script_templates/Deconvolution/DeconWithGrid.groovy b/src/main/resources/script_templates/Deconvolution/DeconWithGrid.groovy index 601f91b..0d764bb 100644 --- a/src/main/resources/script_templates/Deconvolution/DeconWithGrid.groovy +++ b/src/main/resources/script_templates/Deconvolution/DeconWithGrid.groovy @@ -6,7 +6,7 @@ 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.imagej.ops.deconvolve.RichardsonLucyC import net.imglib2.util.Util // create the sample image @@ -30,17 +30,17 @@ convolved_big = ops.filter().convolve(base, kernel_big) ui.show(convolved_small); ui.show(convolved_big); -base_deconvolved = ops.run(RichardsonLucyF.class, convolved_small, kernel_small, null, new OutOfBoundsConstantValueFactory<>(Util.getTypeFromInterval(kernel_small).createVariable()), 10) +base_deconvolved = ops.run(RichardsonLucyC.class, convolved_small, kernel_small, null, new OutOfBoundsConstantValueFactory<>(Util.getTypeFromInterval(kernel_small).createVariable()), 10) // 50 iterations richardson lucy -base_deconvolved_big = ops.run(RichardsonLucyF.class, convolved_big, kernel_big, 50); +base_deconvolved_big = ops.run(RichardsonLucyC.class, convolved_big, kernel_big, 50); // 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 ); +base_deconvolved_big_noncirc = ops.run(RichardsonLucyC.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) +base_deconvolved_big_acc_noncirc = ops.run(RichardsonLucyC.class, 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) \ No newline at end of file +ui.show("RL Acc/Non-Circ",base_deconvolved_big_acc_noncirc) From e2421532402b2701a5eaa4be9bee8ae199ac6221 Mon Sep 17 00:00:00 2001 From: andmccall <56968719+andmccall@users.noreply.github.com> Date: Wed, 14 Feb 2024 11:42:34 -0500 Subject: [PATCH 2/2] Update DeconWithGrid.groovy Brian's much improved version. I also went through and removed some of the now unnecessary parameters and libraries --- .../Deconvolution/DeconWithGrid.groovy | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/main/resources/script_templates/Deconvolution/DeconWithGrid.groovy b/src/main/resources/script_templates/Deconvolution/DeconWithGrid.groovy index 0d764bb..fc33fcd 100644 --- a/src/main/resources/script_templates/Deconvolution/DeconWithGrid.groovy +++ b/src/main/resources/script_templates/Deconvolution/DeconWithGrid.groovy @@ -1,12 +1,8 @@ #@ 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.RichardsonLucyC import net.imglib2.util.Util // create the sample image @@ -14,32 +10,29 @@ 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(RichardsonLucyC.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(RichardsonLucyC.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(RichardsonLucyC.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(RichardsonLucyC.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)