GeneralPath path = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
for (int i = 0; i < polygons.size(); i++)
path.append((Polygon)polygons.get(i), false);
ShapeRoi shape = new ShapeRoi(path);
Roi roi = shape!=null?shape.shapeToRoi():null; // try to convert to non-composite ROI
IJ.showProgress(1,1);
if (roi!=null)
return roi;
else
return shape;