Login  Register

Re: Extracting data from results window

Posted by Krs5 on Apr 04, 2011; 9:10am
URL: http://imagej.273.s1.nabble.com/Extracting-data-from-results-window-tp3685160p3685161.html

Dear Brian,

If you put the saveAs outside your for-loop it will save only at the end the table.

However, you have to make some addition changes as you seem to want a summary table and not a results table so:

dir = getDirectory("Choose a Directory ");{
list = getFileList(dir);
setBatchMode(true);
run("Set Measurements...", "  display redirect=None decimal=5");
for (i=0; i<list.length; i++) {
        path = dir+list[i];
        open(path);
        run("Make Binary");
        run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 show=Nothing summarize");
        close();
        }
saveAs("txt", dir+i+"data.xls");
}

Hope this helps

Kees


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Brian Lin
Sent: 01 April 2011 21:03
To: [hidden email]
Subject: Extracting data from results window

Hi all, I'm new to the ImageJ program and am trying to write a macro that
counts cells on a membrane that I have a .jpg for.
I have a macro so far that looks like this:

 dir = getDirectory("Choose a Directory ");
      list = getFileList(dir);
      setBatchMode(true);
      for (i=0; i<list.length; i++) {
          path = dir+list[i];
          open(path);
run("Make Binary");
run("Analyze Particles...", "size=35-Infinity circularity=0.7-1.00
show=Outlines display clear");
saveAs("Results", dir+i+"data.xls");
}}


Now, what this gives me is a ton of .xls files with every single spot it has
measured.
What I would love it to do is tell me only how many spots it measured in all
of the files listed by name. I assume it is possible to somehow, i dont know
parse the results page to show me the last line and output it in one large
excel spreadsheet?

Thanks for any insight anyone can provide!

--
Brian