VQScript, or VivoScript, is an implementation of ECMAScript (JavaScript) that allows users to access large parts of VivoQuant.
JavaScript structures
VQScript syntax is identical to JavaScript syntax.
Loop
for (var i=0; i<10; ++i) {
...
}
Function
function blub() { ... }
function bar(p1, p2, p3) { return p1+p2+p2; }
var res = bar(1,2,3);
Array
var array = new Array();
array[0] = 'foo';
array[1] = 'bar';
var array2 = new Array('foo', 'bar');
var array3 = [ 'foo', 'bar' ];
var last = array2.pop(); // remove and get last element
array2.push('burp'); // add element
Other array functions are, for instance, concat
, join
, reverse
, sort
, unshift
, shift
.
The VQScript Toolbar
Adding Script Shortcuts to the Toolbar
Shortcuts for commonly executed VQScripts can be added to the Quick Scripts menu on the VQScript toolbar
To add a Quick Script shortcut:
-
Go to Tools->Configuration and click on the VivoScript tab.
- Select a script for which quick access is desired by clicking the Add Quick Script button and navigating to the directory where the script is saved.
- Add a nickname for the script in the dialog box that appears.
- The script will now appear in the configuration window as well as in the Quick Scripts menu on the VQScript toolbar.
Quick Scripts can be edited directly from the VQScript toolbar by clicking on the Edit VivoScript button . A window will appear in which the user can edit the script.
Using the Peek Tool
The Peek Tool is used to reveal the names of elements (called widgets) in the operator GUIs for use in scripts. The command VQ.getWidget("widgetName")
can then be used to interact with these elements.
For example, to determine the name of the button in the 3D ROI Tool that resets all ROIs, click on the Peek button on VivoQuant’s top bar, and then click on the desired button in the 3D ROI Tool operator box. A yellow box containing the class and name of the selected button will be displayed.
Then, the command VQ.getWidget("buttonResetROIs").click()
ca be used to click the button and reset all ROIs.
VQScript Examples
Included with VivoQuant are 30 VQScript example scripts to help you get started working with VQScript. These scripts illustrate some of the many ways VQScript may be used to streamline workflows in VivoQuant. To learn more about each files, see the VQScript Example Scripts page.
VQScript Classes
Click here to see the list of VivoScript Classes.