saving complete content of "results window"

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

saving complete content of "results window"

JKate
Hi!

I created a macro in ImageJ to analyzed a sequence of pictures. Just calculating the mean of a selected area in every picture in a folder. The results are written in the "Results" window. After that I use the "Analyze" tool "Summarize" to get an average of all calculated values. The output also appears in the "results" window. But saving this window by using saveAs("Measurements", ""); didn't save the "Sammarize" calculations. Just the values before.

This is my macro:

dir = getDirectory("Choose a Directory ");
list = getFileList(dir);

run("Specify...");
getSelectionBounds(x, y, width, height);

setBatchMode(true);

for (i=0; i<list.length; i++) {
        path = dir+list[i];
        showProgress(i, list.length);
        open(path);
        measure = dir+list[i];
        makeOval(x, y, width, height);
        run("Measure");
        close();
}

        run("Summarize");

saveAs("Measurements", "");

Is there any possibility to save the whole content of the "Results" window?
Reply | Threaded
Open this post in threaded view
|

Re: saving complete content of "results window"

Rasband, Wayne (NIH/NIMH) [E]
On Apr 22, 2010, at 9:58 AM, JKate wrote:

> Hi!
>
> I created a macro in ImageJ to analyzed a sequence of pictures. Just
> calculating the mean of a selected area in every picture in a folder. The
> results are written in the "Results" window. After that I use the "Analyze"
> tool "Summarize" to get an average of all calculated values. The output also
> appears in the "results" window. But saving this window by using
> saveAs("Measurements", ""); didn't save the "Sammarize" calculations. Just
> the values before.
>
> This is my macro:
>
> dir = getDirectory("Choose a Directory ");
> list = getFileList(dir);
>
> run("Specify...");
> getSelectionBounds(x, y, width, height);
>
> setBatchMode(true);
>
> for (i=0; i<list.length; i++) {
>        path = dir+list[i];
>        showProgress(i, list.length);
>        open(path);
>        measure = dir+list[i];
>        makeOval(x, y, width, height);
>        run("Measure");
>        close();
> }
>
> run("Summarize");
>
> saveAs("Measurements", "");
>
> Is there any possibility to save the whole content of the "Results" window?

This bug is fixed in the 1.44a daily build.

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: saving complete content of "results window"

dwshaw61
On a related note.  I'm trying to read the results of "Summarize" which appear at the bottom of the Results Window using getResult("Column", row), but get an error message "Row (257) out of range" when trying to read the rows corresponding to the output from "Summarize".  Is there a way to do this?

Dave
Reply | Threaded
Open this post in threaded view
|

Re: saving complete content of "results window"

Rasband, Wayne (NIH/NIMH) [E]
On Apr 30, 2010, at 2:32 PM, dwshaw61 wrote:

> On a related note.  I'm trying to read the results of "Summarize" which
> appear at the bottom of the Results Window using getResult("Column", row),
> but get an error message "Row (257) out of range" when trying to read the
> rows corresponding to the output from "Summarize".  Is there a way to do
> this?

You can read the rows created by the "Summarize" command using the getInfo() and split() macro functions. Here is an example:

  selectWindow("Results");
  table = getInfo();
  rows = split(table, "\n");
  for (row=0; row<rows.length; row++) {
     values = split(rows[row]);
     for (col=0; col<values.length; col++)
         print("row="+row+", col="+col+", value="+values[col]);
  }

-wayne