-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
87 lines (61 loc) · 2.37 KB
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package net.haesleinhuepf.playground.benchmarking.gauss;
import ij.IJ;
import ij.ImagePlus;
import ij.gui.NewImage;
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
import net.imagej.ImageJ;
import net.imagej.patcher.LegacyInjector;
import net.imglib2.img.Img;
import net.imglib2.img.display.imagej.ImageJFunctions;
import net.imglib2.type.numeric.real.FloatType;
import static net.haesleinhuepf.playground.benchmarking.Utlities.mse;
public class Main {
static {
LegacyInjector.preinit();
}
public static void main(final String... args) throws Exception {
new ij.ImageJ();
// Run ImageJ
final ImageJ ij = new ImageJ();
ij.ui().showUI();
for (int turn = 0; turn < 10; turn++) {
IJ.run("Close All");
// Create test data
ImagePlus imp = NewImage.createFloatImage("image", 100, 100, 10, NewImage.FILL_RANDOM);
Img<FloatType> img = ImageJFunctions.convertFloat(imp);
Object[]
imglibParameters =
new Object[]{"currentData",
img,
"sigma",
2};
Object[]
legacyParameters =
new Object[]{"currentData",
imp,
"sigma",
2};
ij.ui().show(img);
Thread.sleep(2000);
ij.command().run(GaussianBlurImageJOps.class, true, imglibParameters).get();
ImagePlus opsResult = IJ.getImage();
Thread.sleep(2000);
ij.command().run(GaussianBlurImageJLegacy.class, true, legacyParameters).get();
ImagePlus legacyResult = IJ.getImage();
Thread.sleep(2000);
ij.command().run(GaussianBlurCLIJ.class, true, legacyParameters).get();
ImagePlus clijResult = IJ.getImage();
Thread.sleep(5000);
mse("IJ ops vs legacy", opsResult, legacyResult);
mse("IJ legacy vs clij", legacyResult, clijResult);
mse("IJ ops vs clij", opsResult, clijResult);
System.out.println("turn ---------------------------- " + turn);
if (turn == 4) {
CLIJ.getInstance("1070");
}
//break;
}
//
}
}