Login  Register

Re: Histogram of Analyze Particles Results

Posted by Joel Sheffield on Jul 18, 2005; 4:45am
URL: http://imagej.273.s1.nabble.com/Histogram-of-Analyze-Particles-Results-tp3705243p3705246.html

Thanks, Wayne.  It's just what I need.

Date sent:       Sun, 17 Jul 2005 22:57:40 -0400
Send reply to:   ImageJ Interest Group <[hidden email]>
From:           Wayne Rasband <[hidden email]>
Subject:         Re: Histogram of Analyze Particles Results
To:             [hidden email]

> > 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);
>

Joel B. Sheffield, Ph.D
Department of Biology
Temple University
Philadelphia, PA 19122
Voice: 215 204 8839
e-mail: [hidden email]