private void resetSplineFitBoundingRect() { if (splinePoints==0) return; float xbase = (float)getXBase(); float ybase = (float)getYBase(); float xSpline0 = xSpline[0]; float ySpline0 = ySpline[0]; for (int i=0; i<splinePoints; i++) { xSpline[i] = xSpline[i]+xbase; ySpline[i] = ySpline[i]+ybase; } FloatPolygon poly = new FloatPolygon(xSpline, ySpline, splinePoints); Rectangle r = poly.getBounds(); x = r.x;; y = r.y; width = r.width; height = r.height; bounds = poly.getFloatBounds(); xbase = (float)bounds.x; ybase = (float)bounds.y; for (int i=0; i<splinePoints; i++) { xSpline[i] -= xbase; ySpline[i] -= ybase; } for (int i=0; i<nPoints; i++) { xpf[i] -= xSpline0 - xSpline[0]; ypf[i] -= ySpline0 - ySpline[0]; } }
private void resetSplineFitBoundingRect() { if (splinePoints==0) return; float xbase = (float)getXBase(); float ybase = (float)getYBase(); float xSpline0 = xSpline[0]; float ySpline0 = ySpline[0]; for (int i=0; i<splinePoints; i++) { xSpline[i] = xSpline[i]+xbase; ySpline[i] = ySpline[i]+ybase; } FloatPolygon poly = new FloatPolygon(xSpline, ySpline, splinePoints); Rectangle r = poly.getBounds(); x = r.x;; y = r.y; width = r.width; height = r.height; bounds = poly.getFloatBounds(); xbase = (float)bounds.x; ybase = (float)bounds.y; for (int i=0; i<splinePoints; i++) { xSpline[i] -= xbase; ySpline[i] -= ybase; } for (int i=0; i<nPoints; i++) { xpf[i] -= xSpline0 - xSpline[0]; ypf[i] -= ySpline0 - ySpline[0]; } }
private void resetSubPixelBoundingRect() { //IJ.log("resetSubPixelBoundingRect: "+state+" "+bounds); if (xSpline!=null) { resetSplineFitBoundingRect(); return; } float xbase = (float)getXBase(); float ybase = (float)getYBase(); for (int i=0; i<nPoints; i++) { xpf[i] = xpf[i]+xbase; ypf[i] = ypf[i]+ybase; } FloatPolygon poly = new FloatPolygon(xpf, ypf, nPoints); Rectangle r = poly.getBounds(); x = r.x;; y = r.y; width = r.width; height = r.height; bounds = poly.getFloatBounds(); xbase = (float)bounds.x; ybase = (float)bounds.y; for (int i=0; i<nPoints; i++) { xpf[i] -= xbase; ypf[i] -= ybase; } }
private void resetSubPixelBoundingRect() { //IJ.log("resetSubPixelBoundingRect: "+state+" "+bounds); if (xSpline!=null) { resetSplineFitBoundingRect(); return; } float xbase = (float)getXBase(); float ybase = (float)getYBase(); for (int i=0; i<nPoints; i++) { xpf[i] = xpf[i]+xbase; ypf[i] = ypf[i]+ybase; } FloatPolygon poly = new FloatPolygon(xpf, ypf, nPoints); Rectangle r = poly.getBounds(); x = r.x;; y = r.y; width = r.width; height = r.height; bounds = poly.getFloatBounds(); xbase = (float)bounds.x; ybase = (float)bounds.y; for (int i=0; i<nPoints; i++) { xpf[i] -= xbase; ypf[i] -= ybase; } }
private RectangleOverlay createRectangleOverlay(final Roi roi) { final RectangleOverlay overlay = new RectangleOverlay(getContext()); final RectangleRegionOfInterest region = overlay.getRegionOfInterest(); final FloatPolygon poly = roi.getFloatPolygon(); final Double bounds = poly.getFloatBounds(); region.setOrigin(bounds.x, 0); region.setOrigin(bounds.y, 1); region.setExtent(bounds.width, 0); region.setExtent(bounds.height, 1); assignPropertiesToOverlay(overlay, roi); return overlay; }
private EllipseOverlay createEllipseOverlay(final Roi roi) { final EllipseOverlay overlay = new EllipseOverlay(getContext()); final EllipseRegionOfInterest region = overlay.getRegionOfInterest(); final FloatPolygon poly = roi.getFloatPolygon(); final Double bounds = poly.getFloatBounds(); final double radiusX = bounds.width / 2.0; final double radiusY = bounds.height / 2.0; region.setOrigin(bounds.x + radiusX, 0); region.setOrigin(bounds.y + radiusY, 1); region.setRadius(radiusX, 0); region.setRadius(radiusY, 1); assignPropertiesToOverlay(overlay, roi); return overlay; }
width = r.width; height = r.height; bounds = poly.getFloatBounds(); float xbase = (float)bounds.getX(); float ybase = (float)bounds.getY();
width = r.width; height = r.height; bounds = poly.getFloatBounds(); float xbase = (float)bounds.getX(); float ybase = (float)bounds.getY();