Unexpected Analyze Particles behavior

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Unexpected Analyze Particles behavior

Andrew Sanchez
I have a macro for measuring the number of green pixels in a thresholded image.

Here are the lines I am having a problem with:

run("Analyze Particles...", "size=10-Infinity summarize");

        selectWindow(list[k]);
        close();

// saves summary and results tables
selectWindow("Summary");
saveAs("text", dir1+"green.txt");
selectWindow("Results");
saveAs("results", dir1+"area.txt");

Previously in Windows, this was working perfectly.  I would end up with two windows entitled Summary and Results, each containing one table of information.   Now I'm working from home on Linux (Ubuntu) and am having a slight problem.  Instead of getting one "Summary" window, ImageJ is opening a new window for every image to store the results of "Analyze Particles."

Is there anything I can adjust on run("Analyze Particles...", "size=10-Infinity summarize"); to ensure if saves the results in one table and doesn't create a new "Summary" window for each image?


Here is a link to the complete macro for reference:  https://drive.google.com/file/d/0B208tul7KbkbZ3ZxQ2RRR1NtTG8/view?usp=sharing

Help is much appreciated!
Much gratitude,
Andrew Sanchez

Reply | Threaded
Open this post in threaded view
|

Re: Unexpected Analyze Particles behavior

Andrew Sanchez
Is there a way to at least change

selectWindow("Summary");
saveAs("text", dir1+"green.txt");

so that instead of overwriting the file named "green.txt" it will append the results to the file?
Reply | Threaded
Open this post in threaded view
|

Re: Unexpected Analyze Particles behavior

Michael Schmid
In reply to this post by Andrew Sanchez
Hi Andrew,

are you using headless mode under Linux? Then it might be a bug causing ImageJ not to reset the 'clear' ("Clear results" checkbox) in headless mode.

Michael
________________________________________________________________
On Jul 21, 2015, at 21:43, Andrew Sanchez wrote:

> I have a macro for measuring the number of green pixels in a thresholded
> image.
>
> Here are the lines I am having a problem with:
>
> run("Analyze Particles...", "size=10-Infinity summarize");
>
>        selectWindow(list[k]);
>        close();
>
> // saves summary and results tables
> selectWindow("Summary");
> saveAs("text", dir1+"green.txt");
> selectWindow("Results");
> saveAs("results", dir1+"area.txt");
>
> Previously in Windows, this was working perfectly.  I would end up with two
> windows entitled Summary and Results, each containing one table of
> information.   Now I'm working from home on Linux (Ubuntu) and am having a
> slight problem.  Instead of getting one "Summary" window, ImageJ is opening
> a new window for every image to store the results of "Analyze Particles."
>
> Is there anything I can adjust on run("Analyze Particles...",
> "size=10-Infinity summarize"); to ensure if saves the results in one table
> and doesn't create a new "Summary" window for each image?
>
>
> Here is a link to the complete macro for reference:
> https://drive.google.com/file/d/0B208tul7KbkbZ3ZxQ2RRR1NtTG8/view?usp=sharing
>
> Help is much appreciated!
> Much gratitude,
> Andrew Sanchez
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Unexpected Analyze Particles behavior

Michael Schmid
In reply to this post by Andrew Sanchez
On Jul 23, 2015, at 00:04, Andrew Sanchez wrote:

> Is there a way to at least change
>
> selectWindow("Summary");
> saveAs("text", dir1+"green.txt");
>
> so that instead of overwriting the file named "green.txt" it will append the
> results to the file?


Hi Andrew,

to append the Results Table, you could try the following:

  // There should be no table named "Results" at this point
  IJ.renameResults("Summary","Results");
  String.copyResults;
  string = String.paste;
  File.append(string, dir1+"green.txt")

Michael

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Unexpected Analyze Particles behavior

annie Venien
Hi
I have the same problem, I woudl like to append the "Results" and "Summary" of sevral images in only on table for the result and another one for the summary. Michael, your solution works perfectly for the "Results" table but not for the "Summary"  I probably make a mistake somewhere but where??
I am running ImageJ 1.49t on windows 7

Thanks in advance
Annie
Le 27 juil. 2015 à 15:44, Michael Schmid a écrit :

> On Jul 23, 2015, at 00:04, Andrew Sanchez wrote:
>
>> Is there a way to at least change
>>
>> selectWindow("Summary");
>> saveAs("text", dir1+"green.txt");
>>
>> so that instead of overwriting the file named "green.txt" it will append the
>> results to the file?
>
>
> Hi Andrew,
>
> to append the Results Table, you could try the following:
>
>  // There should be no table named "Results" at this point
>  IJ.renameResults("Summary","Results");
>  String.copyResults;
>  string = String.paste;
>  File.append(string, dir1+"green.txt")
>
> Michael
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Annie VENIEN
INRA-Centre Auvergne-Rhône-Alpes
UR370 Qualité des Produits Animaux (QuaPA)
Equipe Imagerie  & Transferts
F-63122 ST-GENES-CHAMPANELLE
 Tél : +33 (0)4 73 62 46 83
Courriel : [hidden email]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The 61st International Congress of Meat Science and Technology
will be held in Clermont-Ferrand (FRANCE)
from 23rd to 28th August 2015

https://colloque.inra.fr/icomst2015


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

=?windows-1252?Q?Capture_d=92=E9cran_2015-05-28_=E0_13=2E15=2E38?= =?windows-1252?Q?=2Ejpg?= (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Unexpected Analyze Particles behavior

annie Venien
In reply to this post by Michael Schmid
Hi
I have the same problem, I would like to append the "Results" and "Summary" of sevral images in only one table for the results and another one for the summary . Michael your solution works perfectly for the "Results" but not for the "Summary " .  I am running Image J 149t on windows7
Tanks in advance for help
Annie
Le 27 juil. 2015 à 15:44, Michael Schmid a écrit :

> On Jul 23, 2015, at 00:04, Andrew Sanchez wrote:
>
>> Is there a way to at least change
>>
>> selectWindow("Summary");
>> saveAs("text", dir1+"green.txt");
>>
>> so that instead of overwriting the file named "green.txt" it will append the
>> results to the file?
>
>
> Hi Andrew,
>
> to append the Results Table, you could try the following:
>
>  // There should be no table named "Results" at this point
>  IJ.renameResults("Summary","Results");
>  String.copyResults;
>  string = String.paste;
>  File.append(string, dir1+"green.txt")
>
> Michael
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html






--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Unexpected Analyze Particles behavior

Andrew Sanchez
This is what I ended up using

```
String.copyResults;
string = String.paste;
File.append(string, "/home/truthling/Documents/ECOSS/ImageJ_Results/"+"area.csv");

IJ.renameResults("Summary","Results");
String.copyResults;
string = String.paste;
File.append(string, "/home/truthling/Documents/ECOSS/ImageJ_Results/"+"green.csv");
```

I'm gonna end up having to figure out a way to merge files.  I wasn't able to get them into one file.  I'm thinking perhaps the Python Pandas library will do the job.