Opening external tools from VivoQuant via VivoScript

Opening external tools from VivoQuant via VivoScript

Sometimes it is useful to be able to start external programs from within VivoQuant. VivoScript provides a function for this:

VQ.startTool("ProgramName", baseDir, parameterList);

with ProgramName being a pre-configured name of the tool to start (see below on how to add your own tools), while the optional baseDir defines the current working directory the tool is started in. Finally, the parameterList is an array of optional parameters passed into the tool from the command line. Depending on the tool you are using such parameters could be used to for instance pass in files  to the new tool.

This features requires VivoQuant 1.23alpha29 or higher.

Adding new Tools


[acc_item title=”Windows: The easy way”]

An even easier way to add new tools might be to write a small reg-script and import that into the Windows registration editor. Open a text file in your favorite plain text editor (for instance in Windows’ Editor), and copy and paste this code:

Windows Registry Editor Version 5.00

"ImageJ"="C:\Program Files\ImageJ\ImageJ.exe"

After adjusting it to your needs, save this as a ‘tools.reg’ file and double click to import it (there will be warnings, however,¬† we know what we are doing).


[acc_item title=”Windows: The long way”]

For your own security VQ cannot just start any program installed on your computer, however, you have to add these tools first. On Windows this is done by adding an entry to HKEY_CURRENT_USER\Software\inviCRO\VivoQuant\Tools as shown below (please note you might have to create the Tools folder also, if no other tools have been added already):


  1. Find the VivoQuant entry under Software\inviCRO\VivoQuant under HKEY_CURRENT_USER in the left side bar.
  2. Unless available already: Create Tools entry, by right clicking on VivoQuant in the left bar, and choosing New|Key.
    Otherwise click on Tools.
  3. Click into the right field (under (Standard)) and select New|String, then give your new tool a name (see programName above, e.g. use ‘ImageJ’, ‘Matlab’, etc…); each tool needs its own unique name.
  4. Double click on your new name, and specify the path to the tool, e.g. something like ‘C:\Program Files\ImageJ\ImageJ.exe’

Your result should look similar to this now:



[acc_item title=”The Mac way”]

On your Mac open the Terminal application and copy and paste this to the command line:

defaults write com.inviCRO.VivoQuant 'Tools.ImageJ' '/Applications/ImageJ/'


[acc_item title=”The Linux way”]

Should you be using Linux, please open ‘~/.config/inviCRO/VivoQuant.conf’ and add a [Tools] section:




Using the new tool

Once you have setup the tools you need, you can call them from VivoScript and pass parameters to them. For instance, let us look at an application that opens the currently loaded reference image into ImageJ:

// define the output path here:
var path="C:/Users/lackas/Desktop/";

// Make sure data is loaded already:
if (VQ.dataManager().size() < 1) {
  VQ.showMessage("Please load a dataset first.");

// store DICOM data into local folder, reference image, multi-slice format
var filename = path+"export.dcm";
VQ.storeAsDICOM(filename, 0, 0); 

// start ImageJ with filename
var res = VQ.startTool("ImageJ", ".", [filename]);

// Check status
if (res != "Done") {
  VQ.showMessage("Error: "+res);

And here is the result of running the script with a mouse CT dataset opened:


Please feel free to leave questions or comments below.