public void drawEllipse(ImageProcessor ip) { if (ef!=null) ef.drawEllipse(ip); }
private void fitEllipse(){ if(fittedEllipse==null){ fittedEllipse = new EllipseFitter(); Rectangle r = outerContour.getBounds(); ImagePlus help = NewImage.createByteImage("", r.width+1, r.height+1, 1, NewImage.FILL_WHITE); ByteProcessor ip = (ByteProcessor) help.getProcessor(); ip.setColor(Color.black); Polygon p = new Polygon(outerContour.xpoints, outerContour.ypoints, outerContour.npoints); p.translate(-r.x, -r.y); ip.resetRoi(); ip.setRoi(p); fittedEllipse.fit(ip, null); } }
computeSums(); getMoments(); m4 = 4.0 * Math.abs(u02 * u20 - u11 * u11); if (m4 < 0.000001)
/** Fits an ellipse to the current ROI. The 'stats' argument, currently not used, can be null. The fit parameters are returned in public fields. */ public void fit(ImageProcessor ip, ImageStatistics stats) { this.ip = ip; mask = ip.getMaskArray(); Rectangle r = ip.getRoi(); left = r.x; top = r.y; width = r.width; height = r.height; getEllipseParam(); }
rmajor2 = 1.0 / sqr(major/2); rminor2 = 1.0 / sqr(minor/2); g11 = rmajor2 * sqr(cost) + rminor2 * sqr(sint); g12 = (rmajor2 - rminor2) * sint * cost; g22 = rmajor2 * sqr(sint) + rminor2 * sqr(cost); k1 = -g12 / g11; k2 = (sqr(g12) - g11 * g22) / sqr(g11); k3 = 1.0 / g11; ymax = (int)Math.floor(Math.sqrt(Math.abs(k3 / k2))); j2 = Math.sqrt(k2 * sqr(y) + k3); j1 = k1 * y; txmin[y] = (int)Math.round(j1 - j2);
ef = new EllipseFitter(); ef.fit(ip, this); if (limitToThreshold) { if (originalMask==null)
computeSums(); getMoments(); m4 = 4.0 * Math.abs(u02 * u20 - u11 * u11); if (m4 < 0.000001)
/** Fits an ellipse to the current ROI. The 'stats' argument, currently not used, can be null. The fit parameters are returned in public fields. */ public void fit(ImageProcessor ip, ImageStatistics stats) { this.ip = ip; mask = ip.getMaskArray(); Rectangle r = ip.getRoi(); left = r.x; top = r.y; width = r.width; height = r.height; getEllipseParam(); }
rmajor2 = 1.0 / sqr(major/2); rminor2 = 1.0 / sqr(minor/2); g11 = rmajor2 * sqr(cost) + rminor2 * sqr(sint); g12 = (rmajor2 - rminor2) * sint * cost; g22 = rmajor2 * sqr(sint) + rminor2 * sqr(cost); k1 = -g12 / g11; k2 = (sqr(g12) - g11 * g22) / sqr(g11); k3 = 1.0 / g11; ymax = (int)Math.floor(Math.sqrt(Math.abs(k3 / k2))); j2 = Math.sqrt(k2 * sqr(y) + k3); j1 = k1 * y; txmin[y] = (int)Math.round(j1 - j2);
ef = new EllipseFitter(); ef.fit(ip, this); if (limitToThreshold) { if (originalMask==null)
public void drawEllipse(ImageProcessor ip) { if (ef!=null) ef.drawEllipse(ip); }
/** Generates the xCoordinates, yCoordinates public arrays that can be used to create an ROI. */ public void makeRoi(ImageProcessor ip) { record = true; int size = ip.getHeight()*3; xCoordinates = new int[size]; yCoordinates = new int[size]; nCoordinates = 0; drawEllipse(ip); record = false; }
/** Generates the xCoordinates, yCoordinates public arrays that can be used to create an ROI. */ public void makeRoi(ImageProcessor ip) { record = true; int size = ip.getHeight()*3; xCoordinates = new int[size]; yCoordinates = new int[size]; nCoordinates = 0; drawEllipse(ip); record = false; }