Login  Register

Re: Plugin to adjust threshold without opening window

Posted by Rasband, Wayne (NIH/NIMH) [E] on Feb 04, 2017; 3:04am
URL: http://imagej.273.s1.nabble.com/Plugin-to-adjust-threshold-without-opening-window-tp5018002p5018025.html

> On Feb 3, 2017, at 11:46 AM, kt7 <[hidden email]> wrote:
>
> Thank You so much works great.
> Another quick question though, as I am analyzing particles I can't seem to
> get the area of any of them to return as an integer:
>
> IJ.run(imageOutput, "Analyze Particles...",
> "size="+minCellSize+"-"+maxCellSize+" exclude include");
>
> I'm not sure the next command to run in order to work with an individual
> particle. I was thinking I could add to the ROI manager but again I don't
> know how to get the area of individual particles.
> Thank you,

The particle analyzer saves results to the system ResultsTable. The following JavaScript example runs the particle analyzer, retrieves the system ResultsTable, and then displays the area and mean of the individual particles.

-wayne

  imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif");
  IJ.setAutoThreshold(imp, "Default");
  IJ.run("Set Measurements...", "area mean");
  min=100; max=400;
  IJ.run(imp, "Analyze Particles...", "size="+min+"-"+max+" clear");
  rt = Analyzer.getResultsTable();
  for (i=0; i<rt.size(); i++)
      print(i+":  area="+rt.getValue("Area",i)+", mean="+rt.getValue("Mean",i));
 

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