/** Creates an OvalRoi. */ public static OvalRoi OvalRoi(double x, double y, double width, double height) { return new OvalRoi(x, y, width, height); }
/** Creates an OvalRoi. */ public static OvalRoi OvalRoi(double x, double y, double width, double height) { return new OvalRoi(x, y, width, height); }
static ShapeRoi getCircularRoi(int x, int y, int width) { return new ShapeRoi(new OvalRoi(x - width / 2, y - width / 2, width, width)); }
/** Draws an elliptical shape. */ public void drawOval(int x, int y, int width, int height) { if ((long)width*height>4*this.width*this.height) return; OvalRoi oval = new OvalRoi(x, y, width, height); drawPolygon(oval.getPolygon()); }
/** Fills an elliptical shape. */ public void fillOval(int x, int y, int width, int height) { if ((long)width*height>4*this.width*this.height) return; OvalRoi oval = new OvalRoi(x, y, width, height); fillPolygon(oval.getPolygon()); }
ShapeRoi getCircularRoi(int x, int y, int width) { if (poly==null) { Roi roi = new OvalRoi(x-width/2, y-width/2, width, width); poly = roi.getPolygon(); for (int i=0; i<poly.npoints; i++) { poly.xpoints[i] -= x; poly.ypoints[i] -= y; } } return new ShapeRoi(x, y, poly); }
private void drawRoi() { double x = xcenter - radius; double y = ycenter - radius; Roi roi = new OvalRoi(x, y, radius*2.0, radius*2.0); imp.setRoi(roi); showRadius(); }
private void drawRoi() { double x = xcenter - radius; double y = ycenter - radius; Roi roi = new OvalRoi(x, y, radius*2.0, radius*2.0); imp.setRoi(roi); showRadius(); }
ShapeRoi getCircularRoi(int x, int y, int width) { if (poly==null) { Roi roi = new OvalRoi(x-width/2, y-width/2, width, width); poly = roi.getPolygon(); for (int i=0; i<poly.npoints; i++) { poly.xpoints[i] -= x; poly.ypoints[i] -= y; } } return new ShapeRoi(x, y, poly); }
/** Draws an elliptical shape. */ public void drawOval(int x, int y, int width, int height) { if ((long)width*height>4*this.width*this.height) return; OvalRoi oval = new OvalRoi(x, y, width, height); drawPolygon(oval.getPolygon()); }
/** Fills an elliptical shape. */ public void fillOval(int x, int y, int width, int height) { if ((long)width*height>4*this.width*this.height) return; OvalRoi oval = new OvalRoi(x, y, width, height); fillPolygon(oval.getPolygon()); }
private static Roi enlargeRectOrOval(Roi roi, int n) { Rectangle bounds = roi.getBounds(); bounds.x -= n; bounds.y -= n; bounds.width += 2*n; bounds.height += 2*n; if (bounds.width<=0 || bounds.height<=0) return roi; if (roi.getType()==Roi.RECTANGLE) return new Roi(bounds.x, bounds.y, bounds.width, bounds.height); else return new OvalRoi(bounds.x, bounds.y, bounds.width, bounds.height); }
/** Creates an subpixel resolution oval selection. */ public static void makeOval(double x, double y, double width, double height) { if (width<=0 || height<0) getImage().deleteRoi(); else getImage().setRoi(new OvalRoi(x, y, width, height)); }
/** Creates an oval selection. Removes any existing selection if width or height are less than 1. */ public static void makeOval(int x, int y, int width, int height) { if (width<=0 || height<0) getImage().deleteRoi(); else { ImagePlus img = getImage(); img.setRoi(new OvalRoi(x, y, width, height)); } }
protected OvalRoi mark(int distance, Color color) { float intensity = image.get(slice, distance); int x = image.distance2x(distance); int y = image.intensity2y(intensity); OvalRoi roi = new OvalRoi(x - 10, y - 10, 20, 20); if (color != null) roi.setStrokeColor(color); return roi; }
/** Creates an oval selection. Removes any existing selection if width or height are less than 1. */ public static void makeOval(int x, int y, int width, int height) { if (width<=0 || height<0) getImage().deleteRoi(); else { ImagePlus img = getImage(); img.setRoi(new OvalRoi(x, y, width, height)); } }
/** Creates an subpixel resolution oval selection. */ public static void makeOval(double x, double y, double width, double height) { if (width<=0 || height<0) getImage().deleteRoi(); else getImage().setRoi(new OvalRoi(x, y, width, height)); }
@Override public OvalRoi convert(final Ellipsoid mask) { final RealLocalizable center = mask.center(); final double width = mask.semiAxisLength(0); final double height = mask.semiAxisLength(1); return new OvalRoi(center.getDoublePosition(0) - width, center .getDoublePosition(1) - height, width * 2, height * 2); }
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); }