Batch operation with macro - saving list as an excel file

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

Batch operation with macro - saving list as an excel file

aa
Hi
I am trying to do a batch operation which will open an RGB image, separate channels, use the green channel to perform 3d interactive plot, save plot, analyze histogram, save histogram and save list as an excel file.I would like to do this for about a 1000 RGB images

The macro works ok until the last step when the error: this command requires a TextWindow such as the "Log" window or an "infor for..." window.
Would be very gratefu for any help.
PS: dont know much about java and hence would first like to try out using macros
Reply | Threaded
Open this post in threaded view
|

Re: Batch operation with macro - saving list as an excel file

Schebique
Hi.

this is an example code which do something similar you want. It works
for me. I hope it will be inspirative.

//set the .xls output format
run("Input/Output...", "file=.xls");

//open example image, split channels and select green channel
run("HeLa Cells (1.3M, 48-bit RGB)");
run("Split Channels");
selectWindow("C2-hela-cells.tif");

// This macro generates a 256 bin histogram and
// displays the counts in the "Results" window.

  nBins = 256;         //for 16 bit images nBins should be 65535, but it
is not good for excel (max of rows in table is this);
  run("Clear Results");
  row = 0;
  getHistogram(values, counts, nBins);
  for (i=0; i<nBins; i++) {
      setResult("Value", row, values[i]);
      setResult("Count", row, counts[i]);
      row++;
   }
  updateResults();
  selectWindow("Results"); // Optional line if you need select other
windows between UpdateResult and saveAs command.
  saveAs("Measurements", "c:\\work\\Histogram of C2-hela-cells.xls");
close();close();close();

Other inspiration you can find at :
http://rsb.info.nih.gov/ij/macros/ShowStatistics.txt
Sincerley Ondrej.

aa napsal(a):
> Hi
> I am trying to do a batch operation which will open an RGB image, separate channels, use the green channel to perform 3d interactive plot, save plot, analyze histogram, save histogram and save list as an excel file.I would like to do this for about a 1000 RGB images
>
> The macro works ok until the last step when the error: this command requires a TextWindow such as the "Log" window or an "infor for..." window.
> Would be very gratefu for any help.
> PS: dont know much about java and hence would first like to try out using macros
>