Dear all,
Within a macro, I have an issue with the ResultsTable after having used the ParticleAnalyzer plugin. And this issue can easily be illustrated with the macro below: run("Blobs (25K)"); setThreshold(126, 255); setOption("BlackBackground", true); run("Convert to Mask"); print(nResults); run("Analyze Particles...", "size=0-Infinity add"); print(nResults); which gives the following results: before =0 after =64 Which means that by running the ParticleAnalyzer plugin several new ResultsTable lines entries are created (even in the case the Display results option isnt activated) which is quite problematic in the case you are already playing around with the ResultsTable for other purposes within a macro. Thus I tried to modify the ParticleAnalyzer.java file (http://imagej.nih.gov/ij/source/ij/plugin/filter/ParticleAnalyzer.java) in order to modify the direct ResultsTable entries (within the addMeans method for example) to entries that are saved to a new ResultsTable instance (to the evaluationTable ResultsTable in the modified code). The modified code can be found under the following link: http://punias.free.fr/ImageJ/ParticleAnalyzer.java But it is not as well solving the issue of ResultsTable entries creation. Thus how could I solve this issue of creation of new ResultsTable entries (in the case the Display results option isnt activated)? I thank you very much in advance for your help. My best regards, Philippe Philippe CARL Laboratoire de Biophotonique et Pharmacologie UMR 7213 CNRS - Université de Strasbourg Faculté de Pharmacie 74 route du Rhin 67401 ILLKIRCH Tel : +33(0)3 68 85 41 84 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
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 |
Dear Gabriel,
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. And as an illustration, if I use the following macro: setResult("test", 0, 5); run("Blobs (25K)"); setThreshold(126, 255); setOption("BlackBackground", true); run("Convert to Mask"); print("before = " + nResults); run("Analyze Particles...", "size=0-Infinity clear add"); print("after = " + nResults); the output is: before = 1 after = 64 as in my case I would rather like the output to be: before = 1 after = 1 Thanks in advance for your help. My best regards, Philippe -----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 |
In reply to this post by Gabriel Landini
Hi Philippe,
Have a look at http://rsbweb.nih.gov/ij/developer/macro/functions.html#IJ.renameResults There's only one functional results table a any given time, but you can rename it to a different name to 'save' it, then discard whatever the particle analyser would create, and restore the saved RT by renaming it "Results". Jerome. On 12 December 2014 at 14:20, Philippe CARL <[hidden email]> wrote: > > Dear Gabriel, > 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. > And as an illustration, if I use the following macro: > setResult("test", 0, 5); > run("Blobs (25K)"); > setThreshold(126, 255); > setOption("BlackBackground", true); > run("Convert to Mask"); > print("before = " + nResults); > run("Analyze Particles...", "size=0-Infinity clear add"); > print("after = " + nResults); > the output is: > before = 1 > after = 64 > as in my case I would rather like the output to be: > before = 1 > after = 1 > Thanks in advance for your help. > My best regards, > Philippe > > -----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 > -- Jerome Mutterer CNRS - Institut de biologie moléculaire des plantes 12, rue du Général Zimmer 67084 Strasbourg Cedex T 0367155339 www.ibmp.cnrs.fr -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Gabriel Landini
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 |
In reply to this post by Gabriel Landini
Hi Philippe,
On Friday 12 Dec 2014 14:20:27 Philippe CARL wrote: > 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. I see. I do not have a suggestion other than saving the data and reloading it, or as others suggested to rename the Results table and recall it. So, in short, at the moment I do not think you can call the particle analyzer without using the Results Table. It should be possible to create a macro or plugin that only loads multiple ROIs to the ROI Manager without using the Results Table. But there might be other ways of doing what you want, in a different order. Perhaps if you explain in more detail what the analysis is trying to do we might be able to provide other suggestions. For example if you wanted to create the ROIs in the ROI manager, and it does not matter if all regions are a single ROI: run("Blobs (25K)"); setThreshold(126, 255); setOption("BlackBackground", true); run("Convert to Mask"); setThreshold(1, 255); run("Create Selection"); roiManager("Add"); Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |