(String arg)
| 9 | public class BatchMeasure implements PlugIn { |
| 10 | |
| 11 | public void run(String arg) { |
| 12 | String dir = IJ.getDirectory("Choose a Folder"); |
| 13 | if (dir==null) return; |
| 14 | String[] list = (new File(dir)).list(); |
| 15 | if (list==null) return; |
| 16 | Analyzer.setMeasurement(Measurements.LABELS, true); |
| 17 | for (int i=0; i<list.length; i++) { |
| 18 | if (list[i].startsWith(".")) continue; |
| 19 | String path = dir + list[i]; |
| 20 | IJ.showProgress(i+1, list.length); |
| 21 | IJ.redirectErrorMessages(true); |
| 22 | ImagePlus imp = !path.endsWith("/")?IJ.openImage(path):null; |
| 23 | IJ.redirectErrorMessages(false); |
| 24 | if (imp!=null) { |
| 25 | IJ.run(imp, "Measure", ""); |
| 26 | imp.close(); |
| 27 | } else if (!path.endsWith("/")) |
| 28 | IJ.log("IJ.openImage() returned null: "+path); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | } |
nothing calls this directly
no test coverage detected