/** Set the label font size with options. The options string can contain * 'scale' (enlarge labels when image zoomed), 'bold' * (display bold labels) or 'background' (display labels * with contrasting background. */ public void setLabelFontSize(int size, String options) { int style = Font.PLAIN; if (options!=null) { scalableLabels = options.contains("scale"); if (options.contains("bold")) style = Font.BOLD; drawBackgrounds = options.contains("back"); } labelFont = new Font("SansSerif", style, size); drawLabels(true); }
/** Set the label font size with options. The options string can contain * 'scale' (enlarge labels when image zoomed), 'bold' * (display bold labels) or 'background' (display labels * with contrasting background. */ public void setLabelFontSize(int size, String options) { int style = Font.PLAIN; if (options!=null) { scalableLabels = options.contains("scale"); if (options.contains("bold")) style = Font.BOLD; drawBackgrounds = options.contains("back"); } labelFont = new Font("SansSerif", style, size); drawLabels(true); }
void decodeOverlayOptions(Roi roi, int version, int options, int color, int fontSize) { Overlay proto = new Overlay(); proto.drawLabels((options&OVERLAY_LABELS)!=0); proto.drawNames((options&OVERLAY_NAMES)!=0); proto.drawBackgrounds((options&OVERLAY_BACKGROUNDS)!=0); if (version>=220 && color!=0) proto.setLabelColor(new Color(color)); boolean bold = (options&OVERLAY_BOLD)!=0; boolean scalable = (options&SCALE_LABELS)!=0; if (fontSize>0 || bold || scalable) { proto.setLabelFont(new Font("SansSerif", bold?Font.BOLD:Font.PLAIN, fontSize), scalable); } roi.setPrototypeOverlay(proto); }
void decodeOverlayOptions(Roi roi, int version, int options, int color, int fontSize) { Overlay proto = new Overlay(); proto.drawLabels((options&OVERLAY_LABELS)!=0); proto.drawNames((options&OVERLAY_NAMES)!=0); proto.drawBackgrounds((options&OVERLAY_BACKGROUNDS)!=0); if (version>=220 && color!=0) proto.setLabelColor(new Color(color)); boolean bold = (options&OVERLAY_BOLD)!=0; boolean scalable = (options&SCALE_LABELS)!=0; if (fontSize>0 || bold || scalable) { proto.setLabelFont(new Font("SansSerif", bold?Font.BOLD:Font.PLAIN, fontSize), scalable); } roi.setPrototypeOverlay(proto); }
void updateRoiList(Rectangle rect) { if (gel==null) return; if (overlay==null) { overlay = new Overlay(); overlay.drawLabels(true); overlay.setLabelColor(Color.white); overlay.drawBackgrounds(true); } overlay.add(new Roi(rect.x, rect.y, rect.width, rect.height, null)); gel.setOverlay(overlay); }
void updateRoiList(Rectangle rect) { if (gel==null) return; if (overlay==null) { overlay = new Overlay(); overlay.drawLabels(true); overlay.setLabelColor(Color.white); overlay.drawBackgrounds(true); } overlay.add(new Roi(rect.x, rect.y, rect.width, rect.height, null)); gel.setOverlay(overlay); }
/** Returns a new Overlay that has the same properties as this one. */ public Overlay create() { Overlay overlay2 = new Overlay(); overlay2.drawLabels(label); overlay2.drawNames(drawNames); overlay2.drawBackgrounds(drawBackgrounds); overlay2.setLabelColor(labelColor); overlay2.setLabelFont(labelFont, scalableLabels); overlay2.setIsCalibrationBar(isCalibrationBar); overlay2.selectable(selectable); return overlay2; }
/** Returns a new Overlay that has the same properties as this one. */ public Overlay create() { Overlay overlay2 = new Overlay(); overlay2.drawLabels(label); overlay2.drawNames(drawNames); overlay2.drawBackgrounds(drawBackgrounds); overlay2.setLabelColor(labelColor); overlay2.setLabelFont(labelFont, scalableLabels); overlay2.setIsCalibrationBar(isCalibrationBar); overlay2.selectable(selectable); return overlay2; }
/** * @deprecated * replaced by ImagePlus.setOverlay(ij.gui.Overlay) */ public void setDisplayList(Vector list) { if (list!=null) { Overlay list2 = new Overlay(); list2.setVector(list); setOverlay(list2); } else setOverlay(null); if (overlay!=null) overlay.drawLabels(overlay.size()>0&&overlay.get(0).getStrokeColor()==null); else customRoi = false; repaint(); }
/** * @deprecated * replaced by ImagePlus.setOverlay(ij.gui.Overlay) */ public void setDisplayList(Vector list) { if (list!=null) { Overlay list2 = new Overlay(); list2.setVector(list); setOverlay(list2); } else setOverlay(null); if (overlay!=null) overlay.drawLabels(overlay.size()>0&&overlay.get(0).getStrokeColor()==null); else customRoi = false; repaint(); }
public void setPrototypeOverlay(Overlay overlay) { prototypeOverlay = new Overlay(); prototypeOverlay.drawLabels(overlay.getDrawLabels()); prototypeOverlay.drawNames(overlay.getDrawNames()); prototypeOverlay.drawBackgrounds(overlay.getDrawBackgrounds()); prototypeOverlay.setLabelColor(overlay.getLabelColor()); prototypeOverlay.setLabelFont(overlay.getLabelFont(), overlay.scalableLabels()); }
public void setPrototypeOverlay(Overlay overlay) { prototypeOverlay = new Overlay(); prototypeOverlay.drawLabels(overlay.getDrawLabels()); prototypeOverlay.drawNames(overlay.getDrawNames()); prototypeOverlay.drawBackgrounds(overlay.getDrawBackgrounds()); prototypeOverlay.setLabelColor(overlay.getLabelColor()); prototypeOverlay.setLabelFont(overlay.getLabelFont(), overlay.scalableLabels()); }
/** Moves all the ROIs to the specified image's overlay. */ public void moveRoisToOverlay(ImagePlus imp) { if (imp==null) return; Roi[] rois = getRoisAsArray(); int n = rois.length; Overlay overlay = imp.getOverlay(); if (overlay==null) overlay = newOverlay(); for (int i=0; i<n; i++) { Roi roi = (Roi)rois[i].clone(); if (!Prefs.showAllSliceOnly && !IJ.isMacro()) roi.setPosition(0); //if (roi.getStrokeWidth()==1) // roi.setStrokeWidth(0); overlay.add(roi); } if (overlayTemplate!=null) overlay.drawLabels(overlayTemplate.getDrawLabels()); imp.setOverlay(overlay); if (imp.getCanvas()!=null) setOverlay(imp, null); }
/** Moves all the ROIs to the specified image's overlay. */ public void moveRoisToOverlay(ImagePlus imp) { if (imp==null) return; Roi[] rois = getRoisAsArray(); int n = rois.length; Overlay overlay = imp.getOverlay(); if (overlay==null) overlay = newOverlay(); for (int i=0; i<n; i++) { Roi roi = (Roi)rois[i].clone(); if (!Prefs.showAllSliceOnly && !IJ.isMacro()) roi.setPosition(0); //if (roi.getStrokeWidth()==1) // roi.setStrokeWidth(0); overlay.add(roi); } if (overlayTemplate!=null) overlay.drawLabels(overlayTemplate.getDrawLabels()); imp.setOverlay(overlay); if (imp.getCanvas()!=null) setOverlay(imp, null); }
private Overlay newOverlay() { Overlay overlay = OverlayLabels.createOverlay(); overlay.drawLabels(labelsCheckbox.getState()); if (overlay.getLabelFont()==null && overlay.getLabelColor()==null) { overlay.setLabelColor(Color.white); overlay.drawBackgrounds(true); } overlay.drawNames(Prefs.useNamesAsLabels); if (overlayTemplate!=null) { overlay.drawNames(overlayTemplate.getDrawNames()); overlay.drawBackgrounds(overlayTemplate.getDrawBackgrounds()); overlay.setLabelColor(overlayTemplate.getLabelColor()); overlay.setLabelFont(overlayTemplate.getLabelFont(), overlayTemplate.scalableLabels()); } return overlay; }
void setOverlay(ImagePlus imp, byte[][] rois) { Overlay overlay = new Overlay(); Overlay proto = null; for (int i=0; i<rois.length; i++) { Roi roi = RoiDecoder.openFromByteArray(rois[i]); if (roi==null) continue; if (proto==null) { proto = roi.getPrototypeOverlay(); overlay.drawLabels(proto.getDrawLabels()); overlay.drawNames(proto.getDrawNames()); overlay.drawBackgrounds(proto.getDrawBackgrounds()); overlay.setLabelColor(proto.getLabelColor()); overlay.setLabelFont(proto.getLabelFont(), proto.scalableLabels()); } overlay.add(roi); } imp.setOverlay(overlay); }
void setOverlay(ImagePlus imp, byte[][] rois) { Overlay overlay = new Overlay(); Overlay proto = null; for (int i=0; i<rois.length; i++) { Roi roi = RoiDecoder.openFromByteArray(rois[i]); if (roi==null) continue; if (proto==null) { proto = roi.getPrototypeOverlay(); overlay.drawLabels(proto.getDrawLabels()); overlay.drawNames(proto.getDrawNames()); overlay.drawBackgrounds(proto.getDrawBackgrounds()); overlay.setLabelColor(proto.getLabelColor()); overlay.setLabelFont(proto.getLabelFont(), proto.scalableLabels()); } overlay.add(roi); } imp.setOverlay(overlay); }
private Overlay newOverlay() { Overlay overlay = OverlayLabels.createOverlay(); overlay.drawLabels(labelsCheckbox.getState()); if (overlay.getLabelFont()==null && overlay.getLabelColor()==null) { overlay.setLabelColor(Color.white); overlay.drawBackgrounds(true); } overlay.drawNames(Prefs.useNamesAsLabels); if (overlayTemplate!=null) { overlay.drawNames(overlayTemplate.getDrawNames()); overlay.drawBackgrounds(overlayTemplate.getDrawBackgrounds()); overlay.setLabelColor(overlayTemplate.getLabelColor()); overlay.setLabelFont(overlayTemplate.getLabelFont(), overlayTemplate.scalableLabels()); } return overlay; }
public void run(String arg) { imp = WindowManager.getCurrentImage(); overlay = null; if (imp!=null) { ImageCanvas ic = imp.getCanvas(); if (ic!=null) overlay = ic.getShowAllList(); if (overlay==null) overlay = imp.getOverlay(); } if (overlay==null) overlay = defaultOverlay; showDialog(); if (!gd.wasCanceled()) { defaultOverlay.drawLabels(overlay.getDrawLabels()); defaultOverlay.drawNames(overlay.getDrawNames()); defaultOverlay.drawBackgrounds(overlay.getDrawBackgrounds()); defaultOverlay.setLabelColor(overlay.getLabelColor()); defaultOverlay.setLabelFont(overlay.getLabelFont()); } }
public void run(String arg) { imp = WindowManager.getCurrentImage(); overlay = null; if (imp!=null) { ImageCanvas ic = imp.getCanvas(); if (ic!=null) overlay = ic.getShowAllList(); if (overlay==null) overlay = imp.getOverlay(); } if (overlay==null) overlay = defaultOverlay; showDialog(); if (!gd.wasCanceled()) { defaultOverlay.drawLabels(overlay.getDrawLabels()); defaultOverlay.drawNames(overlay.getDrawNames()); defaultOverlay.drawBackgrounds(overlay.getDrawBackgrounds()); defaultOverlay.setLabelColor(overlay.getLabelColor()); defaultOverlay.setLabelFont(overlay.getLabelFont()); } }