private boolean deleteOverlayRoi(ImagePlus imp) { if (imp == null) return false; Overlay overlay = null; ImageCanvas ic = imp.getCanvas(); if (ic != null) overlay = ic.getShowAllList(); if (overlay == null) overlay = imp.getOverlay(); if (overlay == null) return false; Roi roi = imp.getRoi(); for (int i = 0; i < overlay.size(); i++) { Roi roi2 = overlay.get(i); if (roi2 == roi) { overlay.remove(i); imp.deleteRoi(); ic = imp.getCanvas(); if (ic != null) ic.roiManagerSelect(roi, true); return true; } } return false; }
void showGrid(Shape shape) { ImageCanvas ic = imp.getCanvas(); if (ic == null) return; if (shape == null) ic.setDisplayList(null); else ic.setDisplayList(shape, getColor(), null); }