(ImagePlus imp)
| 571 | } |
| 572 | |
| 573 | void convexHull(ImagePlus imp) { |
| 574 | if (!imp.okToDeleteRoi()) return; |
| 575 | long startTime = System.currentTimeMillis(); |
| 576 | Roi roi = imp.getRoi(); |
| 577 | if (roi == null) { IJ.error("Convex Hull", "Selection required"); return; } |
| 578 | if (roi instanceof Line) { IJ.error("Convex Hull", "Area selection, point selection, or segmented or free line required"); return; } |
| 579 | FloatPolygon p = roi.getFloatConvexHull(); |
| 580 | if (p!=null) { |
| 581 | Undo.setup(Undo.ROI, imp); |
| 582 | imp.deleteRoi(); |
| 583 | Roi roi2 = new PolygonRoi(p, Roi.POLYGON); |
| 584 | transferProperties(roi, roi2); |
| 585 | imp.setRoi(roi2); |
| 586 | IJ.showTime(imp, startTime, "Convex Hull ", 1); |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | // Finds the index of the upper right point that is guaranteed to be on convex hull |
| 591 | /*int findFirstPoint(int[] xCoordinates, int[] yCoordinates, int n, ImagePlus imp) { |
no test coverage detected