|
1 | 1 | #@ OpService ops |
2 | 2 | #@ UIService ui |
3 | | -#@ ConvertService convert |
4 | | -#@ DatasetService data |
5 | 3 |
|
6 | 4 | import net.imglib2.type.numeric.real.FloatType; |
7 | | -import net.imagej.ops.Op |
8 | 5 | import net.imglib2.outofbounds.OutOfBoundsConstantValueFactory |
9 | | -import net.imagej.ops.deconvolve.RichardsonLucyC |
10 | 6 | import net.imglib2.util.Util |
11 | 7 |
|
12 | 8 | // create the sample image |
13 | 9 | base = ops.run("create.img", [150, 100], new FloatType()) |
14 | 10 | formula = "p[0]^2 * p[1]" |
15 | 11 | ops.image().equation(base, formula) |
16 | 12 |
|
17 | | -ui.show(base); |
| 13 | +ui.show("input image", base); |
18 | 14 |
|
19 | 15 | // create kernel |
20 | | -kernel_small = ops.run("create.img", [3,3], new FloatType()) |
21 | 16 | kernel_big = ops.run("create.img", [20,20], new FloatType()) |
22 | 17 |
|
23 | | -ops.image().equation(kernel_small, "p[0]") |
24 | 18 | ops.image().equation(kernel_big, "p[0]") |
25 | 19 |
|
26 | | -// convolve with large and small kernel |
27 | | -convolved_small = ops.filter().convolve(base, kernel_small) |
| 20 | +// convolve with large kernel |
28 | 21 | convolved_big = ops.filter().convolve(base, kernel_big) |
29 | 22 |
|
30 | | -ui.show(convolved_small); |
31 | | -ui.show(convolved_big); |
| 23 | +ui.show("convolved", convolved_big); |
32 | 24 |
|
33 | | -base_deconvolved = ops.run(RichardsonLucyC.class, convolved_small, kernel_small, null, new OutOfBoundsConstantValueFactory<>(Util.getTypeFromInterval(kernel_small).createVariable()), 10) |
| 25 | +// deconvolve with Richardson Lucy |
| 26 | +base_deconvolved_big=ops.create().img(convolved_big, new FloatType()) |
| 27 | +base_deconvolved_big = ops.deconvolve().richardsonLucy(base_deconvolved_big, convolved_big, kernel_big, null, new OutOfBoundsConstantValueFactory<>(Util.getTypeFromInterval(kernel_big).createVariable()), 10) |
34 | 28 |
|
35 | | -// 50 iterations richardson lucy |
36 | | -base_deconvolved_big = ops.run(RichardsonLucyC.class, convolved_big, kernel_big, 50); |
| 29 | +// deconvolve with non-circulant Richardson Lucy |
| 30 | +base_deconvolved_big_noncirc=ops.create().img(convolved_big, new FloatType()) |
| 31 | +base_deconvolved_big_noncirc = ops.deconvolve().richardsonLucy(base_deconvolved_big_noncirc, convolved_big, kernel_big, null, null, null, null, null, 50, true, false) |
37 | 32 |
|
38 | | -// 50 iterations non-circulant richardson lucy |
39 | | -base_deconvolved_big_noncirc = ops.run(RichardsonLucyC.class, convolved_big, kernel_big, null, null,null, null, null,50,true,false ); |
40 | | - |
41 | | -// 50 iterations non-circulant accelerated richardson lucy |
42 | | -base_deconvolved_big_acc_noncirc = ops.run(RichardsonLucyC.class, convolved_big, kernel_big, null, null,null, null, null, 50, true, true) |
| 33 | +// deconvolve with accelerated non-circulalant Richardson LUcy |
| 34 | +base_deconvolved_big_acc_noncirc=ops.create().img(convolved_big, new FloatType()) |
| 35 | +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) |
43 | 36 |
|
44 | 37 | ui.show("RL",base_deconvolved_big) |
45 | 38 | ui.show("RLNon-Circ",base_deconvolved_big_noncirc) |
|
0 commit comments