Login  Register

Re: ParticleAnalyzer and ResultsTable

Posted by Jan Eglinger on Dec 12, 2014; 1:53pm
URL: http://imagej.273.s1.nabble.com/ParticleAnalyzer-and-ResultsTable-tp5010924p5010929.html

Dear Philippe,

On 12.12.14 14:20, Philippe CARL wrote:
> To use the "clear" option would "unfortunately" make my issue way to easy!!!
> The problem is that I don't have an empty result window (from previous
> analysis and computation) within the macro before I launch the "Analyze
> Particles...".
> And by using the "clear" option you will erase everything that is before in
> the result window.
> What I would rather like is the result window content to actually stay
> identical after and before the "Analyze Particles..." launching.

The issue you describe is one of the reasons why I turned away from the
macro language and towards the other scripting languages for any more
complex analysis. With Javascript for example, you can use a separate
ResultsTable instance for the ParticleAnalyzer by using its Java API:

*** Javascript snippet ***

importClass(Packages.ij.IJ);
importClass(Packages.ij.measure.ResultsTable);
importClass(Packages.ij.measure.Measurements);
importClass(Packages.ij.plugin.filter.ParticleAnalyzer);
importClass(Packages.java.lang.Double);

imp = IJ.getImage();
tempResults = new ResultsTable();
pa = new ParticleAnalyzer( ParticleAnalyzer.SHOW_NONE, // show nothing
                            Measurements.AREA, // measure area
                            tempResults, // our temporary ResultsTable
                            0, // minimum size
                            Double.POSITIVE_INFINITY // maximum size
                          );
pa.analyze(imp);
tempResults.show("Temporary Results in a different table");

*** end of script ***

Hope that helps,
Jan


> -----Message d'origine-----
> De : ImageJ Interest Group [mailto:[hidden email]] De la part de
> Gabriel Landini
> Envoyé : vendredi 12 décembre 2014 12:44
> À : [hidden email]
> Objet : Re: ParticleAnalyzer and ResultsTable
>
> On Friday 12 Dec 2014 12:08:53 you wrote:
>> run("Analyze Particles...", "size=0-Infinity add");
>
>> Which means that by running the ParticleAnalyzer plugin several new
>> ResultsTable lines entries are created (even in the case the Display
>> results option isn't activated) which is quite problematic in the case
>> you are already playing around with the ResultsTable for other
>> purposes within a macro.
>
> What about using the "clear" option.
>
> run("Analyze Particles...", "size=0-Infinity clear add");
>
> Otherwise you keep adding to the results table, which is what the macro
> should do, regardless of being displayed or not.
>
> Cheers
>
> Gabriel
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html