Coordinates of Maximum

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

Coordinates of Maximum

Kenton Arkill
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.

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
Reply | Threaded
Open this post in threaded view
|

Re: Coordinates of Maximum

Herbie-3
Kenton,

thinking logically might tell us that getting the exact maximum implies
searching the whole area of interest. That said, the maximum you get
from the "measure"-command does just this but not with macro speed.

The best would be to write a plugin that provides the desired
coordinates and has Java-speed. Most probably it has already been written...

Another issue is noise. How do you think you can avoid the influence of
noise on the maximum value? I.e., how can you be sure that the maximum
isn't caused by noise?

Just some thoughts

Herbie

:::::::::::::::::::::::::::::::::::::::
On 25.04.14 13:38, 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.
>
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Coordinates of Maximum

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by Kenton Arkill
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
Reply | Threaded
Open this post in threaded view
|

Re: Coordinates of Maximum

Kenton Arkill
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