public void run (ImageProcessor ip) { int fg = Prefs.blackBackground ? 255 : 0; foreground = ip.isInvertedLut() ? 255-fg : fg; background = 255 - foreground; ip.setSnapshotCopyMode(true); if (arg.equals("outline")) outline(ip); else if (arg.startsWith("fill")) fill(ip, foreground, background); else if (arg.startsWith("skel")) { ip.resetRoi(); skeletonize(ip); } else if (arg.equals("erode") || arg.equals("dilate")) doIterations((ByteProcessor)ip, arg); else if (arg.equals("open")) { doIterations(ip, "erode"); doIterations(ip, "dilate"); } else if (arg.equals("close")) { doIterations(ip, "dilate"); doIterations(ip, "erode"); } ip.setSnapshotCopyMode(false); ip.setBinaryThreshold(); }
void skeletonize(ImageProcessor ip) { if (Prefs.blackBackground) ip.invert(); boolean edgePixels = hasEdgePixels(ip); ImageProcessor ip2 = expand(ip, edgePixels); ((ByteProcessor)ip2).skeletonize(); ip = shrink(ip, ip2, edgePixels); if (Prefs.blackBackground) ip.invert(); }
if (gd.wasCanceled()) return DONE; if (imp==null) { //options dialog only, no do/preview dialogItemChanged(gd, null); //read dialog result return DONE;
if (gd.wasCanceled()) return DONE; if (imp==null) { //options dialog only, no do/preview dialogItemChanged(gd, null); //read dialog result return DONE;
public void run (ImageProcessor ip) { int fg = Prefs.blackBackground ? 255 : 0; foreground = ip.isInvertedLut() ? 255-fg : fg; background = 255 - foreground; ip.setSnapshotCopyMode(true); if (arg.equals("outline")) outline(ip); else if (arg.startsWith("fill")) fill(ip, foreground, background); else if (arg.startsWith("skel")) { ip.resetRoi(); skeletonize(ip); } else if (arg.equals("erode") || arg.equals("dilate")) doIterations((ByteProcessor)ip, arg); else if (arg.equals("open")) { doIterations(ip, "erode"); doIterations(ip, "dilate"); } else if (arg.equals("close")) { doIterations(ip, "dilate"); doIterations(ip, "erode"); } ip.setSnapshotCopyMode(false); ip.setBinaryThreshold(); }
void skeletonize(ImageProcessor ip) { if (Prefs.blackBackground) ip.invert(); boolean edgePixels = hasEdgePixels(ip); ImageProcessor ip2 = expand(ip, edgePixels); ((ByteProcessor)ip2).skeletonize(); ip = shrink(ip, ip2, edgePixels); if (Prefs.blackBackground) ip.invert(); }