linkedin
youtube
email

Opening external tools from VivoQuant via VivoScript

July 23, 2013
by Christian Lackas
ImageJ, startTool, VivoQuant, VivoScript, VQ
Comments are off

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:

VivoScript startTool()
JavaScript
1
2
VQ.startTool("ProgramName");
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

  • 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:

    1
    2
    3
    4
    Windows Registry Editor Version 5.00
     
    [HKEY_CURRENT_USER\Software\inviCRO\VivoQuant\Tools]
    "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).

  • 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):

    tools-regedit

    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:

    tools-imagej

  • The Mac way

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

    1
    defaults write com.inviCRO.VivoQuant 'Tools.ImageJ' '/Applications/ImageJ/ImageJ64.app/Contents/MacOS/JavaApplicationStub'

  • The Linux way

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

    1
    2
    3
    [Tools]
    LumiQuant=/opt/invicro/bin/lumiquant
    ImageJ=/usr/local/bin/imagej

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:

Open current DICOM data in ImageJ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 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.");
  VQ.abort();
}
 
// 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:

open-in-imagej

Please feel free to leave questions or comments below.

References

  • Download ImageJ: http://rsbweb.nih.gov/ij/download.html
  • VivoScript documentation: http://www.vivoquant.com/files/manual/vqscript.html
  • Download VivoQuant: http://www.vivoquant.com/
About the Author
Co-Founder and Managing Partner of inviCRO.
Social Share
  • google-share

Tags

1.23 2.0 3D Printing 3D ROI Tool Algorithms Automation Cite Dashboard dcmRep Excel ImageJ iPACS Mouse Movie MRI Office Otsu PET Projects Publications Quantitative queryStudies Reporting Rhesus ROIs SPECT startTool Testing Training VivoQuant VivoQuant 2.5 VivoQuant 3.0 VivoScript VQ XLS YouTube

Popular Posts Widget

Opening external tools from VivoQuant via VivoScript
No Responses.
Otsu Thresholding Segmentation with the 3D ROI Tool
No Responses.
VivoQuant 3.0 Release Webinar
No Responses.

Recent Posts

  • Selected Publications
  • Otsu Thresholding Segmentation with the 3D ROI Tool
  • VivoQuant 3.0 Release Webinar
  • iPACS reporting: Generating PowerPoint Presentations
  • VivoQuant 2.5 Release Webinar

Categories

  • Featured Images
  • iPACS
  • Uncategorized
  • VivoQuant
  • VivoScript
July 2013
M T W T F S S
    Apr »
1234567
891011121314
15161718192021
22232425262728
293031  

Categories

  • Featured Images
  • iPACS
  • Uncategorized
  • VivoQuant
  • VivoScript

Recent Posts

  • Selected Publications
  • Otsu Thresholding Segmentation with the 3D ROI Tool
  • VivoQuant 3.0 Release Webinar
  • iPACS reporting: Generating PowerPoint Presentations
  • VivoQuant 2.5 Release Webinar

Archives

  • June 2017
  • February 2017
  • January 2017
  • August 2016
  • January 2016
  • July 2015
  • May 2014
  • April 2014
  • July 2013
Copyright (c) inviCRO, LLC 2013