public double[] getFeretValues() { double a[] = super.getFeretValues(); double pw=1.0, ph=1.0; if (imp!=null) { Calibration cal = imp.getCalibration(); pw = cal.pixelWidth; ph = cal.pixelHeight; } double[] p = getParams(); double dx = (p[2] - p[0])*pw; double dy = (p[3] - p[1])*ph; double major = Math.sqrt(dx*dx+dy*dy); double minor = major*p[4]; a[0] = major; a[2] = (pw==ph)?minor:a[2]; return a; }
public double[] getFeretValues() { double a[] = super.getFeretValues(); double pw=1.0, ph=1.0; if (imp!=null) { Calibration cal = imp.getCalibration(); pw = cal.pixelWidth; ph = cal.pixelHeight; } double[] p = getParams(); double dx = (p[2] - p[0])*pw; double dy = (p[3] - p[1])*ph; double major = Math.sqrt(dx*dx+dy*dy); double minor = major*p[4]; a[0] = major; a[2] = (pw==ph)?minor:a[2]; return a; }
/** * Calculates the min feret diameter of the outer contour * @return The feret diameter of the outer contour. */ public double getMinFeretDiameter() { PolygonRoi proi = new PolygonRoi(outerContour, PolygonRoi.POLYLINE); ImagePlus imp = new ImagePlus(); imp.setCalibration(cal); proi.setImage(imp); return proi.getFeretValues()[2]; }