Find maxima in Java

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

Find maxima in Java

Avital Steinberg
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?

Thanks,
Avital

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

Re: Find maxima in Java

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

Re: Find maxima in Java

Avital Steinberg
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