Posted by
Wayne Rasband-2 on
Jul 24, 2019; 5:11pm
URL: http://imagej.273.s1.nabble.com/IJ-renameResults-summaryTitle-Results-seems-to-have-a-timing-issue-tp5022334p5022340.html
> On Jul 21, 2019, at 12:59 PM, Aryeh Weiss <
[hidden email]> wrote:
>
> When I use:
> IJ.renameResults(summaryTitle,"Results")
>
> It does not reliably work in a script unless I put a delay into the code.
It would help if you could provide a minimal script that reproduces the problem.
The best way to create scripts that run quickly and reliably is to avoid displaying images and tables and to work with ImagePlus and ResultsTable objects. The particle analyzer will direct its output to a ResultsTable if you call ParticleAnalyzer.setResultsTable(). Call ParticleAnalyzer.setSummaryTable() to have summary data directed to a ResultsTable (requires ImageJ 1.52p or later). The following example runs the particle analyzer separately on the three channels of the HelaCells sample image, with the output and summary data directed to ResultsTable objects, which are saved as CSV files.
-wayne
imp = IJ.openImage("
http://wsr.imagej.net/images/hela-cells.zip");
imp.setDisplayMode(IJ.GRAYSCALE);
resultsTable = new ResultsTable();
summaryTable = new ResultsTable();
IJ.run("Set Measurements...", "area mean min centroid display");
for (c=1; c<=3; c++) {
imp.setC(c);
IJ.setAutoThreshold(imp, "Default dark");
ParticleAnalyzer.setResultsTable(resultsTable);
ParticleAnalyzer.setSummaryTable(summaryTable);
IJ.run(imp, "Analyze Particles...", "size=5 display summarize clear slice");
}
dir = IJ.getDir("home")+"Downloads/"
resultsTable.save(dir+"Results.csv");
summaryTable.save(dir+"Summary.csv”);
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html