Export grayscale values from a stack into text or excel file

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

Export grayscale values from a stack into text or excel file

fm017
Dear All,

I have an Image Sequence (about 100 slices) as 8bit in ImageJ. Now I would like to export the grayscale values (like with ANALYZE/HISTOGRAM/LIST) for every slice into a text or Excel file.
All values in one file.  I mean a table with one column for grayscale values followed by many columns (for each slice one column) with the (pixel-) counts.
I would be glad for any suggestions, plugins, macros or something.

Thanks for your help.
Florian
Reply | Threaded
Open this post in threaded view
|

Re: Export grayscale values from a stack into text or excel file

Rasband, Wayne (NIH/NIMH) [E]
On May 13, 2014, at 11:35 AM, fm017 wrote:

> Dear All,
>
> I have an Image Sequence (about 100 slices) as 8bit in ImageJ. Now I would
> like to export the grayscale values (like with ANALYZE/HISTOGRAM/LIST) for
> every slice into a text or Excel file.
> All values in one file.  I mean a table with one column for grayscale values
> followed by many columns (for each slice one column) with the (pixel-)
> counts.
> I would be glad for any suggestions, plugins, macros or something.

Here is a macro that saves histogram counts of all images in a stack as a comma separated text file:

  run("Clear Results");
  setOption("ShowRowNumbers", false);
  for (slice=1; slice<=nSlices; slice++) {
     setSlice(slice);
     getRawStatistics(n, mean, min, max, std, hist);
     for (i=0; i<hist.length; i++) {
        setResult("Value", i, i);
        setResult("Count"+slice, i, hist[i]);
     }
  }
  path = getDirectory("home")+"histogram-counts.csv";
  saveAs("Results", path);

> --
> View this message in context: http://imagej.1557.x6.nabble.com/Export-grayscale-values-from-a-stack-into-text-or-excel-file-tp5007716.html
> Sent from the ImageJ mailing list archive at Nabble.com.

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

Re: Export grayscale values from a stack into text or excel file

fm017
Dear Mr. Rasband,

thank you so much! This is exactly what I have been looking for.

Best wishes,
Florian