public double getDiamaterMaximumInscribedCircle() { ImagePlus help = generateBlobImage(this); ImageProcessor ipHelp = help.getProcessor(); ipHelp.invert(); EDM dm = new EDM(); FloatProcessor fp = dm.makeFloatEDM (ipHelp, 0, false); MaximumFinder mf = new MaximumFinder(); ByteProcessor bp = mf.findMaxima(fp, 0.5, ImageProcessor.NO_THRESHOLD, MaximumFinder.SINGLE_POINTS, false, true); Polygon pl = mf.getMaxima(bp, 0, true); return fp.getf(pl.xpoints[0], pl.ypoints[0])*2*cal.getX(1); }
private static Roi shrink(Roi roi, int n) { Rectangle bounds = roi.getBounds(); int width = bounds.width + 2; int height = bounds.height + 2; ImageProcessor ip = new ByteProcessor(width, height); roi.setLocation(1, 1); ip.setColor(255); ip.fill(roi); roi.setLocation(bounds.x, bounds.y); boolean bb = Prefs.blackBackground; Prefs.blackBackground = true; new EDM().toEDM(ip); Prefs.blackBackground = bb; ip.setThreshold(n+1, 255, ImageProcessor.NO_LUT_UPDATE); Roi roi2 = (new ThresholdToSelection()).convert(ip); if (roi2==null) return roi; Rectangle bounds2 = roi2.getBounds(); if (bounds2.width<=0 && bounds2.height<=0) return roi; roi2.setLocation(bounds.x+bounds2.x-1, bounds.y+bounds2.y-1); return roi2; }
private static Roi shrink(Roi roi, int n) { Rectangle bounds = roi.getBounds(); int width = bounds.width + 2; int height = bounds.height + 2; ImageProcessor ip = new ByteProcessor(width, height); roi.setLocation(1, 1); ip.setColor(255); ip.fill(roi); roi.setLocation(bounds.x, bounds.y); boolean bb = Prefs.blackBackground; Prefs.blackBackground = true; new EDM().toEDM(ip); Prefs.blackBackground = bb; ip.setThreshold(n+1, 255, ImageProcessor.NO_LUT_UPDATE); Roi roi2 = (new ThresholdToSelection()).convert(ip); if (roi2==null) return roi; Rectangle bounds2 = roi2.getBounds(); if (bounds2.width<=0 && bounds2.height<=0) return roi; roi2.setLocation(bounds.x+bounds2.x-1, bounds.y+bounds2.y-1); return roi2; }
boolean bb = Prefs.blackBackground; Prefs.blackBackground = true; new EDM().toEDM(ip);
boolean bb = Prefs.blackBackground; Prefs.blackBackground = true; new EDM().toEDM(ip);