/* BARlib.ijm * IJ BAR: https://github.com/tferr/Scripts#scripts * * Common BAR library (https://github.com/tferr/Scripts/tree/master/lib#lib) to be * placed in BAR/lib. This file can host functions to be used across your macros. * To load these scripting additions, append the following to your macro files: * * libPath = call('bar.Utils.getLibDir') + 'BARlib.ijm'; * libContents = File.openAsString(libPath); * call('ij.macro.Interpreter.setAdditionalFunctions', libContents); * * Once a new instance of the macro interpreter is initiated (http://fiji.sc/BAR#FAQ), * you can confirm the availability of new additions by running: * * confirmLoading(); */ /////////// UTILITIES /////////// /** Acknowledges accessibility to this file */ function confirmLoading() { showMessage("BAR lib successfully loaded!"); } /** Returns text from the system clipboard or an empty string if no text was found */ function getClipboardText() { return String.paste; //IJM already has a built-in function for this task } /** Returns a random uuid */ function randomString(length, spacers) { template = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; nChars = lengthOf(template); string = ""; for (i=0; i