/** In the Overlay class in imageJ 1.46g and later. */ static int getIndex(Overlay overlay, String name) { if (name==null) return -1; Roi[] rois = overlay.toArray(); for (int i=rois.length-1; i>=0; i--) { if (name.equals(rois[i].getName())) return i; } return -1; }
/** In the Overlay class in imageJ 1.46g and later. */ static int getIndex(Overlay overlay, String name) { if (name==null) return -1; Roi[] rois = overlay.toArray(); for (int i=rois.length-1; i>=0; i--) { if (name.equals(rois[i].getName())) return i; } return -1; }
/** Returns the index of the ROI with the specified name, or -1 if not found. */ public int getIndex(String name) { if (name==null) return -1; Roi[] rois = toArray(); for (int i=rois.length-1; i>=0; i--) { if (name.equals(rois[i].getName())) return i; } return -1; }
/** Returns the index of the ROI with the specified name, or -1 if not found. */ public int getIndex(String name) { if (name==null) return -1; Roi[] rois = toArray(); for (int i=rois.length-1; i>=0; i--) { if (name.equals(rois[i].getName())) return i; } return -1; }
/** Removes all ROIs that have the specified name. */ public void remove(String name) { if (name==null) return; for (int i=size()-1; i>=0; i--) { if (name.equals(get(i).getName())) remove(i); } }
/** Removes all ROIs that have the specified name. */ public void remove(String name) { if (name==null) return; for (int i=size()-1; i>=0; i--) { if (name.equals(get(i).getName())) remove(i); } }
/** Copy the attributes (outline color, fill color, outline width) of 'roi2' to the this selection. */ public void copyAttributes(Roi roi2) { this. strokeColor = roi2. strokeColor; this.fillColor = roi2.fillColor; this.setStrokeWidth(roi2.getStrokeWidth()); this.setName(roi2.getName()); }
private void removeMIPfromOverlay(final Overlay overlay) { if (overlay != null && overlay.size() > 0) { for (int i = overlay.size() - 1; i >= 0; i--) { final String roiName = overlay.get(i).getName(); if (roiName != null && roiName.equals(OVERLAY_IDENTIFIER)) { overlay.remove(i); return; } } } }
/** Copy the attributes (outline color, fill color, outline width) of 'roi2' to the this selection. */ public void copyAttributes(Roi roi2) { this. strokeColor = roi2. strokeColor; this.fillColor = roi2.fillColor; this.setStrokeWidth(roi2.getStrokeWidth()); this.setName(roi2.getName()); }
String selectionName() { Roi roi = getImage().getRoi(); String name = null; if (roi==null) interp.error("No selection"); else name = roi.getName(); return name!=null?name:""; }
String selectionName() { Roi roi = getImage().getRoi(); String name = null; if (roi==null) interp.error("No selection"); else name = roi.getName(); return name!=null?name:""; }
/** Deselect the specified ROI if it is the only one selected. */ public void deselect(Roi roi) { int[] indexes = getSelectedIndexes(); if (indexes.length==1 && listModel.getSize()>0) { String label = (String)listModel.getElementAt(indexes[0]); if (label.equals(roi.getName())) { deselect(); repaint(); } } }
/** Deselect the specified ROI if it is the only one selected. */ public void deselect(Roi roi) { int[] indexes = getSelectedIndexes(); if (indexes.length==1 && listModel.getSize()>0) { String label = (String)listModel.getElementAt(indexes[0]); if (label.equals(roi.getName())) { deselect(); repaint(); } } }
public void saveRoi(ImagePlus imp) throws IOException{ Roi roi = imp.getRoi(); if (roi==null) throw new IllegalArgumentException("ROI required"); String name = roi.getName(); if (name==null) name = imp.getTitle(); SaveDialog sd = new SaveDialog("Save Selection...", name, ".roi"); name = sd.getFileName(); if (name == null) return; String dir = sd.getDirectory(); RoiEncoder re = new RoiEncoder(dir+name); re.write(roi); if (name.endsWith(".roi")) name = name.substring(0, name.length()-4); roi.setName(name); }
public void saveRoi(ImagePlus imp) throws IOException{ Roi roi = imp.getRoi(); if (roi==null) throw new IllegalArgumentException("ROI required"); String name = roi.getName(); if (name==null) name = imp.getTitle(); SaveDialog sd = new SaveDialog("Save Selection...", name, ".roi"); name = sd.getFileName(); if (name == null) return; String dir = sd.getDirectory(); RoiEncoder re = new RoiEncoder(dir+name); re.write(roi); if (name.endsWith(".roi")) name = name.substring(0, name.length()-4); roi.setName(name); }
public void mouseReleased(ImagePlus imp, MouseEvent e) { if (mode==RESIZING) { if (overlay!=null && overlay.size()>0 && CIRCLE_NAME.equals(overlay.get(overlay.size()-1).getName())) { overlay.remove(overlay.size()-1); imp.setOverlay(overlay); } overlay = null; if (e.isShiftDown()) { setWidth(width); Prefs.set(widthKey, width); } } }
public void mouseReleased(ImagePlus imp, MouseEvent e) { if (mode==RESIZING) { if (overlay!=null && overlay.size()>0 && CIRCLE_NAME.equals(overlay.get(overlay.size()-1).getName())) { overlay.remove(overlay.size()-1); imp.setOverlay(overlay); } overlay = null; if (e.isShiftDown()) { setWidth(width); Prefs.set(widthKey, width); } } }
private void assignPropertiesToOverlay(final Overlay overlay, final Roi roi) { overlay.setName(roi.getName()); overlay.setLineWidth(roi.getStrokeWidth()); final Color strokeColor = roi.getStrokeColor(); final Color fillColor = roi.getFillColor(); if (strokeColor != null) { overlay.setLineColor(AWTColors.getColorRGB(strokeColor)); } if (fillColor != null) { overlay.setFillColor(AWTColors.getColorRGBA(fillColor)); overlay.setAlpha(fillColor.getAlpha()); } }
private void showToolSize(int deltaWidth, ImagePlus imp) { if (deltaWidth !=0) { width = oldWidth + deltaWidth; if (width<1) width=1; Roi circle = new OvalRoi(xStart-width/2, yStart-width/2, width, width); circle.setName(CIRCLE_NAME); circle.setStrokeColor(Color.red); overlay = imp.getOverlay(); if (overlay==null) overlay = new Overlay(); else if (overlay.size()>0 && CIRCLE_NAME.equals(overlay.get(overlay.size()-1).getName())) overlay.remove(overlay.size()-1); overlay.add(circle); imp.setOverlay(overlay); } IJ.showStatus((isPencil?"Pencil":"Brush")+" width: "+ width); }
private void showToolSize(int deltaWidth, ImagePlus imp) { if (deltaWidth !=0) { width = oldWidth + deltaWidth; if (width<1) width=1; Roi circle = new OvalRoi(xStart-width/2, yStart-width/2, width, width); circle.setName(CIRCLE_NAME); circle.setStrokeColor(Color.red); overlay = imp.getOverlay(); if (overlay==null) overlay = new Overlay(); else if (overlay.size()>0 && CIRCLE_NAME.equals(overlay.get(overlay.size()-1).getName())) overlay.remove(overlay.size()-1); overlay.add(circle); imp.setOverlay(overlay); } IJ.showStatus((isPencil?"Pencil":"Brush")+" width: "+ width); }