MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / run

Method run

ij/src/main/java/ij/plugin/Benchmark.java:38–98  ·  view source on GitHub ↗
(String arg)

Source from the content-addressed store, hash-verified

36 private int counter;
37
38 public void run(String arg) {
39 ImagePlus cImp = WindowManager.getCurrentImage();
40 if (cImp!=null && cImp.getWidth()==512 && cImp.getHeight()==512 && cImp.getBitDepth()==24) {
41 IJ.runPlugIn(cImp, "ij.plugin.filter.Benchmark", "");
42 return;
43 }
44 IJ.showStatus("Creating "+size+"x"+size+" 16-bit image");
45 long t0 = System.currentTimeMillis();
46 ImageProcessor.setRandomSeed(12345);
47 ImagePlus imp = IJ.createImage("Untitled", "16-bit noise", size, size, 1);
48 ImageProcessor.setRandomSeed(Double.NaN);
49 imp.copy();
50 for (int i=0; i<3; i++)
51 analyzeParticles(imp);
52 for (int i=0; i<3; i++) {
53 IJ.run(imp, "Median...", "radius=2");
54 showProgress("Median");
55 }
56 for (int i=0; i<12; i++) {
57 IJ.run(imp, "Unsharp Mask...", "radius=1 mask=0.60");
58 showProgress("Unsharp Mask");
59 }
60 ImageProcessor ip = imp.getProcessor();
61 ip.snapshot();
62 for (int i=0; i<12; i++) {
63 ip.blurGaussian(40);
64 showProgress("Gaussian blur");
65 }
66 ip.reset();
67 for (int i=0; i<360; i+=20) {
68 ip.reset();
69 ip.rotate(i);
70 showProgress("Rotate");
71 }
72 double scale = 1.2;
73 for (int i=0; i<14; i++) {
74 ip.reset();
75 ip.scale(scale, scale);
76 showProgress("Scale");
77 scale = scale*1.2;
78 }
79 double time = (System.currentTimeMillis()-t0)/1000.0;
80 ResultsTable rt = new ResultsTable();
81 rt.showRowNumbers(true);
82 for (int i=0; i<results.length; i++) {
83 String[] columns = Tools.split(results[i],"|");
84 rt.addRow();
85 rt.addValue("Time", columns[0]);
86 rt.addValue("Computer", columns[1]);
87 }
88 rt.addRow();
89 String t = IJ.d2s(time,1);
90 if (t.length()<4) t=" "+t;
91 rt.addValue("Time", t);
92 int threads = Prefs.getThreads();
93 String suffix = " THREAD"+(threads>1?"S":"")+")>>";
94 rt.addValue("Computer", "<<THIS MACHINE ("+threads+suffix);
95 rt.sort("Time");

Callers

nothing calls this directly

Calls 15

getCurrentImageMethod · 0.95
getWidthMethod · 0.95
getHeightMethod · 0.95
getBitDepthMethod · 0.95
runPlugInMethod · 0.95
showStatusMethod · 0.95
setRandomSeedMethod · 0.95
createImageMethod · 0.95
copyMethod · 0.95
analyzeParticlesMethod · 0.95
runMethod · 0.95
showProgressMethod · 0.95

Tested by

no test coverage detected