Re: bar graphs
Posted by
Wayne Rasband on
Aug 28, 2008; 6:57pm
URL: http://imagej.273.s1.nabble.com/bar-graphs-tp3695266p3695270.html
> I have a (hopefully) related question, so here goes:
>
> I am trying to learn how to call the Analyze/Distribution commands from
> inside a macro.
> I am going through a stack of images with the measure command, which
> generates a Results window.
>
> I then execute the Analyze/Distribution command which takes the list
> in the
> Results window and displays a histogram of values in a Mean
> Distribution
> window. Clicking on the List command shows a second window named Mean
> Distribution with bins and counts. I need the second number in the
> "bin
> start" column to use as a threshold in other calculations.
>
> So far, I have figured out how use run("...) commands to get all the
> way to
> showing the first Mean Distribution window, but I can't get it to show
> the
> List Window, or get any values out of the list.
>
> I tried recording a macro and walking through the steps, but it doesn't
> record the commands either. So far, the record function is the only
> systematic way I have of finding internal commands. Otherwise I just
> have
> to trip over them in other example macros.
The ImageJ 1.41k daily build adds a Plot.getValues() macro function
that retrieves the X and Y values from plot and histogram windows. Here
is an example:
run("Blobs (25K)");
setAutoThreshold();
run("Analyze Particles...", "size=0 circularity=0.00 clear");
run("Distribution...", "parameter=Area automatic");
Plot.getValues(x, y);
for (i=0; i<x.length; i++)
print(x[i], y[i]);
-wayne