Login  Register

Re: Analyze, Particles opens the ROI manager

Posted by Rasband, Wayne (NIH/NIMH) [E] on Sep 12, 2015; 10:07pm
URL: http://imagej.273.s1.nabble.com/Analyze-Particles-opens-the-ROI-manager-tp5014322p5014323.html

> On Sep 12, 2015, at 4:24 PM, Avital Steinberg <[hidden email]> wrote:
>
> Hi,
> I'm trying to work in batch mode (in Javascript), so I hid the images,
> results table and ROI manager. The problem is that when I use Analyze,
> particles, the ROI manager opens:
>
> IJ.run(imp, "Analyze Particles...", "include add");
>
> Is there a way to analyze the particles without displaying the ROI manager?
> I'm using the daily build 1.50c9.
>
> I tried to use the Particle Analyzer class. I saw that it was much faster
> without displaying the ROI manager. I know that the particles were
> segmented because the results table was updated. However, I was unable to
> display the ImagePlus. I used the command:
>
> pa.analyze(imp,ip);
>
> How can the results of the segmentation be displayed on the ImagePlus,
> similarly to what is done automatically in Analyze, Particles?

Use an Overlay instead of the ROI Manager. Here is an example:

  imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif");
  IJ.setAutoThreshold(imp, "Default");
  IJ.run(imp, "Analyze Particles...", "  show=[Overlay Outlines]");
  ip = imp.getProcessor();
  overlay = imp.getOverlay();
  for (i=0; i<overlay.size(); i++) {
     ip.setRoi(overlay.get(i));
     stats = ip.getStatistics();
     print(i+": size="+stats.pixelCount+", mean="+IJ.d2s(stats.mean,2));
  }
  imp.show();

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