Login  Register

Re: Histogram manipultion

Posted by Wayne Rasband on Dec 04, 2008; 5:34pm
URL: http://imagej.273.s1.nabble.com/WaitForUser-problem-tp3694321p3694327.html

On Dec 4, 2008, at 12:10 PM, Ben G wrote:

> I want to examine the data inside a run("Histogram", "stack") command.
> In particular, I want access to the "value" and "counts" data inside
> the
> stack Histogram.
>
> I want to use the data to calculate a high and low gray level bounding
> the histogram.
> I have looked at the getStatictics commands and they seem very
> inelegant
> for my purpose.
>
> For example, I can execute the run(Histogram... command above, then
> click on LIST, which shows the data.
> I would like a way to list and read the data by software commands.

You can retrieve the values displayed when you click the "List" button
in a histogram window using the Plot.getValues() macro function. Here
is an example:

     requires("1.41k");
     run("T1 Head (2.4M, 16-bits)");
     run("Histogram", "stack");
     Plot.getValues(counts, values);
     for (i=0; i< counts.length; i++)
         print(counts[i], values[i]);

-wayne