Posted by
Aryeh Weiss on
Jul 25, 2019; 4:55am
URL: http://imagej.273.s1.nabble.com/IJ-renameResults-summaryTitle-Results-seems-to-have-a-timing-issue-tp5022334p5022341.html
On 24/07/2019 20:11, Wayne Rasband wrote:
>> 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.
I have tried, but the minimal scripts run fine, probably because they
are minimal. I will keep trying, and if I have something I can
reproduce, I will post it.
> 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”);
>
>
>
>
Thank you for this advice. I will start to alter my scripts accordingly
--aryeh
--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel
Ph: 972-3-5317638
FAX: 972-3-7384051
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html