Login  Register

Re: Find maxima in Java

Posted by Avital Steinberg on Jan 22, 2015; 7:11pm
URL: http://imagej.273.s1.nabble.com/Find-maxima-in-Java-tp5011307p5011319.html

Thanks a lot - this is exactly what I need!

Avital

On Thu, Jan 22, 2015 at 1:35 AM, Rasband, Wayne (NIH/NIMH) [E] <
[hidden email]> wrote:

> On Jan 21, 2015, at 4:44 PM, Avital Steinberg <[hidden email]>
> wrote:
> >
> > Hi,
> > I would like to use Find maxima in Java. I used the following commands:
> >
> > ImageProcessor ip = Img.getProcessor();
> > MaximumFinder mf = new MaximumFinder();
> > mf.findMaxima(ip,20.0,4,false);
> >
> > Just like the graphical user interface in ImageJ, it's possible to get
> the
> > maxima as a list. (the integer 4 represents a list) When I run these
> > commands, a window opens and the list of x,y values of the maxima is
> > displayed.
> >
> > My question is:
> >
> > How can I save this list or store the individual x,y values in order to
> use
> > them in my Java program?
>
> Use the MaximumFinder.getMaxima() method, which returns the list of x,y
> coordinates as a Polygon. Here is a JavaScript example:
>
>   tolerance = 50;
>   excludeOnEdges = false;
>   img = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif");
>   ip = img.getProcessor();
>   mf = new MaximumFinder();
>   maxima = mf.getMaxima(ip, tolerance, excludeOnEdges);
>   print("count="+maxima.npoints);
>
> -wayne
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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