11#@ OpService ops
22#@ UIService ui
3- #@ ConvertService convert
4- #@ DatasetService data
53
64import net.imglib2.type.numeric.real.FloatType ;
7- import net.imagej.ops.Op
85import net.imglib2.outofbounds.OutOfBoundsConstantValueFactory
9- import net.imagej.ops.deconvolve.RichardsonLucyF
106import net.imglib2.util.Util
117
128// create the sample image
139base = ops. run(" create.img" , [150 , 100 ], new FloatType ())
1410formula = " p[0]^2 * p[1]"
1511ops. image(). equation(base, formula)
1612
17- ui. show(base);
13+ ui. show(" input image " , base);
1814
1915// create kernel
20- kernel_small = ops. run(" create.img" , [3 ,3 ], new FloatType ())
2116kernel_big = ops. run(" create.img" , [20 ,20 ], new FloatType ())
2217
23- ops. image(). equation(kernel_small, " p[0]" )
2418ops. image(). equation(kernel_big, " p[0]" )
2519
26- // convolve with large and small kernel
27- convolved_small = ops. filter(). convolve(base, kernel_small)
20+ // convolve with large kernel
2821convolved_big = ops. filter(). convolve(base, kernel_big)
2922
30- ui. show(convolved_small);
31- ui. show(convolved_big);
23+ ui. show(" convolved" , convolved_big);
3224
33- base_deconvolved = ops. run(RichardsonLucyF . 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 )
3428
35- // 50 iterations richardson lucy
36- base_deconvolved_big = ops. run(RichardsonLucyF . 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 )
3732
38- // 50 iterations non-circulant richardson lucy
39- base_deconvolved_big_noncirc = ops. run(RichardsonLucyF . 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(RichardsonLucyF . 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 )
4336
4437ui. show(" RL" ,base_deconvolved_big)
4538ui. show(" RLNon-Circ" ,base_deconvolved_big_noncirc)
46- ui. show(" RL Acc/Non-Circ" ,base_deconvolved_big_acc_noncirc)
39+ ui. show(" RL Acc/Non-Circ" ,base_deconvolved_big_acc_noncirc)
0 commit comments