public void run(ImageProcessor ip) { if (arg.equals("clear")) clear(ip); else if (isTextRoi && (arg.equals("draw") || arg.equals("fill"))) draw(ip); else if (arg.equals("fill")) fill(ip); else if (arg.equals("draw")) draw(ip); else if (arg.equals("label")) label(ip); else if (arg.equals("outside")) clearOutside(ip); }
void drawLabel(ImageProcessor ip) { int count = Analyzer.getCounter(); if (count>0 && roi!=null) drawLabel(imp, ip, count, roi.getBounds()); }
/** * @deprecated * replaced by ImageProcessor.fill(Roi) */ public void fill(ImageProcessor ip) { ip.setColor(Toolbar.getForegroundColor()); if (isLineSelection()) { if (isStraightLine() && roi.getStrokeWidth()>1 && !(roi instanceof Arrow)) ip.fillPolygon(roi.getPolygon()); else roi.drawPixels(ip); } else ip.fill(); // fill with foreground color }
public void label(ImageProcessor ip) { if (!IJ.isMacro()) { IJ.error("Label", "To label a selection, enable \"Add to overlay\" in Analyze>\nSet Measurements and press 'm' (Analyze>Measure)."); return; } if (Analyzer.getCounter()==0) { IJ.error("Label", "Measurement counter is zero"); return; } if (Analyzer.firstParticle<Analyzer.lastParticle) drawParticleLabels(ip); else { ip.setColor(Toolbar.getForegroundColor()); ImageCanvas ic = imp.getCanvas(); if (ic!=null) { double mag = ic.getMagnification(); if (mag<1.0) { int lineWidth = 1; lineWidth = (int)(lineWidth/mag); ip.setLineWidth(lineWidth); } } roi.drawPixels(ip); ip.setLineWidth(1); drawLabel(ip); } }
if (isLineSelection()) { IJ.error("\"Clear Outside\" does not work with line selections."); return; Rectangle r = ip.getRoi(); if (mask==null) makeMask(ip, r); ip.setColor(Toolbar.getBackgroundColor()); int stackSize = imp.getStackSize();
return DONE; if (isTextRoi || isLineSelection()) return baseCapabilities; else
/** * @deprecated * replaced by ImageProcessor.fill(Roi) */ public void fill(ImageProcessor ip) { ip.setColor(Toolbar.getForegroundColor()); if (isLineSelection()) { if (isStraightLine() && roi.getStrokeWidth()>1 && !(roi instanceof Arrow)) ip.fillPolygon(roi.getPolygon()); else roi.drawPixels(ip); } else ip.fill(); // fill with foreground color }
public void label(ImageProcessor ip) { if (!IJ.isMacro()) { IJ.error("Label", "To label a selection, enable \"Add to overlay\" in Analyze>\nSet Measurements and press 'm' (Analyze>Measure)."); return; } if (Analyzer.getCounter()==0) { IJ.error("Label", "Measurement counter is zero"); return; } if (Analyzer.firstParticle<Analyzer.lastParticle) drawParticleLabels(ip); else { ip.setColor(Toolbar.getForegroundColor()); ImageCanvas ic = imp.getCanvas(); if (ic!=null) { double mag = ic.getMagnification(); if (mag<1.0) { int lineWidth = 1; lineWidth = (int)(lineWidth/mag); ip.setLineWidth(lineWidth); } } roi.drawPixels(ip); ip.setLineWidth(1); drawLabel(ip); } }
if (isLineSelection()) { IJ.error("\"Clear Outside\" does not work with line selections."); return; Rectangle r = ip.getRoi(); if (mask==null) makeMask(ip, r); ip.setColor(Toolbar.getBackgroundColor()); int stackSize = imp.getStackSize();
return DONE; if (isTextRoi || isLineSelection()) return baseCapabilities; else
public void run(ImageProcessor ip) { if (arg.equals("clear")) clear(ip); else if (isTextRoi && (arg.equals("draw") || arg.equals("fill"))) draw(ip); else if (arg.equals("fill")) fill(ip); else if (arg.equals("draw")) draw(ip); else if (arg.equals("label")) label(ip); else if (arg.equals("outside")) clearOutside(ip); }
public void clear(ImageProcessor ip) { ip.setColor(Toolbar.getBackgroundColor()); if (isLineSelection()) { if (isStraightLine() && roi.getStrokeWidth()>1) ip.fillPolygon(roi.getPolygon()); else roi.drawPixels(); } else if (roi!=null && roi instanceof TextRoi) ((TextRoi)roi).clear(ip); else ip.fill(); // fill with background color ip.setColor(Toolbar.getForegroundColor()); }
void drawLabel(ImageProcessor ip) { int count = Analyzer.getCounter(); if (count>0 && roi!=null) drawLabel(imp, ip, count, roi.getBounds()); }
public void clear(ImageProcessor ip) { ip.setColor(Toolbar.getBackgroundColor()); if (isLineSelection()) { if (isStraightLine() && roi.getStrokeWidth()>1) ip.fillPolygon(roi.getPolygon()); else roi.drawPixels(); } else if (roi!=null && roi instanceof TextRoi) ((TextRoi)roi).clear(ip); else ip.fill(); // fill with background color ip.setColor(Toolbar.getForegroundColor()); }
/** * @deprecated * replaced by ImageProcessor.draw(Roi) */ public void draw(ImageProcessor ip) { ip.setColor(Toolbar.getForegroundColor()); roi.drawPixels(ip); if (IJ.altKeyDown()) drawLabel(ip); }
/** * @deprecated * replaced by ImageProcessor.draw(Roi) */ public void draw(ImageProcessor ip) { ip.setColor(Toolbar.getForegroundColor()); roi.drawPixels(ip); if (IJ.altKeyDown()) drawLabel(ip); }
void drawParticleLabels(ImageProcessor ip) { ResultsTable rt = ResultsTable.getResultsTable(); int count = rt.size(); int first = Analyzer.firstParticle; int last = Analyzer.lastParticle; if (count==0 || first>=count || last>=count) return; if (!rt.columnExists(ResultsTable.X_CENTROID)) { IJ.error("Label", "\"Centroids\" required to label particles"); return; } for (int i=first; i<=last; i++) { int x = (int)rt.getValueAsDouble(ResultsTable.X_CENTROID, i); int y = (int)rt.getValueAsDouble(ResultsTable.Y_CENTROID, i); drawLabel(imp, ip, i+1, new Rectangle(x,y,0,0)); } }
void drawParticleLabels(ImageProcessor ip) { ResultsTable rt = ResultsTable.getResultsTable(); int count = rt.size(); int first = Analyzer.firstParticle; int last = Analyzer.lastParticle; if (count==0 || first>=count || last>=count) return; if (!rt.columnExists(ResultsTable.X_CENTROID)) { IJ.error("Label", "\"Centroids\" required to label particles"); return; } for (int i=first; i<=last; i++) { int x = (int)rt.getValueAsDouble(ResultsTable.X_CENTROID, i); int y = (int)rt.getValueAsDouble(ResultsTable.Y_CENTROID, i); drawLabel(imp, ip, i+1, new Rectangle(x,y,0,0)); } }