Login  Register

Re: Coordinates of Maximum

Posted by Kenton Arkill on May 01, 2014; 9:45pm
URL: http://imagej.273.s1.nabble.com/Coordinates-of-Maximum-tp5007427p5007548.html

Thanks for all your help.
the find maxima works as suggested (noise to 99999). Initially it did not
work for me as I had 'exclude edges' ticked and then it gives no result.

Regards
Kenton


On 26 April 2014 15:20, Rasband, Wayne (NIH/NIMH) [E] <[hidden email]
> wrote:

> On Apr 25, 2014, at 7:38 AM, Kenton Arkill wrote:
>
> > Hi
> > I have an area of an image for which there is a maximum value within that
> > area (i.e. the max value if I "measure"). What is the most efficient way
> of
> > getting the coordinates in in the macro language? I have 10s of thousands
> > to do. The 'find maxima' does not always find one (sometimes more,
> > sometimes less). It is difficult to set the noise tolerance to always get
> > one.
>
> Use the Process>Find Maxima command and set "Nose tolerance" to 99999.
> Here is a macro example:
>
>   run("Cell Colony (31K)");
>   run("Invert");
>   run("Find Maxima...", "noise=99999 output=[Point Selection]");
>   getSelectionBounds(x,y,width,height);
>   print("coordinates="+x+","+y);
>   print("value="+getPixel(x,y));
>
> And here is a JavaScript example:
>
>   imp = IJ.openImage("http://imagej.nih.gov/ij/images/Cell_Colony.jpg");
>   ip = imp.getProcessor();
>   ip.invert();
>   mf = new MaximumFinder();
>   p = mf.getMaxima(ip,99999,false)
>   print("coordinates="+p.xpoints[0]+","+p.ypoints[0]);
>   print("value="+ip.getPixel(p.xpoints[0],p.ypoints[0]));
>
> -wayne
>
>
> > I could get the value and search the area for it pixel by pixel but that
> > seems a slow workaround.
> > Any ideas welcome.
> > Regards
> > Kenton
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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