Refine search
protected boolean updateROI(ImagePlus image) { Roi roi = image.getRoi(); if (roi == null || !(roi instanceof PolygonRoi)) { if (constructing && this.roi != null) return true; this.roi = null; return false; } if (this.roi == roi) return true; if (roi instanceof PolygonRoiPublic) this.roi = (PolygonRoiPublic)roi; else { this.roi = new PolygonRoiPublic((PolygonRoi)roi); image.setRoi(roi); roi.setImage(image); } return true; }
public ImageProcessor rotateLine(ImagePlus imp, int width) { Roi roi = imp.getRoi(); if (roi==null || roi.getType()!=Roi.LINE) throw new IllegalArgumentException("Straight line selection expected"); Polygon p = ((Line)roi).getPoints(); imp.setRoi(new PolygonRoi(p.xpoints, p.ypoints, 2, Roi.POLYLINE)); ImageProcessor ip2 = imp.getBitDepth()==24?straightenRGB(imp, width):straightenLine(imp, width); imp.setRoi(roi); return ip2; }
public ImageProcessor rotateLine(ImagePlus imp, int width) { Roi roi = imp.getRoi(); if (roi==null || roi.getType()!=Roi.LINE) throw new IllegalArgumentException("Straight line selection expected"); Polygon p = ((Line)roi).getPoints(); imp.setRoi(new PolygonRoi(p.xpoints, p.ypoints, 2, Roi.POLYLINE)); ImageProcessor ip2 = imp.getBitDepth()==24?straightenRGB(imp, width):straightenLine(imp, width); imp.setRoi(roi); return ip2; }
public void mousePressed(ImagePlus imp, MouseEvent e) { ImageCanvas ic = imp.getCanvas(); int sx = e.getX(); int sy = e.getY(); int ox = ic.offScreenX(sx); int oy = ic.offScreenY(sy); Roi roi = imp.getRoi(); int handle = roi!=null?roi.isHandle(ox, oy):-1; if (!(roi!=null && (roi instanceof Arrow) && (handle>=0||roi.contains(ox,oy)))) { arrow = new Arrow(sx, sy, imp); imp.setRoi(arrow, false); e.consume(); } }
public void mousePressed(ImagePlus imp, MouseEvent e) { ImageCanvas ic = imp.getCanvas(); int sx = e.getX(); int sy = e.getY(); int ox = ic.offScreenX(sx); int oy = ic.offScreenY(sy); Roi roi = imp.getRoi(); int handle = roi!=null?roi.isHandle(ox, oy):-1; if (!(roi!=null && (roi instanceof Arrow) && (handle>=0||roi.contains(ox,oy)))) { arrow = new Arrow(sx, sy, imp); imp.setRoi(arrow, false); e.consume(); } }
void addCircle(ImagePlus img, int x, int y, int width) { Roi roi = img.getRoi(); Roi roi2 = roi; if (roi2!=null) { if (!(roi2 instanceof ShapeRoi)) roi2 = new ShapeRoi(roi2); ((ShapeRoi)roi2).or(getCircularRoi(x, y, width)); roi2.copyAttributes(roi); } else roi2 = new OvalRoi(x-width/2, y-width/2, width, width); img.setRoi(roi2); }
void addCircle(ImagePlus img, int x, int y, int width) { Roi roi = img.getRoi(); Roi roi2 = roi; if (roi2!=null) { if (!(roi2 instanceof ShapeRoi)) roi2 = new ShapeRoi(roi2); ((ShapeRoi)roi2).or(getCircularRoi(x, y, width)); roi2.copyAttributes(roi); } else roi2 = new OvalRoi(x-width/2, y-width/2, width, width); img.setRoi(roi2); }
public synchronized static void unlabel(int x, int y, int z, int flags, int width) { Roi roi = IJ.getImage().getRoi(); if (roi != null) { if (!(roi instanceof ShapeRoi)) { roi = new ShapeRoi(roi); } ShapeRoi roiShape = (ShapeRoi) roi; roiShape.not(getBrushRoi(x, y, width)); IJ.getImage().setRoi(roi); } }