Hi,
When I select a ROI and choose analyze, histogram, I get a histogram for the selection. I am doing this for a 16 bit image. Below the histogram, I see the values Min and Max. (among other values) In a macro, I can use: roiManager("Select", 0); getHistogram(0, counts, 256); To select a ROI and get the histogram. How would I find the Min and Max values that are listed below the histogram in a macro? How are these values calculated? In other words: how can I get the x-values for the histogram and not just the counts? Thanks, Avital -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
> On Jul 7, 2015, at 8:41 AM, Avital Steinberg <[hidden email]> wrote:
> > Hi, > When I select a ROI and choose analyze, histogram, I get a histogram for > the selection. I am doing this for a 16 bit image. Below the histogram, I > see the values Min and Max. (among other values) > > In a macro, I can use: > > roiManager("Select", 0); > getHistogram(0, counts, 256); > > To select a ROI and get the histogram. How would I find the Min and Max > values that are listed below the histogram in a macro? How are these values > calculated? > > In other words: how can I get the x-values for the histogram and not just > the counts? The getHistogram() macro function returns the x-values in the first argument. The following macro displays a histogram plot based on the values returned by getHistogram() and getRawStatistics(). -wayne run("M51 Galaxy (177K, 16-bits)"); bins = 256; getHistogram(values, counts, bins); getRawStatistics(count, mean, min, max, std); binWidth = (max-min)/bins; Plot.create("Histogram", "Value", "Count", values, counts); Plot.addText("Count: "+count, 0.3, 0.2); Plot.addText("Mean: "+mean, 0.3, 0.3); Plot.addText("StdDev: "+std, 0.3, 0.4); Plot.addText("Bins: "+bins, 0.3, 0.5); Plot.addText("Min: "+min, 0.3, 0.6); Plot.addText("Max: "+max, 0.3, 0.7); Plot.addText("Bin Width: "+ binWidth, 0.3, 0.8); -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Wayne,
Now I understand - my mistake was using 0 instead of values, so I didn't have access to the x-values. Thanks a lot, Avital On Wed, Jul 8, 2015 at 6:40 AM, Rasband, Wayne (NIH/NIMH) [E] < [hidden email]> wrote: > > On Jul 7, 2015, at 8:41 AM, Avital Steinberg <[hidden email]> > wrote: > > > > Hi, > > When I select a ROI and choose analyze, histogram, I get a histogram for > > the selection. I am doing this for a 16 bit image. Below the histogram, I > > see the values Min and Max. (among other values) > > > > In a macro, I can use: > > > > roiManager("Select", 0); > > getHistogram(0, counts, 256); > > > > To select a ROI and get the histogram. How would I find the Min and Max > > values that are listed below the histogram in a macro? How are these > values > > calculated? > > > > In other words: how can I get the x-values for the histogram and not just > > the counts? > > The getHistogram() macro function returns the x-values in the first > argument. The following macro displays a histogram plot based on the values > returned by getHistogram() and getRawStatistics(). > > -wayne > > run("M51 Galaxy (177K, 16-bits)"); > bins = 256; > getHistogram(values, counts, bins); > getRawStatistics(count, mean, min, max, std); > binWidth = (max-min)/bins; > Plot.create("Histogram", "Value", "Count", values, counts); > Plot.addText("Count: "+count, 0.3, 0.2); > Plot.addText("Mean: "+mean, 0.3, 0.3); > Plot.addText("StdDev: "+std, 0.3, 0.4); > Plot.addText("Bins: "+bins, 0.3, 0.5); > Plot.addText("Min: "+min, 0.3, 0.6); > Plot.addText("Max: "+max, 0.3, 0.7); > Plot.addText("Bin Width: "+ binWidth, 0.3, 0.8); > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |