macro "Remove Black Edge Objects" { /* Requires Versatile Wand plugin v220202 1st version PJL Updated functions: 5/16/2022 1:46 PM v220614 Simplified. v220630 Added restore settings. v220818 Removed need for restoreExit and saveSettings etc. v230601 Assumes visual "black" so assumes that this is the case for an inverted LUT as well. */ macroL = "Remove_Black_Edge_Objects_v230601.ijm"; if (!checkForPlugin("versatile_wand_tool") && !checkForPlugin("Versatile_Wand_Tool")) exit(macroL + ": Versatile Wand Tool required"); bDepth = bitDepth(); if (is("Inverting LUT")){ run("Invert LUT"); run("Invert"); invertedLUT = true; } else invertedLUT = false; run("Canvas Size...", "width="+(Image.width+2)+" height="+(Image.height+2)+" position=Center zero"); call("Versatile_Wand_Tool.doWand", 0, 0, 0.0, 0.0, 0.0, "8-connected"); if (bDepth==8 || bDepth==24) setBackgroundColor(255, 255, 255); else if (bDepth==16) setBackgroundColor(65535, 65535, 65535); run("Clear", "slice"); run("Canvas Size...", "width="+(Image.width-2)+" height="+(Image.height-2)+" position=Center zero"); if (invertedLUT){ run("Invert LUT"); run("Invert"); } } /* ( 8(|) ( 8(|) All ASC Functions @@@@@:-) @@@@@:-) */ function checkForPlugin(pluginName) { /* v161102 changed to true-false v180831 some cleanup v210429 Expandable array version v220510 Looks for both class and jar if no extension is given v220818 Mystery issue fixed, no longer requires restoreExit */ pluginCheck = false; if (getDirectory("plugins") == "") print("Failure to find any plugins!"); else { pluginDir = getDirectory("plugins"); if (lastIndexOf(pluginName,".")==pluginName.length-1) pluginName = substring(pluginName,0,pluginName.length-1); pExts = newArray(".jar",".class"); knownExt = false; for (j=0; j