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(); }