/** Replaces the ROI at the specified index. */ public void setRoi(Roi roi, int index) { if (index<0 || index>=rois.size()) throw new IllegalArgumentException("setRoi: Index out of range"); rois.set(index, (Roi)roi.clone()); updateShowAll(); }
/** Replaces the ROI at the specified index. */ public void setRoi(Roi roi, int index) { if (index<0 || index>=rois.size()) throw new IllegalArgumentException("setRoi: Index out of range"); rois.set(index, (Roi)roi.clone()); updateShowAll(); }
/** Clears this RoiManager so that it contains no ROIs. */ public void reset() { if (IJ.isMacOSX() && IJ.isMacro()) ignoreInterrupts = true; listModel.removeAllElements(); overlayTemplate = null; rois.clear(); updateShowAll(); }
/** Clears this RoiManager so that it contains no ROIs. */ public void reset() { if (IJ.isMacOSX() && IJ.isMacro()) ignoreInterrupts = true; listModel.removeAllElements(); overlayTemplate = null; rois.clear(); updateShowAll(); }
rois.add(roi); updateShowAll();
rois.add(roi); updateShowAll();
boolean update(boolean clone) { ImagePlus imp = getImage(); if (imp==null) return false; ImageCanvas ic = imp.getCanvas(); boolean showingAll = ic!=null && ic.getShowAllROIs(); Roi roi = imp.getRoi(); if (roi==null) { error("The active image does not have a selection."); return false; } int index = list.getSelectedIndex(); if (index<0 && !showingAll) return error("Exactly one item in the list must be selected."); if (index>=0) { if (clone) { String name = (String)listModel.getElementAt(index); Roi roi2 = (Roi)roi.clone(); roi2.setPosition(imp); roi.setName(name); roi2.setName(name); rois.set(index, roi2); } else rois.set(index, roi); } if (record()) Recorder.record("roiManager", "Update"); updateShowAll(); return true; }
boolean update(boolean clone) { ImagePlus imp = getImage(); if (imp==null) return false; ImageCanvas ic = imp.getCanvas(); boolean showingAll = ic!=null && ic.getShowAllROIs(); Roi roi = imp.getRoi(); if (roi==null) { error("The active image does not have a selection."); return false; } int index = list.getSelectedIndex(); if (index<0 && !showingAll) return error("Exactly one item in the list must be selected."); if (index>=0) { if (clone) { String name = (String)listModel.getElementAt(index); Roi roi2 = (Roi)roi.clone(); roi2.setPosition(imp); roi.setName(name); roi2.setName(name); rois.set(index, roi2); } else rois.set(index, roi); } if (record()) Recorder.record("roiManager", "Update"); updateShowAll(); return true; }
if (count>1 && index.length==1 && imp!=null) imp.deleteRoi(); updateShowAll(); if (record()) Recorder.record("roiManager", "Delete");
if (count>1 && index.length==1 && imp!=null) imp.deleteRoi(); updateShowAll(); if (record()) Recorder.record("roiManager", "Delete");
roiCopy.setStrokeColor(color); rois.add(roiCopy); updateShowAll(); if (record()) recordAdd(defaultColor, defaultLineWidth);
roiCopy.setStrokeColor(color); rois.add(roiCopy); updateShowAll(); if (record()) recordAdd(defaultColor, defaultLineWidth);