Problem with ROI to overlay in latest version 1.52j

I found out this week after upgrading imagej to version 1.52j that ROI to overlay does not work anymore, either from imagej menu or in an macro using run(“From ROI Manager”). An exception is generated:

(Fiji Is Just) ImageJ 2.0.0-rc-68/1.52j; Java 1.8.0_66 [64-bit]; Windows 7 6.1; 86MB of 6034MB (1%)

at ij.plugin.frame.RoiManager.moveRoisToOverlay(
at ij.plugin.OverlayCommands.fromRoiManager(
at ij.IJ.runPlugIn(
at ij.Executer.runCommand(

This regression is fixed in the ImageJ 1.52k13 daily build. To upgrade, use the Help>Update ImageJ command and select “daily build” from the drop down menu,

Thanks, Wayne! It works now.

Hi Wayne,

I found another change related to ROI with the new version. Analyze particles used to produce ROI of the particles that does not include internal holes regardless of the “exclude hole” option is specified. But this has changed for the new version, the ROIs generated from the particle analyzer depend on whether “exclude internal holes” is specified.

This change in general is good as I have to write my own macro to generate ROIs with internal holes in many particle analysis applications. However, this change also generated problem for one of my old macros that assumes that ROI from Particle Analyzer does not include internal holes (e.g. area calculation, convex hull generation).

Is this intended change for new version of Imagej or an accident change? In any case, I think that this change is good, but need to be announced so we are aware of the change.



This is a bug fix that is mentioned in the daily build release notes at

Now when using the “Add to manager” option and you click “Measure” in the ROI Manager you get the same results as the particle analyzer.

This issue is discussed at


Thanks for the explanation. It seems that it has always been this way that the ROI from particle analyzer do not include internal holes regardless the “include holes” option although the area measurements are correct for the option specified. This has caused issues and has been discussed in the forum multiple times in the past. I wrote my own macro to include internal holes in the past and did not report this as a bug. I am glad that it is finally corrected in the new version. However, I had to revise multiple macros that assumes the old ROI behavior from the particle analyzer.

Hi Wayne,

I just upgraded imagej to 1.52n a few days ago and noticed that the ROI generated from the particle analyzer is switched back from composite ROI (when internal hole present) to ROI with just an outline as it used to be before 1.52i. If there is an internal hole, the roiManager(“measure”) would report larger area which includes area of the internal hole with 1.52n.

I have to modify some macros again to deal with the switch. I prefer the composite ROI when exclude internal hole is specified. It would be even better to add an option in the Particle Analyzer for specifying one of two options of generating ROI: one as composite ROI including internal holes, and the other only including the outlines of the particle. This added flexibility would simply some manipulations of the images, and more importantly, we would know and specify exactly what kind of ROI that we get from particle analyzer to ensure our program works the way it supposed to work. Thanks!


1 Like

Image 1.52n reverted to outline ROIs because the composite ROIs were causing macros to fail, it was not possible to get the correct perimeter of the composite ROIs, and it turned out to be easy to correctly measure outline ROIs with holes. All that is required is to set the threshold and use the “Limit to threshold” option.

The following macro runs the particle analyzer on an an image with particles with holes and compares the results to those from measuring the ROIs in the overlay.

  tolerance = 0.0000001;
  labels = newArray("Area","Mean","StdDev","Min","Max", "X","Y",
    "XM","YM","Perim.","Major","Angle", "Circ.","Feret");
  run("AuPbSn 40 (56K)");
  run("Set Measurements...", "area mean standard min centroid perimeter fit feret's");
  run("Analyze Particles...", "  show=Overlay clear");
  for (i=0; i<nResults; i++) {
     for (j=0; j<labels.length; j++) {
        label = labels[j];
        v1 = getResult(label,i);
        v2 = List.getValue(label);
        if (abs(v1-v2)>tolerance || (!isNaN(v1)&&isNaN(v2)) )
           print(label+"["+i+"]: "+v1+"  "+v2);