Max Intensity as Y-axis in Plot Profile

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Max Intensity as Y-axis in Plot Profile

Ke Li
Hi everyone,

I am new to ImageJ and have a question about Plot Profile. I have a .tif
file and would like to have plot profile of a rectangular selection. Does
anyone know how to get the maximum pixel intensity of each column as
y-axis, instead of the default "vertically averaged pixel intensity". Any
suggestion is greatly appreciated.

Thank you,
Ke Li

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Max Intensity as Y-axis in Plot Profile

Peter Haub
Hi Ke Le,

try this macro code (for 8-bit image only):

// ******************************
getSelectionBounds(x0,y0,w,h);

a = newArray(w);

for (x=0; x<w; x++){
    max = 0;
    for (y=0; y<h; y++){
       val = getPixel(x0+x, y0+y);
       if (val > max)
          max = val;
    }
    a[x] = max;
}

newImage("MaxImage", "8-bit", w, 1, 1);
for (x=0; x<w; x++)
    setPixel(x, 0, a[x]);

run("Select All");
run("Plot Profile")
// ******************************

Regards,
Peter

On 18.02.2016 16:25, Ke Li wrote:

> Hi everyone,
>
> I am new to ImageJ and have a question about Plot Profile. I have a .tif
> file and would like to have plot profile of a rectangular selection. Does
> anyone know how to get the maximum pixel intensity of each column as
> y-axis, instead of the default "vertically averaged pixel intensity". Any
> suggestion is greatly appreciated.
>
> Thank you,
> Ke Li
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html