-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from andmccall/patch-1
Update DeconWithGrid.groovy
- Loading branch information
Showing
1 changed file
with
13 additions
and
20 deletions.
There are no files selected for viewing
33 changes: 13 additions & 20 deletions
33
src/main/resources/script_templates/Deconvolution/DeconWithGrid.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |