Saving histogram list to Excel file

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

Saving histogram list to Excel file

Bourg, Fred {FLNA}
All

I've downloaded the "Color Histogram" plug-in and love it.

I'd like an additional feature of being able to select the "list" option and then the "save as" option embedded in a macro.

At present both options work on the screen but do not get entered into the Macro recorder.

The same is true for the >analyze >histogram feature in the base system.

I am attempting to capture image histograms in R, G, B planes for statistical analysis and the Excel format will work well for importing into my stats processor.

Any thoughts would be very much appreciated and helpful.

Thanks and Merry Christmas to all.


Fred

Restricted - Pepsico Confidential
Reply | Threaded
Open this post in threaded view
|

Re: Saving histogram list to Excel file

Rasband, Wayne (NIH/NIMH) [E]
On Dec 21, 2011, at 6:55 PM, Bourg, Fred {FLNA} wrote:

> All
>
> I've downloaded the "Color Histogram" plug-in and love it.
>
> I'd like an additional feature of being able to select the "list" option and then the "save as" option embedded in a macro.
>
> At present both options work on the screen but do not get entered into the Macro recorder.
>
> The same is true for the >analyze >histogram feature in the base system.
>
> I am attempting to capture image histograms in R, G, B planes for statistical analysis and the Excel format will work well for importing into my stats processor.
>
> Any thoughts would be very much appreciated and helpful.
>
> Thanks and Merry Christmas to all.

This can be done with a simple macro:

  setRGBWeights(1,0,0);
  getStatistics(area, mean, min, max, std, rhist);
  setRGBWeights(0,1,0);
  getStatistics(area, mean, min, max, std, ghist);
  setRGBWeights(0,0,1);
  getStatistics(area, mean, min, max, std, bhist);
  run("Clear Results");
  for (i=0; i<256; i++) {
     setResult("Value", i, i);
     setResult("Red Count", i, rhist[i]);
     setResult("Green Count", i, ghist[i]);
     setResult("Blue Count", i, bhist[i]);
  }
  setOption("ShowRowNumbers", false);
  updateResults;

Add a line something like this

   saveAs("Results", getDirectory("home")+"Results.csv");

to save the results.

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

Re: Saving histogram list to Excel file

Bourg, Fred {FLNA}
Thanks.  This is a big help.

I'm now trying to label my file and I'd like to use the name of the current image (File.nameWithoutextension).csv back in the same original directory.

I figured out how to get it to the image directory, but I'm having difficulty getting it to name the file off of the current image file.

Thanks for your help.

Merry Christmas to you.

Fred

Restricted - Pepsico Confidential


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Rasband, Wayne (NIH/NIMH) [E]
Sent: Thursday, December 22, 2011 6:44 PM
To: [hidden email]
Subject: Re: Saving histogram list to Excel file

On Dec 21, 2011, at 6:55 PM, Bourg, Fred {FLNA} wrote:

> All
>
> I've downloaded the "Color Histogram" plug-in and love it.
>
> I'd like an additional feature of being able to select the "list" option and then the "save as" option embedded in a macro.
>
> At present both options work on the screen but do not get entered into the Macro recorder.
>
> The same is true for the >analyze >histogram feature in the base system.
>
> I am attempting to capture image histograms in R, G, B planes for statistical analysis and the Excel format will work well for importing into my stats processor.
>
> Any thoughts would be very much appreciated and helpful.
>
> Thanks and Merry Christmas to all.

This can be done with a simple macro:

  setRGBWeights(1,0,0);
  getStatistics(area, mean, min, max, std, rhist);
  setRGBWeights(0,1,0);
  getStatistics(area, mean, min, max, std, ghist);
  setRGBWeights(0,0,1);
  getStatistics(area, mean, min, max, std, bhist);
  run("Clear Results");
  for (i=0; i<256; i++) {
     setResult("Value", i, i);
     setResult("Red Count", i, rhist[i]);
     setResult("Green Count", i, ghist[i]);
     setResult("Blue Count", i, bhist[i]);
  }
  setOption("ShowRowNumbers", false);
  updateResults;

Add a line something like this

   saveAs("Results", getDirectory("home")+"Results.csv");

to save the results.

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

Re: Saving histogram list to Excel file

Bourg, Fred {FLNA}
I figured it out.

I'm slowly catching on!

Thanks for much patience with this novice.

Fred

Restricted - Pepsico Confidential


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Bourg, Fred {FLNA}
Sent: Saturday, December 24, 2011 4:27 PM
To: [hidden email]
Subject: Re: Saving histogram list to Excel file

Thanks.  This is a big help.

I'm now trying to label my file and I'd like to use the name of the current image (File.nameWithoutextension).csv back in the same original directory.

I figured out how to get it to the image directory, but I'm having difficulty getting it to name the file off of the current image file.

Thanks for your help.

Merry Christmas to you.

Fred

Restricted - Pepsico Confidential


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Rasband, Wayne (NIH/NIMH) [E]
Sent: Thursday, December 22, 2011 6:44 PM
To: [hidden email]
Subject: Re: Saving histogram list to Excel file

On Dec 21, 2011, at 6:55 PM, Bourg, Fred {FLNA} wrote:

> All
>
> I've downloaded the "Color Histogram" plug-in and love it.
>
> I'd like an additional feature of being able to select the "list" option and then the "save as" option embedded in a macro.
>
> At present both options work on the screen but do not get entered into the Macro recorder.
>
> The same is true for the >analyze >histogram feature in the base system.
>
> I am attempting to capture image histograms in R, G, B planes for statistical analysis and the Excel format will work well for importing into my stats processor.
>
> Any thoughts would be very much appreciated and helpful.
>
> Thanks and Merry Christmas to all.

This can be done with a simple macro:

  setRGBWeights(1,0,0);
  getStatistics(area, mean, min, max, std, rhist);
  setRGBWeights(0,1,0);
  getStatistics(area, mean, min, max, std, ghist);
  setRGBWeights(0,0,1);
  getStatistics(area, mean, min, max, std, bhist);
  run("Clear Results");
  for (i=0; i<256; i++) {
     setResult("Value", i, i);
     setResult("Red Count", i, rhist[i]);
     setResult("Green Count", i, ghist[i]);
     setResult("Blue Count", i, bhist[i]);
  }
  setOption("ShowRowNumbers", false);
  updateResults;

Add a line something like this

   saveAs("Results", getDirectory("home")+"Results.csv");

to save the results.

-wayne