/** Returns the name of the ROI with the specified index. Can be called from a macro using <pre>call("ij.plugin.frame.RoiManager.getName", index)</pre> Returns "null" if the Roi Manager is not open or index is out of range. */ public static String getName(String index) { int i = (int)Tools.parseDouble(index, -1); RoiManager instance = getInstance2(); if (instance!=null && i>=0 && i<instance.getCount()) return (String) instance.listModel.getElementAt(i); else return "null"; }
/** Returns the name of the ROI with the specified index. Can be called from a macro using <pre>call("ij.plugin.frame.RoiManager.getName", index)</pre> Returns "null" if the Roi Manager is not open or index is out of range. */ public static String getName(String index) { int i = (int)Tools.parseDouble(index, -1); RoiManager instance = getInstance2(); if (instance!=null && i>=0 && i<instance.getCount()) return (String) instance.listModel.getElementAt(i); else return "null"; }
void fromRoiManager() { ImagePlus imp = IJ.getImage(); RoiManager rm = RoiManager.getInstance2(); if (rm==null) { IJ.error("ROI Manager is not open"); return; } Roi[] rois = rm.getRoisAsArray(); if (rois.length==0) { IJ.error("ROI Manager is empty"); return; } rm.moveRoisToOverlay(imp); imp.deleteRoi(); }
void fromRoiManager() { ImagePlus imp = IJ.getImage(); RoiManager rm = RoiManager.getInstance2(); if (rm==null) { IJ.error("ROI Manager is not open"); return; } Roi[] rois = rm.getRoisAsArray(); if (rois.length==0) { IJ.error("ROI Manager is empty"); return; } rm.moveRoisToOverlay(imp); imp.deleteRoi(); }
void toRoiManager() { ImagePlus imp = IJ.getImage(); Overlay overlay = imp.getOverlay(); if (overlay==null) { IJ.error("Overlay required"); return; } RoiManager rm = RoiManager.getInstance2(); if (rm==null) rm = new RoiManager(); if (overlay.size()>=4 && overlay.get(3).getPosition()!=0) Prefs.showAllSliceOnly = true; rm.setOverlay(overlay); imp.setOverlay(null); }
void toRoiManager() { ImagePlus imp = IJ.getImage(); Overlay overlay = imp.getOverlay(); if (overlay==null) { IJ.error("Overlay required"); return; } RoiManager rm = RoiManager.getInstance2(); if (rm==null) rm = new RoiManager(); if (overlay.size()>=4 && overlay.get(3).getPosition()!=0) Prefs.showAllSliceOnly = true; rm.setOverlay(overlay); imp.setOverlay(null); }
RoiManager rm = RoiManager.getInstance2(); if (rm == null) rm = new RoiManager();