Login  Register

Macro to get "list-data" after custom histogram

Posted by javila0624 on Jul 17, 2014; 8:56pm
URL: http://imagej.273.s1.nabble.com/Macro-to-get-list-data-after-custom-histogram-tp5008813.html

Hello community,
I've tried looking on previous posts but have not found anything to help me. I'm trying to write a script that will enable two things: 1. set a custom x_min and x_max on the histogram
                                        2. save THIS bin start, count list onto an excel sheet



No. 1 is solved with this: run("Histogram", "bins=256 x_min=0 x_max=65536 y_max=Auto");

It works fine.

But then, how can I continue the macro to get the list of Bin start/count from this specific histogram?
              Based on other posts, I've managed to get intensity counts saved to an excel sheet with these lines:


getHistogram(values, counts, );    
print(d, "Intensity Counts");
        for (k=0; k<256; k++) {
                print(d, k+" "+counts[k]);



I've tried to replace getHistogram(values, counts, 256);  with getHistogram(bin start, count, 256);

An error message pops up. In addition, I'd like the macro to get this list from the run("Histogram") script that I mentioned earlier.    

I am doing this for a composite image of three channels, and would like that each channel have a respective heading under its count list, so I'm trying these lines out:


title=getTitle()
c1Title = "C1-" + title;
c2Title = "C2-" + title;
c3Title = "C3-" + title;
Histc3Title= "Histogram of C1-" + title
Histc3Title= "Histogram of C2-" + title
Histc3Title= "Histogram of C3-" + title

selectWindow( "C1-" + title);
selectWindow( "Histogram of C1-" + title);


This is not in order but it's what I'm trying out to get my output.


Can someone help?