Posted by
Wayne Rasband on
Jul 18, 2005; 3:57am
URL: http://imagej.273.s1.nabble.com/Histogram-of-Analyze-Particles-Results-tp3705243p3705244.html
> Dear Group,
>
> I know that the Analyze Particles section of ImageJ allows
> one to generate a histogram of the size distribution of
> the particles. Is there a plugin that would allow one to
> generate a histogram of other results values, such as integrated
> density?
>
> The only histograms I see on the plugins list relate
> to pixel distributions.
Here is a macro that does this. This macro is also available at
http://rsb.info.nih.gov/ij/macros/HistogramOfResultsValues.txt-wayne
requires("1.34m");
nBins = 20;
n = nResults;
if (n==0)
exit("Results table is empty");
values = newArray("Area", "Mean", "StdDev", "Mode", "Min",
"Max", "Perim.", "Circ.", "IntDen", "Median","Skew","Kurt" );
Dialog.create("Histrogram");
Dialog.addChoice("Value:", values);
Dialog.addNumber("Number of Bins:", nBins);
Dialog.show();
value = Dialog.getChoice();
nBins = Dialog.getNumber();
//setBatchMode(true); // works in 1.35a or later
newImage(value, "32-bit", n, 1, 1);
for (i=0; i<n; i++) {
v = getResult(value, i);
if (i==0 && isNaN(v)) {
close();
exit("\""+value+"\" not in results table");
}
setPixel(i, 0, v);
}
run("Histogram", "bins="+nBins+" use y_max=Auto");
id = getImageID;
selectImage(value);
close();
selectImage(id);
setBatchMode(false);