@Override public ROI duplicate() { EllipseROI duplicate = new EllipseROI(); duplicate.x = x; duplicate.x2 = x2; duplicate.y= y; duplicate.y2 = y2; duplicate.c = c; duplicate.z = z; duplicate.t = t; return duplicate; }
@Override EllipseROI createROI(double x, double y, double width, double height, int c, int z, int t) { return new EllipseROI(x, y, width, height, c, z, t); }
private Object readResolve() { EllipseROI roi = new EllipseROI(x, y, x2-x, y2-y, c, z, t); return roi; }
public TMACoreObject(double x, double y, double width, double height, boolean isMissing) { super(new EllipseROI(x, y, width, height, -1, 0, 0), null); this.isMissing = isMissing; }
/** * Get a PathShape from an Area. * This will try to return a PathRectangleROI or PathPolygonROI if possible, * or PathAreaROI if neither of the other classes can adequately represent the area. * * In the input shape is an Ellipse2D then an EllipseROI will be returned. * * @param area * @param c * @param z * @param t * @param flatness - can be used to prefer polygons, see Shape.getPathIterator(AffineTransform at, double flatness) * @return */ public static PathShape getShapeROI(Shape shape, int c, int z, int t, double flatness) { if (shape instanceof Rectangle2D) { Rectangle2D bounds = shape.getBounds2D(); return new RectangleROI(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), c, z, t); } if (shape instanceof Ellipse2D) { Rectangle2D bounds = shape.getBounds2D(); return new EllipseROI(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), c, z, t); } return getShapeROI(new Area(shape), c, z, t, flatness); }
@Override public TranslatableROI translate(double dx, double dy) { if (dx == 0 && dy == 0) return this; // Shift the bounds return new EllipseROI(getBoundsX()+dx, getBoundsY()+dy, getBoundsWidth(), getBoundsHeight(), getC(), getZ(), getT()); }