Login  Register

Re: Percentile value

Posted by Jan Eglinger-5 on Sep 29, 2009; 2:02pm
URL: http://imagej.273.s1.nabble.com/Percentile-value-tp3690983p3690988.html

Hi all,

following up on the issue of measuring percentiles in ImageJ...

Wayne Rasband wrote:

>> To get the percentile value, I think that I could get all the pixel
>> value by using getpixel (I,j) and make an array.
>> Then I need to sort the array. How do I sort the array using ImageJ
>> macro language? Do you have to make a function?
>
> Use the Array.sort() macro function to sort an array. Here is an example
> macro that creates an array from all pixels in an image then sorts the
> array:
>
>    requires ("1.42j");
>    w = getWidth;
>    h = getHeight;
>    a = newArray(w*h);
>    i = 0;
>    for (y=0; y<h; y++)
>       for (x=0; x<w; x++)
>           a[i++] = getPixel(x,y);
>    Array.sort(a);
>

Is there an easy way to limit that array to the thresholded pixels or to
an ROI only?

Or is there even a chance to integrate an option "percentile" into the
"Set Measurements..." dialog, together with a parameter telling which
percentile (0.01-0.99)?
That would permit to make use of e.g. the "Redirect" option while
measuring percentiles.

Best,
Jan