VivoQuant 6.5.0
Loading...
Searching...
No Matches
VQ Class Reference

Description

Main VivoScript object to access other modules and perform generic actions.

Signals

void runningChanged (bool running)
 Emitted when a script or console command starts, and when it ends.

Public Member Functions

void setVersion (string version)
 Set a string representing the script version that will be used in audit log messages.
string getVersion ()
 Get the string representing the script version.
void askForCancelReason (bool ask)
 Set whether a prompt asks for a reason if the user cancels the script, which can be written to the audit trail.
bool isAskingForCancelReason ()
 Whether a prompt will asks for a reason if the user cancels the script, which can be written to the audit trail.
void debug (string text)
 Prints output to debugger and/or logfile.
Object mainWin ()
 Returns Main Window object.
Object bedRemovalTool ()
 Returns advanced bedremoval object.
Object matrixManipulationTool ()
 Returns Matrix Manipulation object.
Object dataManager ()
 Returns Data Manager object.
Object dataList ()
 Returns dataList object.
Object sliceViewer ()
 Returns Slice View object.
Object multiViewer ()
 Returns Multi View object.
Object controller ()
 Returns Slice View Controller object.
Object mipController ()
 Returns mipController object.
Object vtkController ()
 Returns VTK Controller object.
Object vtkViewer ()
 Returns vtkViewer object.
Object workList ()
 Returns "Worklist" object.
Object visibilityManager ()
 Returns Visibility Manager object.
Object BrainAtlasTool (bool visible=true, bool quiet=false)
 Opens the Brain Atlas Tool.
Object MASTool (string libraryPath=string(""))
 Opens Multi-Atlas Segmentation Tool, formerly known as Whole Body Atlas).
void quit ()
 Quits VivoQuant, asking the user first if the session is interactive (see isInteractive()).
Index index (int i)
 Get a script image index object used to reference data in the Data Manager The index should be passed directly to function, ie: var t = op.testFunc(VQ.index(1));.
Index index (int i, int j)
 Get a script image index object used to reference data in the Data Manager The index should be passed directly to function, ie: var t = op.testFunc(VQ.index(0,1));.
Index flatIndex (int i)
 Get a script flat image index object used to reference data in the Data Manager The index should be passed directly to function, ie: var t = op.testFunc(VQ.flatIndex(1));.
Object getIndexContainer (int i)
 Get a script image index container used to reference data in the Data Manager. Use .get() function of the container to access the internal index.
Object getIndexContainer (int i, int j)
 Get a script image index container used to reference data in the Data Manager. Use .get() function of the container to access the internal index.
string counter (int c, int s)
 Convenience function to return a 0-padded counter.
void showMessage (string msg, bool modal=true)
 Displays dialog box with user-defined message.
bool askYesNoQuestion (string msg, bool modal=true)
 Displays dialog box with "Yes" or "No" option.
Object progressDialog (string label, string cancelButtonText, int minimum, int maximum)
 Returns a progress dialog object, which can be used to show the current state of a longer process.
VariantMap getValues (string title, VariantMap &map, bool modal=true)
 Displays a dialog requesting multiple user inputs in a single form.
Object getLocalPath (string caption="Select directory:", string startDir=string("."))
 Returns path of directory selected by user in file dialog.
Object getSavePath (string caption=string("Select output file:"), string startDir=string("."), string filter=string())
 Returns path to file selected by user in file dialog.
Array< string > getLocalFiles (string caption="Select files:", string startDir=string("."))
 Returns array of paths to files selected by user in file dialog.
string getVivoScriptDir ()
 Returns VivoScript directory.
void mkdir (string path, string subdir)
 Creates sub-directory at specified path.
bool fileExists (string path)
 Checks whether file at specified path exists.
bool folderExists (string path)
 Checks whether file at specified path exists.
Array< string > listFiles (string folder, string pattern)
 Lists the files under a folder and all its subfolders whose name matches a wildcard pattern.
bool openFileExternally (string path)
 Opens a local file in an external application.
Object minMaxTool ()
 Returns Min Max Tool object.
Object histogramTool ()
 Returns Histogram tool object.
bool isInteractive ()
 Checks whether the current VivoQuant session is interactive.
void setInteractive (bool b)
 Sets whether VivoQuant shows dialogs (see isInteractive()).
void updateProcessingParameters ()
 Update the ITK and VTK thread settings based on the config.
bool isTestMode ()
 Checks whether current VivoQuant session is in test mode.
void setTestMode (bool b=true)
 Sets VivoQuant to test mode (or not).
string lumiQuantMaster ()
 Returns LumiQuant master settings file from VivoQuant directory.
Object dicomBrowser (AbstractDicomRepository *rep)
 Returns VivoQuant's Data Browser object for a given DICOM repository.
Object dcmRep (string text)
 Creates and returns a DICOM repository object.
Object currentDcmRep ()
 Returns the DICOM repository object corresponding to the repository that is currently active in the DICOM Browser.
Object loadRepository (string name)
 Returns DICOM repository object from DICOM repository saved in VivoQuant.
Object getListOfRepositories (string type=string())
 Returns array of repositories stored in VivoQuant.
void abort ()
 Aborts current script.
Object queryStudies (AbstractDicomRepository *rep, string patientName, string patientID=string(), string dateRange=string(), string studyDesc=string())
 Performs query of DICOM repository for studies matching argument criteria.
Object querySeries (AbstractDicomRepository *rep, string studyInstanceUID)
 Performs query of DICOM repository for series within a given study, and returns series matching criteria.
Object queryImages (AbstractDicomRepository *rep, string studyInstanceUID, string seriesInstanceUID)
 Performs query of DICOM repository for images within a series, and returns images matching criteria.
Object query (AbstractDicomRepository *rep, string query, Array< string > arguments=Array< string >(), Object &fields=Object(), bool isPost=false)
 Sends a request to the iPACS REST API (/api/v1) and returns the parsed JSON.
string getDcmString (AbstractDicomRepository *rep, string tag, string studyInstanceUID, string seriesInstanceUID, string sopInstanceUID)
 Looks up the value of the specified tag in the DICOM header of an image in the repository.
Object downloadImages (AbstractDicomRepository *rep, string studyInstanceUID, string seriesInstanceUID, string sopInstanceUID=string())
 Downloads image to cache.
Object downloadImages (string targetDir, AbstractDicomRepository *rep, string studyInstanceUID, string seriesInstanceUID, string sopInstanceUID=string())
 Downloads image to a location on disk.
Object downloadImages (string targetDir, bool forceRedownload, AbstractDicomRepository *rep, string studyInstanceUID, string seriesInstanceUID, string sopInstanceUID=string())
 Downloads image to a location on disk.
Object queryDataPoints (AbstractDicomRepository *rep, string type, string uid, string form)
 Queries datapoints through the legacy XML API (xmldicom query_dps).
VariantList queryDataPointsEx (AbstractDicomRepository *rep, string type, string uid, string form, double version, int maxup=-1)
 Queries datapoints like queryDataPoints(), with the form version and parent levels exposed.
VariantMap queryDataPoint (AbstractDicomRepository *rep, string type, string uid, string form, double version, int maxup=-1)
 Queries a single datapoint through the legacy XML API (xmldicom query_dp).
string repError (AbstractDicomRepository *rep)
 Returns the repository's last error text without clearing it.
string repTakeError (AbstractDicomRepository *rep)
 Returns the repository's last error text and clears it.
void repSetQuiet (AbstractDicomRepository *rep, bool quiet)
 Suppresses modal prompts (SSL warnings and similar) for the repository's requests.
string repProject (AbstractDicomRepository *rep)
 Returns the repository's current project path.
void repSetProject (AbstractDicomRepository *rep, string projectPath)
 Switches the repository to another project.
string repServerVersion (AbstractDicomRepository *rep)
 Returns the iPACS server version, e.g. "2021.3.12.0".
string repUrl (AbstractDicomRepository *rep)
 Returns the repository URL without the password, e.g. for logs and reports.
Object submitDataPoint (AbstractDicomRepository *rep, string uid, Object &data, string type=string())
 Submits a datapoint through the legacy XML API (xmldicom datapoint).
Object addDatapoint (AbstractDicomRepository *rep, string level, Object &target, string form, Object &values, int formVersion=1)
 Adds a datapoint to a study, series, image or the project, in an iPACS or local folder repository.
Object findDatapoints (AbstractDicomRepository *rep, string level, Object &target, Object &query=Object())
 Finds the datapoints of a study, series, image or the project, in an iPACS or local folder repository.
void enforceSyncedDatapoints (bool enforce=true)
 Makes this script's datapoint saves refuse images with unsaved changes (transitional).
Object logMessage (Index dataIndex, string msg, string noipacsTitle=string("Get iPACS from data"), string type=string())
 Creates a log message on the given's data iPACS repository.
Object logMessage (AbstractDicomRepository *rep, string msg, string type=string())
 Creates a log message on the given DICOM repository.
void auditTrailMessage (string msg, string project="/", string type=string())
 Creates an audit trail message on the current repository.
void auditTrailGenerateNewUID ()
 Generates a new session ID for audit trail messages.
void dicomBrowserLoad (AbstractDicomRepository *rep, string studyInstanceUID, string seriesInstanceUID, bool append=false, bool isPlanar=false, bool force4Dto3D=false)
 Downloads image(s) from DICOM repository and loads them into the Data Manager.
void dicomBrowserLoad (DicomBrowser *dcmBrowser, string studyInstanceUID, string seriesInstanceUID, string sopInstanceUID=string())
 Downloads image(s) from DICOM repository and loads them into Data Manager.
Object queryStudyPlan (AbstractDicomRepository *rep, string plan, string cohort, string group, string animal, string modality, string date, string event="$0")
 Performs query of DICOM repository for the study plan entries matching the given criteria.
Object getWidget (string name)
 Returns an object containing functions/properties of specified widget.
void logWidgets (Object target, bool showInteractive=true, bool showNonInteractive=true)
 Logs the widget tree of any IDumpableWidget to the debug output.
void logOperatorWidgets (bool showInteractive=true, bool showNonInteractive=true)
 Logs the widget tree of the current view's active operator dialog to the debug output.
void beginWidgetDumpHtml (string filePath)
 Opens an HTML file and writes the document header for a widget dump session.
void dumpWidgetsHtml (Object target, bool showInteractive=true, bool showNonInteractive=true)
 Dumps the widget tree of any IDumpableWidget into the active HTML session.
void dumpOperatorWidgetsHtml (bool showInteractive=true, bool showNonInteractive=true)
 Dumps the widget tree of the current view's active operator dialog into the active HTML session.
void endWidgetDumpHtml ()
 Closes the active HTML widget dump session by writing the document footer.
void beginWidgetDumpJson (string filePath)
 Opens a JSON widget dump session.
void dumpWidgetsJson (Object target)
 Dumps the widget tree of any IDumpableWidget into the active JSON session.
void dumpOperatorWidgetsJson ()
 Dumps the widget tree of the current view's active operator dialog into the active JSON session.
void endWidgetDumpJson ()
 Closes the active JSON widget dump session and writes all accumulated data to disk.
Object currentOp ()
 Returns an object containing functions for the currently loaded operator.
Object currentView ()
 Returns an object containing functions for the currently loaded view mode.
Array< string > availableItems (string name)
 Returns available items from widget with multiple options.
Array< string > availableItemsObj (Object obj)
 Returns available items from widget with multiple options.
Array< string > availableOperators ()
 Returns list of available operators.
void setOption (string cbname, string opt)
 Set widget to given option; for use with widgets with multiple options (e.g. comboboxes).
void setOptionObj (Object obj, string opt)
 Set widget to given option; for use with widgets with multiple options (e.g. comboboxes).
string stripCredentials (string url_string)
 Returns URL of DICOM repository with credentials (username and password) removed.
void setConfig (string entry, Variant &val, bool force=false)
 Sets option in VivoQuant configuration to given value.
string getConfig (string entry, string defaultValue=string())
 Returns current value of option in VivoQuant configuration.
void forceUpdateTheme ()
 Force the UI theme to update.
string getHome ()
 Returns VivoQuant installation directory.
string getCache ()
 Returns VivoQuant cache directory.
string getCurrentDir ()
 Returns current path.
string getScriptPath ()
 Returns the location of the script being executed.
string getTempFolder ()
 Returns Temp folder for current user.
string getAppTempFolder ()
 Returns VivoQuant Application Temp folder for current user.
bool deletePath (string path)
 Deletes folder and all its contents at given path.
bool deleteFile (string filepath)
 Deletes file at given path.
bool copyFile (string filepath, string newpath)
 Copies file from one path to another.
bool renameFile (string filepath, string newname)
 Renames file at given path.
bool rmDir (string dirpath)
 Removes directory at given path.
Object triggerAction (string name)
 Triggers a menu action of the main window, as if the user had selected it.
Object getAction (string name)
 Returns a menu action of the main window.
Object hasAction (string name)
 Checks whether the main window has a menu action with the given name.
Object isActionEnabled (string name)
 Checks whether a menu action of the main window is enabled.
void openDataBrowser ()
 Opens the Data Browser, as File > Data Browser does.
bool showView (string view, string op=string())
 Switches to a view and, optionally, an operator, and tells the user if that isn't possible.
void openManual (string page=string())
 Opens the online VivoQuant manual for this version, as Help > Manual - Online does.
void openScriptManual (string page=string())
 Opens the online VQ Script manual for this version, as Help > VQ Script Manual does.
string preProcess (string protocol, bool showDialog=false)
 Runs Pre-Processing Tool tool with the given protocol.
Object PreProcessingTool (bool showDialog=true)
 Opens the Pre-Processing Tool.
int storeData (AbstractDicomRepository *rep, Index idx, VQ.DICOMImageFormat format, bool compress=false)
 Stores DICOM data to a DICOM repository.
int storeDataByTimepoint (AbstractDicomRepository *rep, int idx, VQ.DICOMImageFormat format, bool compress=false, VQ.TimePointsSettings timepointOption=VQ.TimePointsSettings.AllTimePoints, VQ.TimepointFilesSettings timepointPerFileOption=VQ.TimepointFilesSettings.SingleFileForAllTimepoints)
 Stores DICOM data to a DICOM repository, with the option to save by timepoint.
bool storeAsRaw (string filepath, Index idx)
 Stores data to disk in MHD/RAW (or MHD/ZRAW) file format.
bool storeAsRaw (string filepath, int i)
int storeAsDICOM (string filepath, Index idx, VQ.DICOMImageFormat format, bool compress=false, bool quiet=true)
 Stores data to disk in DICOM file format.
int storeAsDICOM (string filepath, int idx, VQ.DICOMImageFormat format, bool compress=false, bool quiet=true)
int storeAsDICOMByTimepoint (string filepath, int idx, VQ.DICOMImageFormat format, bool compress=false, VQ.TimePointsSettings timepointOption=VQ.TimePointsSettings.AllTimePoints, VQ.TimepointFilesSettings timepointPerFileOption=VQ.TimepointFilesSettings.SingleFileForAllTimepoints)
 Stores data to disk in DICOM file format, with the option to save by timepoint.
void setDefaultDicomFormat (string modality, VQ.DICOMImageFormat format, bool dynamic=false)
 Sets the default DICOM storage format for a modality, for the rest of this VivoQuant session.
auto getDefaultDicomFormat (string modality, bool dynamic=false) -> VQ.DICOMImageFormat
 Returns the default DICOM storage format for a modality.
void saveDataViaITK4D (string filepath)
 Stores all data in Data Manager to disk as a single ITK 4D dataset in MHD/RAW or MHD/ZRAW file format.
void saveDataViaITK (string filepath, Index idx)
 Stores data to disk in ITK MHD/RAW or MHD/ZRAW file format.
void saveDataViaITK (string filepath, int i)
bool writeFile (string filepath, string text)
 Writes file to disk with given text.
bool appendFile (string filepath, string text)
 Appends text to file on disk.
Array< string > readFile (string filepath)
 Reads file into array of strings.
Object brukerImporter ()
 Returns Bruker Importer object.
Object analyzeImporter ()
 Returns Analyze Importer object.
Object imgInfImporter ()
 Returns Img/Inf Importer object.
Object gelImporter ()
 Returns Gel Importer object.
Object rawImporter ()
 Returns Raw Importer object.
Object imgHdrImporter ()
 Returns Img/Hdr Importer object.
Object vevoImporter (string filename)
 Returns Vevo object.
void centerCursor ()
 Moves cursor to center of image in each viewport (i.e. moves each viewport to center slice).
Object webDisk (string rep)
 Return IPACS WebDisk object for project in given iPACS repository.
bool saveScreenshot (string fileName)
 Saves screenshot of VivoQuant.
string applicationName ()
 Returns name + version of current instance of VivoQuant.
Object zipTool ()
 Returns Zip Tool object.
double sin (double f)
 Returns sin of angle.
double cos (double f)
 Returns cosine of angle.
void splitROI2DICOM (Index idx)
 For each ROI in the 3D ROI Tool, creates a masked image of a given image in the Data Manager, where voxels outside the ROI are mapped to the given image's minimum.
Array< string > lsDir (string dir, string nameFilter=string(), int filter=QDir::AllEntries|QDir::NoDotAndDotDot, QDir::SortFlags sort=QDir::Name)
 Returns array of files in given directory on local disk.
int rand ()
 Returns a random integer.
int rand (int max)
 Returns random positive integer less than given maximum.
float frand ()
 Returns a random float.
void suspend (string message=string())
 Suspends script and opens a modeless "Resume" dialog.
string getHash (string key, string def=string())
 Returns current value of key in hash.
double getHashNum (string key, double def=0.0f)
 Returns current numerical value of key in hash.
Array< string > getHashKeys ()
 Returns array of all keys in hash.
void setHash (string key, string val)
 Sets value of key in hash.
void clearHash ()
 Clears all keys and values stored in hash.
bool storeHash (string fileName)
 Stores all keys and values in hash to local file.
bool loadHash (string fileName)
 Loads local file, containing hash keys and values, to VivoQuant's persistent hash.
string getEnv (string key, string defaultValue=string())
 Get the system's environment variables.
string startTool (string tool, string baseDir=".", Array< string > args=Array< string >())
 Start an external tool.
void bedRemoval (string bedName=string())
 Invokes CT bed removal tool. If bedName is provided, this bed will automatically be selected.
Object getROIStats (Index idx, int roiID, int layerID=-1)
 Returns object with ROI quantification table information for given dataset and ROI.
Object getROIStats (int datID, int roiID)
Object getROIStats (Index idx)
 Returns array of ROI quantification table information for given dataset and ALL ROIs.
Object getROIStats (int datID)
string atlasPath ()
 Returns path where atlases are stored.
Object getMPRWidget ()
 Returns MPR widget.
void loadRGB (Index idx, Array< string > imgFiles, float voxX, float voxY, float voxZ, int rgbRep=4, bool forcePlanar=true)
Object getMModeSegmentationTool ()
 Returns Ultrasound M-Mode Segmentation tool object.
Object getDicomAnonymizer ()
 Returns DICOM Anonymizer Tool object.
Object getDicomRelabeler ()
 Returns DICOM Relabeler Tool object.
Object getCorticalThicknessTool ()
 Returns cortical thickness tool object.
Object getBedRemovalWidget (string name)
 Return Widget name in Bedremoval Dialog.
double getHalfLife (string name)
 Get an isotope's half life.
Object readCSVFile (string name)
 Parse a CSV file into arrays of values.
string getDefaultPal (string modality, int i)
 get default palette from modality
string getOS ()
 get current Operating System name
Object scriptPanel ()
 Returns the script panel, a dock that scripts fill with fields and read back.
void processEvents ()
 Processes pending paint and layout events, without user input.
Object evaluateConsole (string code, string baseDir=string(), string sourceName=stringLiteral("console"), bool *ok=nullptr)
 Evaluates code typed in the VQS console, in the scripts' global scope.
bool isRunning ()

Member Function Documentation

◆ abort()

void abort ( )

Aborts current script.

Stops the script and closes anything it is waiting on, such as a non-modal message, suspend() or a script panel wait. The script ends with the error "Script was cancelled by user". If askForCancelReason() is enabled and VivoQuant is in audit mode, the user must first enter a reason, which is added to the message.

◆ addDatapoint()

Object addDatapoint ( AbstractDicomRepository * rep,
string level,
Object & target,
string form,
Object & values,
int formVersion = 1 )

Adds a datapoint to a study, series, image or the project, in an iPACS or local folder repository.

Each call adds a new datapoint; nothing already there is changed. A local folder repository keeps its datapoints in a ".vqdps" folder inside the repository's folder; iPACS keeps them on the server, stored the same way as submitDataPoint().

var img = VQ.queryImages(rep, studyUid, seriesUid)[0]; // has the three UIDs
var res = VQ.addDatapoint(rep, 'images', img, 'probe', { score: 3, note: 'ok' });
if (!res) VQ.debug(VQ.repTakeError(rep));
Parameters
repRepository
levelprojects, studies, series or images
targetObject with StudyInstanceUID, SeriesInstanceUID and SOPInstanceUID, as far down as the level needs; other properties are ignored. Unused at project level.
formForm name; no '/' or '*'
valuesObject of values. Numbers and booleans are stored as text, arrays and objects as one JSON string; null, undefined, empty strings and keys starting with '' are left out. Key names must be letters, digits and '', starting with a letter, and not form, timestamp, creator or UID; otherwise nothing is stored, so a datapoint reads back the same from every repository.
formVersionForm version (default 1)
Returns
{id: "<datapoint id>"} (id is "" on iPACS, which doesn't report it), or undefined on failure (reason in repTakeError())

◆ appendFile()

bool appendFile ( string filepath,
string text )

Appends text to file on disk.

Parameters
filepathPath of output file
textText to write to output file

◆ askForCancelReason()

void askForCancelReason ( bool ask)

Set whether a prompt asks for a reason if the user cancels the script, which can be written to the audit trail.

Parameters
askIf true, a prompt will ask the user to enter a reason if they do something that cancels the script while it is running

◆ askYesNoQuestion()

bool askYesNoQuestion ( string msg,
bool modal = true )

Displays dialog box with "Yes" or "No" option.

Parameters
msgMessage displayed in dialog box
modalDetermines whether VivoQuant is inaccesible while dialog box is open (true) or accesible (false)
Returns
bool true (if "Yes") or false (if "No")

◆ auditTrailMessage()

void auditTrailMessage ( string msg,
string project = "/",
string type = string() )

Creates an audit trail message on the current repository.

Parameters
msgThe message to be logged
projectThe project to log the message to
typeMessage type

◆ availableItems()

Array< string > availableItems ( string name)

Returns available items from widget with multiple options.

Parameters
nameName of widget

◆ availableItemsObj()

Array< string > availableItemsObj ( Object obj)

Returns available items from widget with multiple options.

Note
Takes widget object as input (can be accessed by VQ.getWidget('widgetName')
Parameters
objWidget object, which can be accessed by VQ.getWidget()

◆ beginWidgetDumpHtml()

void beginWidgetDumpHtml ( string filePath)

Opens an HTML file and writes the document header for a widget dump session.

Must be called before any dumpWidgetsHtml or dumpOperatorWidgetsHtml calls. Close the session with endWidgetDumpHtml.

Parameters
filePathPath to the HTML file to create. Overwrites any existing file.

◆ beginWidgetDumpJson()

void beginWidgetDumpJson ( string filePath)

Opens a JSON widget dump session.

Initialises an internal buffer that accumulates widget sections across subsequent dumpWidgetsJson or dumpOperatorWidgetsJson calls. Flush the session to disk with endWidgetDumpJson.

Parameters
filePathPath to the JSON file to write when endWidgetDumpJson is called.

◆ BrainAtlasTool()

Object BrainAtlasTool ( bool visible = true,
bool quiet = false )

Opens the Brain Atlas Tool.

Parameters
visibleWhether or not the tool dialog is shown upon being created
quietWhether or not the tool is in quiet mode. In quiet mode no warnings or popups will be displayed.

◆ copyFile()

bool copyFile ( string filepath,
string newpath )

Copies file from one path to another.

Parameters
filepathCurrent path to file
newpathNew path to file
Returns
bool True if file copied successfully, false otherwise

◆ cos()

double cos ( double f)
inline

Returns cosine of angle.

Parameters
fAngle (in radians)

◆ counter()

string counter ( int c,
int s )
inline

Convenience function to return a 0-padded counter.

Parameters
cNumber to pad
sNumber of digits in padded output

◆ dcmRep()

Object dcmRep ( string text)

Creates and returns a DICOM repository object.

Parameters
textLocation of DICOM repository. Can be URL, local directory, or other path to a DICOM repository. Local folders should start with "folder://" followed by the path. iPACS (R) repositories should start with "ipacss://".

◆ debug()

void debug ( string text)

Prints output to debugger and/or logfile.

Parameters
textString to be printed

◆ deleteFile()

bool deleteFile ( string filepath)

Deletes file at given path.

Parameters
filepathPath to file
Returns
bool True if file deleted successfully, false otherwise

◆ deletePath()

bool deletePath ( string path)

Deletes folder and all its contents at given path.

Parameters
pathto be deleted
Returns
bool True if path deleted successfully, false otherwise

◆ dicomBrowser()

Object dicomBrowser ( AbstractDicomRepository * rep)

Returns VivoQuant's Data Browser object for a given DICOM repository.

Parameters
repDICOM repository to use with Data Browser object

◆ dicomBrowserLoad() [1/2]

void dicomBrowserLoad ( AbstractDicomRepository * rep,
string studyInstanceUID,
string seriesInstanceUID,
bool append = false,
bool isPlanar = false,
bool force4Dto3D = false )

Downloads image(s) from DICOM repository and loads them into the Data Manager.

Parameters
repDICOM repository
studyInstanceUIDStudyInstanceUID of study in which image(s) are found
seriesInstanceUIDSeriesInstanceUID of series in which image(s) are found
appendDetermines whether incoming data is appended (1) or opened to replace data currently loaded in Data Manager (0)
isPlanar(optional) determines whether VivoQuant loads incoming data as planar (1) or not (0)
force4Dto3D(optional) determines whether VivoQuant loads incoming 4D data as 4D (1) or 3

◆ dicomBrowserLoad() [2/2]

void dicomBrowserLoad ( DicomBrowser * dcmBrowser,
string studyInstanceUID,
string seriesInstanceUID,
string sopInstanceUID = string() )

Downloads image(s) from DICOM repository and loads them into Data Manager.

Parameters
dcmBrowserDICOM browser object
studyInstanceUIDStudyInstanceUID of study in which image(s) are found
seriesInstanceUIDSeriesInstanceUID of series in which image(s) are found
sopInstanceUIDSOPInstanceUID of image(s)

◆ downloadImages() [1/3]

Object downloadImages ( AbstractDicomRepository * rep,
string studyInstanceUID,
string seriesInstanceUID,
string sopInstanceUID = string() )

Downloads image to cache.

Parameters
repDICOM repository
studyInstanceUIDStudyInstanceUID of study
seriesInstanceUIDSeriesInstanceUID of series
sopInstanceUIDSOPInstanceUID of image

◆ downloadImages() [2/3]

Object downloadImages ( string targetDir,
AbstractDicomRepository * rep,
string studyInstanceUID,
string seriesInstanceUID,
string sopInstanceUID = string() )

Downloads image to a location on disk.

Parameters
targetDirDesired location on disk
repDICOM repository
studyInstanceUIDStudyInstanceUID of study
seriesInstanceUIDSeriesInstanceUID of series
sopInstanceUIDSOPInstanceUID of image

◆ downloadImages() [3/3]

Object downloadImages ( string targetDir,
bool forceRedownload,
AbstractDicomRepository * rep,
string studyInstanceUID,
string seriesInstanceUID,
string sopInstanceUID = string() )

Downloads image to a location on disk.

Parameters
targetDirDesired location on disk
repDICOM repository
studyInstanceUIDStudyInstanceUID of study
seriesInstanceUIDSeriesInstanceUID of series
sopInstanceUIDSOPInstanceUID of image
forceRedownloadwhether to re-download if the image is already in the cache

◆ dumpOperatorWidgetsHtml()

void dumpOperatorWidgetsHtml ( bool showInteractive = true,
bool showNonInteractive = true )

Dumps the widget tree of the current view's active operator dialog into the active HTML session.

Appends a collapsible section to the HTML file opened by beginWidgetDumpHtml. The current view and operator name are captured automatically as the section heading. Must be called between beginWidgetDumpHtml and endWidgetDumpHtml.

Parameters
showInteractiveWhether to include interactive widgets in the output.
showNonInteractiveWhether to include structural non-interactive named widgets.

◆ dumpOperatorWidgetsJson()

void dumpOperatorWidgetsJson ( )

Dumps the widget tree of the current view's active operator dialog into the active JSON session.

Accumulates a section into the internal buffer started by beginWidgetDumpJson. The current view and operator name are captured automatically as the section context label. Must be called between beginWidgetDumpJson and endWidgetDumpJson.

◆ dumpWidgetsHtml()

void dumpWidgetsHtml ( Object target,
bool showInteractive = true,
bool showNonInteractive = true )

Dumps the widget tree of any IDumpableWidget into the active HTML session.

Appends a collapsible section to the HTML file opened by beginWidgetDumpHtml. Interactive widgets are highlighted in teal, structural widgets in grey. Must be called between beginWidgetDumpHtml and endWidgetDumpHtml.

Parameters
targetA Object wrapping an object that implements IDumpableWidget.
showInteractiveWhether to include interactive widgets in the output.
showNonInteractiveWhether to include structural non-interactive named widgets.

◆ dumpWidgetsJson()

void dumpWidgetsJson ( Object target)

Dumps the widget tree of any IDumpableWidget into the active JSON session.

Accumulates a section into the internal buffer started by beginWidgetDumpJson. Only interactive widgets are included. Must be called between beginWidgetDumpJson and endWidgetDumpJson.

Parameters
targetA Object wrapping an object that implements IDumpableWidget.

◆ endWidgetDumpHtml()

void endWidgetDumpHtml ( )

Closes the active HTML widget dump session by writing the document footer.

Must be called after all dumpWidgetsHtml or dumpOperatorWidgetsHtml calls to produce a valid HTML file. Clears the active session path.

◆ endWidgetDumpJson()

void endWidgetDumpJson ( )

Closes the active JSON widget dump session and writes all accumulated data to disk.

Produces a JSON array of sections, each containing a context label and a flat array of widgets with name, className, tooltip, interactive, and depth fields. Clears the internal buffer and session path after writing.

◆ enforceSyncedDatapoints()

void enforceSyncedDatapoints ( bool enforce = true)

Makes this script's datapoint saves refuse images with unsaved changes (transitional).

Saving an image with unsaved changes gives it new UIDs, so a datapoint stored against its current UIDs would be attached to server data that does not hold what was measured. For now such stores still go ahead by default, each logging a warning, so existing scripts keep working while they are updated. A future version will refuse them by default.

Call this to get that future behaviour now and check that a script is ready: stores against a loaded image with unsaved changes fail (submitDataPoint() returns false, the 3D ROI tool's submits return false with the reason in lastSubmitError(), and so on). The fix is to save the image first, then store against its new UIDs.

Lasts until the script (or console command) ends. Unchecking the "Allow Datapoints on Images with Unsaved Changes" preference does the same for every script and for the user interface.

Note
Example
VQ.enforceSyncedDatapoints(true); // fail instead of warn while testing this script
Parameters
enforcetrue to refuse the stores, false to go back to the preference
Deprecated
Transitional; will be removed once refusing is the default.
Deprecated
Transitional: will be removed once datapoints on images with unsaved changes are refused by default.

◆ evaluateConsole()

Object evaluateConsole ( string code,
string baseDir = string(),
string sourceName = stringLiteral("console"),
bool * ok = nullptr )

Evaluates code typed in the VQS console, in the scripts' global scope.

The code is evaluated like a script file: #include lines are resolved (baseDir is searched first, as a script's own folder is) and an uncaught exception gives the same detailed message, see lastRunError(). Unlike a script file, it never runs in import mode, doesn't overwrite the preprocessed-script file and never ends the process in test mode. sourceName names the code in error messages and the log (e.g. "console:3").

Counts as running while it runs (see isRunning()), so a script can't start on top of a console command that waits. When no script is running, it first clears the stop request a stopped script leaves behind; while a script is being stopped, it refuses.

Returns
the value of the last expression statement, or an error value; lastRunError() describes the error. A value can itself be an Error object, so ok, if given, says whether the code succeeded.

◆ fileExists()

bool fileExists ( string path)

Checks whether file at specified path exists.

Parameters
pathFull path to file

◆ findDatapoints()

Object findDatapoints ( AbstractDicomRepository * rep,
string level,
Object & target,
Object & query = Object() )

Finds the datapoints of a study, series, image or the project, in an iPACS or local folder repository.

The counterpart of addDatapoint(). Works the same on both kinds of repository, as the iPACS REST API does: only the object's own datapoints are returned (nothing from its series, study or project, unlike queryDataPoints()), ordered by form, then id (the order they were added).

var img = VQ.queryImages(rep, studyUid, seriesUid)[0];
var rows = VQ.findDatapoints(rep, 'images', img, { form: 'quantification', values: { roiname: 'Liver' } });
if (!rows) VQ.debug(VQ.repTakeError(rep));
// The datapoints of every study in the repository (on iPACS: in its project)
var all = VQ.findDatapoints(rep, 'studies', null, 'ROIQC-*');
Parameters
repRepository
levelprojects, studies, series or images
targetObject with StudyInstanceUID, SeriesInstanceUID and SOPInstanceUID, as far down as the level needs; or null for every object at the level. Unused at project level.
queryA form name, or an object:
  • form: form name; "" or missing for every form; '*' matches any run of characters; case-insensitive
  • values: { key: value } exact, case-sensitive matches, all required (numbers and booleans as text)
  • previous: true for previous versions instead of current rows
Returns
Array of { id, form, formVersion, creator, timestamp ("yyyy-MM-dd HH:mm:ss" UTC), active, values: { ... }, target: { level, StudyInstanceUID, SeriesInstanceUID, SOPInstanceUID, dataId } }, where target names the object the datapoint belongs to (with a null target on iPACS, dataId, the object's iPACS id, instead of UIDs); or undefined on failure (reason in repTakeError())
Note
On iPACS this needs the REST API for every form, wildcards, previous versions and whole-level queries; without it only a single form on a single object works.

◆ flatIndex()

Index flatIndex ( int i)

Get a script flat image index object used to reference data in the Data Manager The index should be passed directly to function, ie: var t = op.testFunc(VQ.flatIndex(1));.

Parameters
iThe first level position
Note
A flat index is the position relative to all children element in the Data Manager For example, if the Data Manager contains two dynamic data set: 0.(T0,T1) and 1.(T0,T1,T2), to access Data 1.T2, the index 4 can be used.

◆ folderExists()

bool folderExists ( string path)

Checks whether file at specified path exists.

Parameters
pathFull path to folder

◆ frand()

float frand ( )

Returns a random float.

Returns
a random float value

◆ getAction()

Object getAction ( string name)

Returns a menu action of the main window.

The returned object can be passed to the Visibility Manager to hide or disable the action.

Parameters
nameName of the action
Returns
The action object, or null if no action has that name

◆ getConfig()

string getConfig ( string entry,
string defaultValue = string() )

Returns current value of option in VivoQuant configuration.

Parameters
entryOption in VivoQuant configuration
defaultValue(optional) Value returned if the option is not set

◆ getDcmString()

string getDcmString ( AbstractDicomRepository * rep,
string tag,
string studyInstanceUID,
string seriesInstanceUID,
string sopInstanceUID )

Looks up the value of the specified tag in the DICOM header of an image in the repository.

Parameters
repDICOM repository
tagDICOM tag
studyInstanceUIDStudyInstanceUID of study
seriesInstanceUIDSeriesInstanceUID of series
sopInstanceUIDSOPInstanceUID of image

◆ getDefaultDicomFormat()

auto getDefaultDicomFormat ( string modality,
bool dynamic = false ) -> VQ.DICOMImageFormat

Returns the default DICOM storage format for a modality.

This is the format VivoQuant uses when it saves DICOM without being told which format to use. It reflects the Configuration dialog's DICOM tab, unless overridden for this session by setDefaultDicomFormat().

Parameters
modalityDICOM modality code, e.g. "CT", "PT", "NM", "MR" (case-insensitive)
dynamicfalse (default) for static data, true for dynamic data
Returns
A value of VQ.DICOMImageFormat

◆ getDefaultPal()

string getDefaultPal ( string modality,
int i )

get default palette from modality

Parameters
modalityImage modality
iIndex in Data Manager
Returns
palette name

◆ getEnv()

string getEnv ( string key,
string defaultValue = string() )

Get the system's environment variables.

Parameters
keyName of system environment variable
defaultValueThe default value if they key does not exists
Returns
The variable's value

◆ getHalfLife()

double getHalfLife ( string name)

Get an isotope's half life.

Parameters
nameThe isotope's name

◆ getHash()

string getHash ( string key,
string def = string() )
inline

Returns current value of key in hash.

Parameters
keyKey in hash
def(optional) Value returned if the key is not in the hash
Returns
Value of key in hash as string

◆ getHashNum()

double getHashNum ( string key,
double def = 0.0f )
inline

Returns current numerical value of key in hash.

Parameters
keyKey in hash
def(optional) Value returned if the key is not in the hash
Returns
Value of key in hash as double

◆ getIndexContainer() [1/2]

Object getIndexContainer ( int i)

Get a script image index container used to reference data in the Data Manager. Use .get() function of the container to access the internal index.

Parameters
iThe first level position

◆ getIndexContainer() [2/2]

Object getIndexContainer ( int i,
int j )

Get a script image index container used to reference data in the Data Manager. Use .get() function of the container to access the internal index.

Parameters
iThe first level position (parent)
jThe second level position (child)

◆ getLocalFiles()

Array< string > getLocalFiles ( string caption = "Select files:",
string startDir = string(".") )

Returns array of paths to files selected by user in file dialog.

Parameters
captionText in title of dialog
startDirDefault path at which the file dialog starts

◆ getLocalPath()

Object getLocalPath ( string caption = "Select directory:",
string startDir = string(".") )

Returns path of directory selected by user in file dialog.

Parameters
captionText in title of dialog
startDirDefault path at which file dialog starts

◆ getOS()

string getOS ( )

get current Operating System name

Returns
current OS name. Possible outputs are: Linux, MacOS, Windows and Other.

◆ getROIStats() [1/4]

Object getROIStats ( Index idx)

Returns array of ROI quantification table information for given dataset and ALL ROIs.

Parameters
idxIndex of timestamp dataset from which to calculate stats (see flatIndex())
Returns
An array with one object per ROI (its roiid field says which). Each object has the same fields as the single-ROI version of this function, and every value is a string.
Note
The current operator must be the 3D ROI tool, as for the single-ROI version.

◆ getROIStats() [2/4]

Object getROIStats ( Index idx,
int roiID,
int layerID = -1 )

Returns object with ROI quantification table information for given dataset and ROI.

Parameters
idxIndex of timestamp dataset from which to calculate stats (see flatIndex())
roiIDIndex of ROI for which to calculate stats (0 is the background)
layerID(optional) Index of the ROI layer. -1 (the default) uses the active layer.
Returns
An object with the same fields as the quantification table, for example roiname, voxels, volume, mean, stddev, min, max, median and unit. Every value is a string, so convert numbers before calculating with them, for example parseFloat(stats.mean).
Note
The current operator must be the 3D ROI tool. Switch to it first with VQ.mainWin().setViewMode(). Otherwise this shows a warning, returns an empty object, and the script continues but is reported as failed when it ends. An invalid idx throws an error.

◆ getROIStats() [3/4]

Object getROIStats ( int datID)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
datIDFlat position of the data set, as for flatIndex() (not index())

◆ getROIStats() [4/4]

Object getROIStats ( int datID,
int roiID )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
datIDFlat position of the data set, as for flatIndex() (not index())
roiIDIndex of ROI for which to calculate stats (0 is the background)
Note
Always uses the active ROI layer.

◆ getSavePath()

Object getSavePath ( string caption = string("Select output file:"),
string startDir = string("."),
string filter = string() )

Returns path to file selected by user in file dialog.

Parameters
captionText in title of dialog
startDirDefault path at which file dialog starts
filterFile type filter for file dialog

◆ getTempFolder()

string getTempFolder ( )

Returns Temp folder for current user.

Deprecated
Use getAppTempFolder instead. Users shouldn't be using the raw OS temp folder for their scripts. The app temp folder is a better place to write temporary files.
Deprecated
Use getAppTempFolder instead for the VivoQuant specific temp app location.

◆ getValues()

VariantMap getValues ( string title,
VariantMap & map,
bool modal = true )

Displays a dialog requesting multiple user inputs in a single form.

Minimal example:

var values = VQ.getValues("Enter ID", { "ID": ["text", ""] });

Creates a modal or non-modal dialog containing one input widget per entry in map. Each map entry produces a labeled row in the form, where the key is used as the label and the value describes the input type and its parameters.

Parameters
titleWindow title of the dialog.
mapA map from label text to an input specification. The specification may be either a string or a VariantList:
  • If the value is a string, it is interpreted as the input type or default value (see implicit behavior below).
  • If the value is a VariantList, the first element specifies the input type (case-insensitive), and the remaining elements provide type-specific parameters.

Supported explicit input types:

['text', string default]
['int', int default, int min, int max, int step]
['double', double default, double min, double max,
int decimals, double step]
['item', Array<string> items]

All parameters are optional unless otherwise noted.

Implicit behavior:

  • If the first element does not match a supported type:
    • A single value results in a text input initialized with that value.
    • Multiple values result in a combo box containing all values.

For item inputs, the list of items must be provided.

Parameters
modalIf true, the dialog is modal and blocks interaction with the rest of the application while open.
Returns
A map from label text to the value entered by the user. The value type depends on the input widget (string, int, double). If the dialog is cancelled, script execution is aborted.
Examples
(see detailed examples below)

◆ getVersion()

string getVersion ( )

Get the string representing the script version.

Returns
The version string set with setVersion()

◆ getWidget()

Object getWidget ( string name)

Returns an object containing functions/properties of specified widget.

Widgets are UI elements (e.g. buttons, checkboxes, combo boxes, etc.) in VivoQuant. Widget names can be revealed by clicking the Lookup button on the VivoScript toolbar and clicking the widget.

Parameters
nameName of widget.
Widget Reference
Browse available widgets by operator context:

Slice View
Reorientation/Registration | 3D ROI Tool | Cropping | Distance/Annotation | Modeling | Arithmetics | Time Series | Filtering | Splitting

Multi View
Layout | Distance/Annotation | Modeling | Arithmetics | Filtering | Splitting

Tile View
Time Series

◆ hasAction()

Object hasAction ( string name)

Checks whether the main window has a menu action with the given name.

Parameters
nameName of the action
Returns
true if the action exists, false otherwise

◆ histogramTool()

Object histogramTool ( )

Returns Histogram tool object.

Note
The tool can be driven without being shown, e.g.
var h = VQ.histogramTool();
h.setDataset(0); h.setNumBins(64); h.setROIByName("Heart");
var r = h.getHistogram(); // { min, max, binStep, binStarts, counts, ... }

◆ index() [1/2]

Index index ( int i)

Get a script image index object used to reference data in the Data Manager The index should be passed directly to function, ie: var t = op.testFunc(VQ.index(1));.

Parameters
iThe first level position
Note
Children element cannot be accessed with this function (see flatIndex())

◆ index() [2/2]

Index index ( int i,
int j )

Get a script image index object used to reference data in the Data Manager The index should be passed directly to function, ie: var t = op.testFunc(VQ.index(0,1));.

Parameters
iThe first level position (parent)
jThe second level position (child)

◆ isActionEnabled()

Object isActionEnabled ( string name)

Checks whether a menu action of the main window is enabled.

Parameters
nameName of the action
Returns
true if the action exists and is enabled, false otherwise

◆ isInteractive()

bool isInteractive ( )

Checks whether the current VivoQuant session is interactive.

True when a user is available to answer dialogs (warnings, errors, questions and progress). False when VivoQuant was started with --script, runs in a container or without a GUI, or when a script has called setInteractive(false) or setTestMode().

Scripts can use it to decide whether to ask the user anything. quit() also uses it to decide whether to ask for confirmation.

◆ isRunning()

bool isRunning ( )
inline

True while a script or console command is being evaluated, including while it waits, and including internal callbacks evaluated during such a wait.

◆ listFiles()

Array< string > listFiles ( string folder,
string pattern )

Lists the files under a folder and all its subfolders whose name matches a wildcard pattern.

Parameters
folderFolder to search; a relative path is relative to the folder VivoQuant was started in
patternFile name wildcard, e.g. "*.taxon.vqs"
Returns
Paths as folder + "/" + path below it, sorted; empty if the folder does not exist

◆ loadHash()

bool loadHash ( string fileName)

Loads local file, containing hash keys and values, to VivoQuant's persistent hash.

Note
Definitions in file should be formatted as "key1 = val1", with each definition separated by a newline. To check whether file was loaded successfully, try VQ.suspend(VQ.getHash(key1)) for a given key in your file. The dialog box that appears should display the value of the given key.
Parameters
fileNamePath to file

◆ loadRepository()

Object loadRepository ( string name)

Returns DICOM repository object from DICOM repository saved in VivoQuant.

Parameters
nameName of DICOM repository saved in VivoQuant

◆ loadRGB()

void loadRGB ( Index idx,
Array< string > imgFiles,
float voxX,
float voxY,
float voxZ,
int rgbRep = 4,
bool forcePlanar = true )

Load RGB data without the voxel size prompt.

Parameters
idxIndex where opened data should be positioned in the DataManager (see index())
imgFilesIndex List of RGB image to load as a volume
voxXExpected X voxel size
voxYExpected Y voxel size
voxZExpected Z voxel size
rgbRepRepresentation of RGB values (0=Red, 1=Green, 2=Blue, 3=AVG, 4=SUM, 5=MAX, 6=MIN)
forcePlanarForce volume to load as planar

◆ logMessage() [1/2]

Object logMessage ( AbstractDicomRepository * rep,
string msg,
string type = string() )

Creates a log message on the given DICOM repository.

Parameters
repThe DicomRepository object
msgThe message to be logged
typeMessage type

◆ logMessage() [2/2]

Object logMessage ( Index dataIndex,
string msg,
string noipacsTitle = string("Get iPACS from data"),
string type = string() )

Creates a log message on the given's data iPACS repository.

Parameters
dataIndexThe data index (see index())
msgThe message to be logged
noipacsTitleDefault no iPACS title for warning
typeMessage type

◆ logOperatorWidgets()

void logOperatorWidgets ( bool showInteractive = true,
bool showNonInteractive = true )

Logs the widget tree of the current view's active operator dialog to the debug output.

Resolves the root widget automatically from the current view and operator context. Use logWidgets for logging arbitrary IDumpableWidget targets.

Parameters
showInteractiveWhether to log interactive widgets (QComboBox, QPushButton, etc).
showNonInteractiveWhether to log structural non-interactive named widgets.

◆ logWidgets()

void logWidgets ( Object target,
bool showInteractive = true,
bool showNonInteractive = true )

Logs the widget tree of any IDumpableWidget to the debug output.

The context label and root widget are resolved automatically via IDumpableWidget::dumpContext() and IDumpableWidget::getRootWidget().

Parameters
targetA Object wrapping an object that implements IDumpableWidget.
showInteractiveWhether to log interactive widgets (QComboBox, QPushButton, etc).
showNonInteractiveWhether to log structural non-interactive named widgets.

◆ lsDir()

Array< string > lsDir ( string dir,
string nameFilter = string(),
int filter = QDir::AllEntries|QDir::NoDotAndDotDot,
QDir::SortFlags sort = QDir::Name )

Returns array of files in given directory on local disk.

Parameters
dirDirectory on local disk
nameFilterExpression to use to filter files. Wildcard (*) is acceptable.
filter(optional) Qt QDir::Filters flags selecting which entries to list (default: all entries except "." and "..")
sort(optional) Qt QDir::SortFlags flags for the sort order (default: by name)

◆ MASTool()

Object MASTool ( string libraryPath = string(""))

Opens Multi-Atlas Segmentation Tool, formerly known as Whole Body Atlas).

Parameters
libraryPathThe path of the library to be used

◆ mkdir()

void mkdir ( string path,
string subdir )

Creates sub-directory at specified path.

Parameters
pathPath in which to create new subdirectory
subdirName of new subdirectory

◆ openDataBrowser()

void openDataBrowser ( )

Opens the Data Browser, as File > Data Browser does.

Does nothing if DICOM loading is not available.

VQ.openDataBrowser();

◆ openFileExternally()

bool openFileExternally ( string path)

Opens a local file in an external application.

Parameters
pathFull path to file
Returns
True if the request to the operating system to open the file was successfully made, false if the request failed or the file does not exist

◆ openManual()

void openManual ( string page = string())

Opens the online VivoQuant manual for this version, as Help > Manual - Online does.

Parameters
page(optional) Page of the manual to open, e.g. "vqmanual_tools_keyboardshortcuts.html". Opens the start page if omitted.

◆ openScriptManual()

void openScriptManual ( string page = string())

Opens the online VQ Script manual for this version, as Help > VQ Script Manual does.

Parameters
page(optional) Page of the manual to open. Opens the start page if omitted.

◆ preProcess()

string preProcess ( string protocol,
bool showDialog = false )

Runs Pre-Processing Tool tool with the given protocol.

Parameters
protocolString with protocol
showDialogWhether or not the tool dialog is shown upon being created

◆ PreProcessingTool()

Object PreProcessingTool ( bool showDialog = true)

Opens the Pre-Processing Tool.

Parameters
showDialogWhether or not the tool dialog is shown upon being created

◆ processEvents()

void processEvents ( )

Processes pending paint and layout events, without user input.

Call during long-running work so changes to the script panel or other widgets are shown. User input is held until the script waits (wait(), dialogs, suspend()).

◆ progressDialog()

Object progressDialog ( string label,
string cancelButtonText,
int minimum,
int maximum )

Returns a progress dialog object, which can be used to show the current state of a longer process.

Note
Use method setValue(x) to set the current value of the progress dialog.
Use method hide() to hide the progress dialog
Parameters
labelText in title of dialog box
cancelButtonTextText in button that cancels process
minimumMinimum value progress dialog object can take
maximumMaximum value progress dialog object can take

◆ query()

Object query ( AbstractDicomRepository * rep,
string query,
Array< string > arguments = Array< string >(),
Object & fields = Object(),
bool isPost = false )

Sends a request to the iPACS REST API (/api/v1) and returns the parsed JSON.

The general-purpose access point to the iPACS REST API: any resource under /api/v1 that answers GET or POST with JSON can be reached with it. The other datapoint bindings (queryDataPoints(), submitDataPoint() and the calls listed with them) use the legacy XML API (xmldicom) instead; the two APIs read and write the same datapoints.

The request URL is <server>/api/v1/<query>/<arguments joined with '/'>. With GET (the default), fields become query-string parameters; with isPost they are sent as the request body. Field values are converted with JavaScript String().

Note
Example: list the project-level datapoints of one form across every project
var rows = VQ.query(rep, 'datapoints', [], { form: 'LASAR_protocol' });
if (!rows) VQ.debug('Query failed: ' + VQ.repTakeError(rep));
Example: every study-level datapoint in project 740, every form
var rows = VQ.query(rep, 'projects', ['740', 'studies', 'datapoints']);
Parameters
repiPACS repository
queryFirst path segment under /api/v1 (e.g. "projects", "datapoints", "users")
arguments(optional) Further path segments, in order. Pass ids as strings.
fields(optional) Query parameters (GET) or body fields (POST)
isPost(optional) Send a POST instead of a GET
Returns
The response as a JavaScript array or object, or undefined on failure: HTTP status other than 200, a body that isn't JSON, a body of the form {"error": ...}, a repository that isn't iPACS, or a server VQ didn't detect as REST. The reason is in repTakeError().
Note
Only GET and POST: REST updates (PUT, PATCH) and deletes can't be sent.
Only the parsed body is returned; the HTTP status and headers are not.
REST value filters (any parameter other than form and active) match the whole value exactly and case-sensitively. form is case-insensitive and accepts '*'. Unknown parameters are treated as value filters, so paging parameters such as limit or offset silently return nothing.
GET /api/v1/datapoints returns project-level datapoints of every project only; other levels need /api/v1/projects/<id>/<level>/datapoints, one query per level.
POST requests are sent as given and are not checked against images with unsaved changes (the REST API identifies records by iPACS ids, not DICOM UIDs). To store datapoints use submitDataPoint() or batchStoreDataPoints(), which check for UIDs of images whose unsaved changes would make them stale.

◆ queryDataPoint()

VariantMap queryDataPoint ( AbstractDicomRepository * rep,
string type,
string uid,
string form,
double version,
int maxup = -1 )

Queries a single datapoint through the legacy XML API (xmldicom query_dp).

Returns the first row queryDataPoints() would return. When several rows were written in the same second, that is not reliably the newest; write your own sequence field if "latest" matters.

Parameters
repiPACS repository
typeLevel, lowercase plural: projects, studies, series or images
uidUID for the level; empty at project level
formForm name, unencoded
versionForm version; ignored by the server, pass 0
maxupParent levels to include, as in queryDataPointsEx()
Returns
The datapoint's fields, or {__error: "<status>"} on failure. A form with no rows is a failure here (404), unlike the plural query. The reason is in repTakeError().

◆ queryDataPoints()

Object queryDataPoints ( AbstractDicomRepository * rep,
string type,
string uid,
string form )

Queries datapoints through the legacy XML API (xmldicom query_dps).

Returns every current datapoint of one form on one object. Both APIs share the same datapoints, so rows written through REST are returned too. For form discovery, project-wide queries or previous versions, use the REST API through query().

Note
Example: study-level ROIQC-notes datapoints on study 1.2.3.4.5
var dps = VQ.queryDataPoints(rep, 'studies', '1.2.3.4.5', 'ROIQC-notes');
if (!dps || (dps.length && dps[0].__error !== undefined)) { ... } // failed
Parameters
repiPACS repository
typeLevel, lowercase plural: projects, studies, series or images. Other spellings return 404.
uidStudyInstanceUID, SeriesInstanceUID or SOPInstanceUID for the level. At project level leave it empty: the repository's project sets the scope.
formForm name. Case-insensitive; no wildcards. Pass it unencoded (it is percent-encoded for the request). Names containing '/' can't be queried.
Returns
Array of datapoints, newest first, each an object of its fields plus creator and timestamp (UTC, 1-second resolution). An empty array when the form has no rows. On failure, one element {__error: "<status>"}, so check [0].__error before trusting the length; the reason is in repTakeError(). undefined for a repository that isn't iPACS.
Note
Rows stored on parent levels are included: an image query also returns rows of the same form stored on its series, study and project, and they look identical to the object's own. Use queryDataPointsEx() with maxup 0 for the object's own rows only, or queryDataPointsRaw() to see where each row came from.
Each field appears once; for duplicate names the first value wins, so the server's creator and timestamp are kept even if the form stores its own.

◆ queryDataPointsEx()

VariantList queryDataPointsEx ( AbstractDicomRepository * rep,
string type,
string uid,
string form,
double version,
int maxup = -1 )

Queries datapoints like queryDataPoints(), with the form version and parent levels exposed.

Note
Example: only the series' own SubjectInformation, not the study's
var dps = VQ.queryDataPointsEx(rep, 'series', seriesUid, 'SubjectInformation', 0, 0);
Parameters
repiPACS repository
typeLevel, lowercase plural: projects, studies, series or images
uidUID for the level; empty at project level
formForm name, unencoded
versionForm version. Required by the endpoint but ignored by the server (every version is returned); pass 0. The stored version of each row is returned only by queryDataPointsRaw().
maxupParent levels to include: -1 = all, up to the project (the default, and what queryDataPoints() does); 0 = this object only; 1 = this object and its parent; and so on.
Returns
Same shape as queryDataPoints(), including [{__error: ...}] on failure and for a repository that isn't iPACS

◆ queryImages()

Object queryImages ( AbstractDicomRepository * rep,
string studyInstanceUID,
string seriesInstanceUID )

Performs query of DICOM repository for images within a series, and returns images matching criteria.

Parameters
repDICOM repository
studyInstanceUIDStudyInstanceUID of study
seriesInstanceUIDSeriesInstanceUID of series
Returns
Array with one object per image, or undefined if the query failed (the reason is logged). Each object maps DICOM attribute names to their values, as strings:
  • StudyInstanceUID, SeriesInstanceUID, SOPInstanceUID
  • SOPClassUID, ImageType, ContentDate, ContentTime, Rows, Columns, InstanceNumber, ImageID
  • FileType (local folders and iPACS) or ImageComments (DICOM servers)
  • Modality, copied from the series (iPACS and DICOM servers)

A DICOM server leaves out attributes it did not send. Other keys, such as names starting with "__", are for VivoQuant's own use and can change.

var images = VQ.queryImages(rep, studyUid, seriesUid);
if (images && images.length > 0)
VQ.debug(images.length + " images; first is " + images[0].SOPInstanceUID);

◆ querySeries()

Object querySeries ( AbstractDicomRepository * rep,
string studyInstanceUID )

Performs query of DICOM repository for series within a given study, and returns series matching criteria.

Parameters
repDICOM repository
studyInstanceUIDStudyInstanceUID of study
Returns
Array with one object per series, or undefined if the query failed (the reason is logged). Each object maps DICOM attribute names to their values, as strings:
  • StudyInstanceUID, SeriesInstanceUID, Modality, SeriesDescription, SeriesDate, SeriesNumber, SeriesTime, ManufacturersModelName

A DICOM server spells the names as its DICOM dictionary does (ManufacturerModelName with current DCMTK), returns ProtocolName instead of SeriesNumber, and leaves out attributes it did not send. Other keys, such as names starting with "__", are for VivoQuant's own use and can change.

◆ queryStudies()

Object queryStudies ( AbstractDicomRepository * rep,
string patientName,
string patientID = string(),
string dateRange = string(),
string studyDesc = string() )

Performs query of DICOM repository for studies matching argument criteria.

Parameters
repDICOM repository
patientNamePatientsName filter
patientIDPatientID filter
dateRangeDate filter
studyDescStudyDescription filter
Returns
Array with one object per study, or undefined if the query failed (the reason is logged). Each object maps DICOM attribute names to their values, as strings:
  • StudyInstanceUID, PatientsName, PatientID, StudyDate, StudyTime, StudyDescription

A DICOM server spells the names as its DICOM dictionary does (PatientName rather than PatientsName with current DCMTK), also returns PatientComments, and leaves out attributes it did not send. Other keys, such as names starting with "__", are for VivoQuant's own use and can change.

◆ queryStudyPlan()

Object queryStudyPlan ( AbstractDicomRepository * rep,
string plan,
string cohort,
string group,
string animal,
string modality,
string date,
string event = "$0" )

Performs query of DICOM repository for the study plan entries matching the given criteria.

Parameters
repDICOM repository
planStudy plan
cohortCohort
groupGroup
animalAnimal
modalityModality
dateDate
event(optional) Event. If omitted, the first event of the day is returned

◆ quit()

void quit ( )

Quits VivoQuant, asking the user first if the session is interactive (see isInteractive()).

VivoQuant closes about one second after this function returns, so the rest of the script, including any finally blocks, still runs. End the script after calling quit(). If the user declines, VivoQuant stays open and the script continues.

◆ rand() [1/2]

int rand ( )

Returns a random integer.

Returns

◆ rand() [2/2]

int rand ( int max)

Returns random positive integer less than given maximum.

Parameters
maxMaximum value of random positive integer

◆ readCSVFile()

Object readCSVFile ( string name)

Parse a CSV file into arrays of values.

Parameters
nameThe CSV file to read
Returns
A table object with the values in the file, as strings. Columns are split on the CSV separator set in the VivoQuant settings. If the file is missing or can't be read, the table is empty.

◆ readFile()

Array< string > readFile ( string filepath)

Reads file into array of strings.

Parameters
filepathPath to file

◆ renameFile()

bool renameFile ( string filepath,
string newname )

Renames file at given path.

Parameters
filepathCurrent path to file
newnameNew name of the file
Returns
bool True if file renamed successfully, false otherwise

◆ repError()

string repError ( AbstractDicomRepository * rep)

Returns the repository's last error text without clearing it.

Applies to every call on the repository, XML and REST alike (query() included).

Parameters
repRepository
Returns
The error text, or "" when there is none

◆ repProject()

string repProject ( AbstractDicomRepository * rep)

Returns the repository's current project path.

Legacy XML calls are scoped to this project. The server lower-cases paths, so it may differ in case from the path that was set.

Parameters
repRepository

◆ repServerVersion()

string repServerVersion ( AbstractDicomRepository * rep)

Returns the iPACS server version, e.g. "2021.3.12.0".

Parameters
repiPACS repository
Returns
The version, or "" when it couldn't be determined or the repository isn't iPACS

◆ repSetProject()

void repSetProject ( AbstractDicomRepository * rep,
string projectPath )

Switches the repository to another project.

Every later legacy XML call is scoped to the new project, and the cached REST project id is updated with it. Datapoints never cross projects: each project sees only its own, even when two projects hold the same study.

Parameters
repRepository
projectPathProject path, e.g. "/group/project"

◆ repSetQuiet()

void repSetQuiet ( AbstractDicomRepository * rep,
bool quiet )

Suppresses modal prompts (SSL warnings and similar) for the repository's requests.

For unattended scripts. With prompts suppressed, a request that would have asked is aborted instead. Set it back to false when done.

Parameters
repRepository
quiettrue to suppress prompts

◆ repTakeError()

string repTakeError ( AbstractDicomRepository * rep)

Returns the repository's last error text and clears it.

Call it after a failed request to get the reason (query() returns undefined and queryDataPoints() returns [{__error: "404"}]), or before a request so an older error isn't mistaken for a new one.

Parameters
repRepository
Returns
The error text, or "" when there is none

◆ repUrl()

string repUrl ( AbstractDicomRepository * rep)

Returns the repository URL without the password, e.g. for logs and reports.

Parameters
repiPACS repository

◆ rmDir()

bool rmDir ( string dirpath)

Removes directory at given path.

Parameters
dirpathPath to directory
Returns
bool True if directory removed successfully, false otherwise

◆ saveDataViaITK() [1/2]

void saveDataViaITK ( string filepath,
Index idx )

Stores data to disk in ITK MHD/RAW or MHD/ZRAW file format.

Parameters
filepathPath of output file. Note: should end in .RAW or .ZRAW to output MHD/RAW or MHD/ZRAW pair, respectively.
idxIndex of data to save in Data Manager (see index())

◆ saveDataViaITK() [2/2]

void saveDataViaITK ( string filepath,
int i )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
filepathPath of output file, as above
iTop-level position of the data in the Data Manager, as for index() (not flatIndex())

◆ saveDataViaITK4D()

void saveDataViaITK4D ( string filepath)

Stores all data in Data Manager to disk as a single ITK 4D dataset in MHD/RAW or MHD/ZRAW file format.

Parameters
filepathPath of output file. Note: should end in .RAW or .ZRAW to output MHD/RAW or MHD/ZRAW pair, respectively.

◆ saveScreenshot()

bool saveScreenshot ( string fileName)

Saves screenshot of VivoQuant.

Parameters
fileNameOutput path of screenshot

◆ scriptPanel()

Object scriptPanel ( )

Returns the script panel, a dock that scripts fill with fields and read back.

Every call returns the same panel. Its contents stay between scripts, so a script that builds its own fields should start with clear(). Handlers a script connects to the panel's valueChanged signal are removed when the script ends.

var panel = VQ.scriptPanel();
panel.clear();
panel.setTitle('QC Review');
panel.setFields([
{ name: 'reader', label: 'Reader', type: 'text' },
{ name: 'quality', label: 'Image quality', type: 'item', items: ['Good', 'Poor'] }
]);
panel.showPanel();
panel.wait('Submit'); // let the user edit until they press Submit
var values = panel.values(); // { reader: ..., quality: ... }
Returns
the panel, or null if VivoScript isn't available (no main window, or no VivoScript license)
See also
ScriptPanel for the field types, layout and the full list of functions

◆ setConfig()

void setConfig ( string entry,
Variant & val,
bool force = false )

Sets option in VivoQuant configuration to given value.

Parameters
entryOption in VivoQuant configuration
valDesired value
force(optional) If val is not a recognized value for the entry, determines whether the entry will be forced to take on the value (1) or not (0)

◆ setDefaultDicomFormat()

void setDefaultDicomFormat ( string modality,
VQ.DICOMImageFormat format,
bool dynamic = false )

Sets the default DICOM storage format for a modality, for the rest of this VivoQuant session.

The default format is used whenever VivoQuant saves DICOM without being told which format to use, such as the Splitting operator's "split to files" functions and the 3D Brain Atlas upload to iPACS. Functions that take a format argument (e.g. storeAsDICOM()) are not affected. The setting is not saved: it takes precedence over the default formats configured in the DICOM tab of the Configuration dialog until VivoQuant is restarted, and never changes those saved settings.

Parameters
modalityDICOM modality code, e.g. "CT", "PT", "NM", "MR" (case-insensitive)
formatA value of VQ.DICOMImageFormat
dynamicfalse (default) to set the format for static data, true to set it for dynamic data. MFModule is not valid for dynamic data and is replaced with MFGroup.
See also
getDefaultDicomFormat()

◆ setHash()

void setHash ( string key,
string val )
inline

Sets value of key in hash.

Parameters
keyKey in hash
valValue for key

◆ setInteractive()

void setInteractive ( bool b)

Sets whether VivoQuant shows dialogs (see isInteractive()).

Setting it to false suppresses dialogs throughout VivoQuant, not just in VQS functions; their messages are written to the log instead. This is useful when prototyping a script in the GUI and you don't want to answer the same dialogs on every run.

Parameters
btrue for interactive, false for non-interactive
Note
The setting lasts until the script (or console command) ends; the previous state is then restored. Setting it to true cannot make a --script, containerized or GUI-less session interactive.
Warning
Use only for prototyping or testing, and only when you know which dialogs your script triggers. While non-interactive:
  • Dialogs that ask a question are answered automatically with a built-in default, which may not be the choice you would make. The script may continue past a warning you would have stopped at, or skip a step you would have confirmed.
  • Errors and warnings are not shown; they are only written to the log. Check the log after the script runs.
  • Some dialogs do not honor this setting and will still appear and wait for input.

◆ setOption()

void setOption ( string cbname,
string opt )

Set widget to given option; for use with widgets with multiple options (e.g. comboboxes).

Parameters
cbnameName of widget
optName of option

◆ setOptionObj()

void setOptionObj ( Object obj,
string opt )

Set widget to given option; for use with widgets with multiple options (e.g. comboboxes).

Note
Takes widget object as input (can be accessed by VQ.getWidget('widgetName'))
Parameters
objWidget object
optName of option

◆ setTestMode()

void setTestMode ( bool b = true)
inline

Sets VivoQuant to test mode (or not).

Parameters
bDetermines whether VivoQuant is in test mode (1) or not (0)
Note
Also sets VivoQuant non-interactive when enabled, and interactive when disabled (see setInteractive()).

◆ setVersion()

void setVersion ( string version)

Set a string representing the script version that will be used in audit log messages.

Parameters
versionThe version string

◆ showMessage()

void showMessage ( string msg,
bool modal = true )

Displays dialog box with user-defined message.

Parameters
msgMessage displayed in dialog box
modalDetermines whether VivoQuant is inaccessible while dialog box is open (true) or accessible (false)

◆ showView()

bool showView ( string view,
string op = string() )

Switches to a view and, optionally, an operator, and tells the user if that isn't possible.

Works like VQ.mainWin().setViewMode(), but instead of only logging a warning it shows a message when no data is loaded or the view or operator isn't available (for example because of the license). Useful in workflows and interactive scripts. When VivoQuant runs non-interactively (batch runs, tests), the message only goes to the log.

Parameters
viewView name as shown in the view mode list, e.g. "Slice View"
op(optional) Operator name as shown in the operator list, e.g. "3D ROI Tool". If omitted, the view keeps its current operator.
Returns
true if the view (and operator) is now active, false otherwise
VQ.showView("Slice View", "3D ROI Tool");

◆ sin()

double sin ( double f)
inline

Returns sin of angle.

Parameters
fAngle (in radians)

◆ splitROI2DICOM()

void splitROI2DICOM ( Index idx)

For each ROI in the 3D ROI Tool, creates a masked image of a given image in the Data Manager, where voxels outside the ROI are mapped to the given image's minimum.

Note
Example: Brain and Heart ROIs in the 3D ROI Tool. splitROI2DICOM(0) will create a masked image of the Reference image where all but the Brain ROI is masked out, and a masked image of the Reference image where all but the Heart ROI is masked out
Parameters
idxIndex of image in Data Manager (see index())

◆ startTool()

string startTool ( string tool,
string baseDir = ".",
Array< string > args = Array< string >() )

Start an external tool.

Parameters
toolThe application or external script to start
baseDirThe working directory for the tool
argsThe list of arguments for the tool
Returns
A string containing the status of the tool

◆ storeAsDICOM() [1/2]

int storeAsDICOM ( string filepath,
Index idx,
VQ.DICOMImageFormat format,
bool compress = false,
bool quiet = true )

Stores data to disk in DICOM file format.

Parameters
filepathPath of output file.
idxIndex of data to save in DataManager (see index())
formatA value of VQ.DICOMImageFormat
compressUse JPEG2000 Lossless compression
quietHide warning, error or information dialog
Note
Regarding format: 0 = Multi-Frame Module, 1 = Multi-Frame Functional Group, 2 = Single Frames
Returns
Success indicator: 0 = SaveOK, 1 = SaveAborted, 2 = SaveError

◆ storeAsDICOM() [2/2]

int storeAsDICOM ( string filepath,
int idx,
VQ.DICOMImageFormat format,
bool compress = false,
bool quiet = true )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
filepathPath of output file
idxTop-level position of the data in the DataManager, as for index() (not flatIndex())
formatA value of VQ.DICOMImageFormat
compressUse JPEG2000 Lossless compression
quietHide warning, error or information dialog
Returns
Success indicator: 0 = SaveOK, 1 = SaveAborted, 2 = SaveError

◆ storeAsDICOMByTimepoint()

int storeAsDICOMByTimepoint ( string filepath,
int idx,
VQ.DICOMImageFormat format,
bool compress = false,
VQ.TimePointsSettings timepointOption = VQ.TimePointsSettings.AllTimePoints,
VQ.TimepointFilesSettings timepointPerFileOption = VQ.TimepointFilesSettings.SingleFileForAllTimepoints )

Stores data to disk in DICOM file format, with the option to save by timepoint.

Parameters
filepathPath of output file
idxTop-level position of the data in the DataManager, as for index() (not flatIndex())
formatA value of VQ.DICOMImageFormat
compressUse JPEG2000 Lossless compression
timepointOptionSelection of timepoints from VQ.TimePointsSettings
timepointPerFileOptionSelection of output files from VQ.TimepointFilesSettings To save current timepoint, first move to the desired timepoint using: VQ.dataManager().setDynamicActive(VQ.index(idx), timepoint_idx);
Returns
Success indicator: 0 = SaveOK, 1 = SaveAborted, 2 = SaveError

◆ storeAsRaw() [1/2]

bool storeAsRaw ( string filepath,
Index idx )

Stores data to disk in MHD/RAW (or MHD/ZRAW) file format.

Parameters
filepathPath of output file. Note: should end in .RAW or .ZRAW to output MHD/RAW or MHD/ZRAW pair, respectively.
idxIndex of data to save in Data Manager (see index())

◆ storeAsRaw() [2/2]

bool storeAsRaw ( string filepath,
int i )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
filepathPath of output file, as above
iTop-level position of the data in the Data Manager, as for index() (not flatIndex())

◆ storeData()

int storeData ( AbstractDicomRepository * rep,
Index idx,
VQ.DICOMImageFormat format,
bool compress = false )

Stores DICOM data to a DICOM repository.

Parameters
repThe DICOM repository object
idxIndex of data to save in DataManager (see index())
formatA value of VQ.DICOMImageFormat
compressUse JPEG2000 Lossless compression
Returns
Success indicator: 0 = SaveOK, 1 = SaveAborted, 2 = SaveError.
See also
DICOMImageFormat

◆ storeDataByTimepoint()

int storeDataByTimepoint ( AbstractDicomRepository * rep,
int idx,
VQ.DICOMImageFormat format,
bool compress = false,
VQ.TimePointsSettings timepointOption = VQ.TimePointsSettings.AllTimePoints,
VQ.TimepointFilesSettings timepointPerFileOption = VQ.TimepointFilesSettings.SingleFileForAllTimepoints )

Stores DICOM data to a DICOM repository, with the option to save by timepoint.

Parameters
repThe DICOM repository object
idxTop-level position of the data in the DataManager, as for index() (not flatIndex())
formatA value of VQ.DICOMImageFormat
compressUse JPEG2000 Lossless compression
timepointOptionFor dynamic data, 0=Save all timepoints, 1=Save current timepoint. Ignored for static data.
timepointPerFileOptionFor dynamic images, 0=In a single file, 1=One file per timepoint. Ignored for static data.
Returns
Success indicator: 0 = SaveOK, 1 = SaveAborted, 2 = SaveError

◆ storeHash()

bool storeHash ( string fileName)

Stores all keys and values in hash to local file.

Parameters
fileNamePath to output file in which to store hash keys and values

◆ stripCredentials()

string stripCredentials ( string url_string)

Returns URL of DICOM repository with credentials (username and password) removed.

Parameters
url_stringFull URL with credentials

◆ submitDataPoint()

Object submitDataPoint ( AbstractDicomRepository * rep,
string uid,
Object & data,
string type = string() )

Submits a datapoint through the legacy XML API (xmldicom datapoint).

Every submission adds a new row; nothing is replaced or merged. Readers that want the current value pick the newest row.

Note
Example: a study-level annotation
VQ.submitDataPoint(rep, '1.2.3.4.5', { _form: 'annotation', text: 'Looks fine' }, 'studies');
Example: a project-level datapoint (empty UID)
VQ.submitDataPoint(rep, '', { _form: 'Protocol', Title: 'Study A' }, 'projects');
Parameters
repiPACS repository
uidStudyInstanceUID, SeriesInstanceUID or SOPInstanceUID for the level. At project level leave it empty: the repository's project sets the scope. An empty UID at any other level fails without a request.
dataObject of fields. _form (required) names the form; _version (optional) sets the form version, stored as an integer (1.5 becomes 2, text becomes 0; default 1). Values are converted with JavaScript String(): numbers and booleans to text, arrays joined with "," (so ["a,b","c"] reads back as "a,b,c"), objects to "[object Object]", null to "null". Empty strings are dropped by the server.
typeLevel, lowercase plural: projects, studies, series or images. If omitted, the server stores against an image, so study and series UIDs fail. Always pass it.
Returns
"OK", or false on failure. Only after false, read the reason with repTakeError(). Check with === false: older versions returned undefined on failure, and a script that checks === false also runs on them.
Note
Example: checking the result
if (VQ.submitDataPoint(rep, uid, { _form: 'annotation', text: 'Looks fine' }, 'images') === false) {
throw new Error('Datapoint not stored: ' + VQ.repTakeError(rep));
}
A datapoint for an image with unsaved changes is stored with a warning for now, and refused (false) when enforced (see enforceSyncedDatapoints()): saving gives the image new UIDs, so the old ones no longer identify the data that was measured.
Field names are cut at the first character other than letters, digits and '' ("dash-key" is stored as "dash"), and names starting with '' other than form and _version are dropped. Use names matching [A-Za-z][A-Za-z0-9]*.
A project-level form is also returned by every study, series and image query for the same form name (see queryDataPoints()), so give it a name of its own.
For many rows of one form, see batchStoreDataPoints().

◆ suspend()

void suspend ( string message = string())

Suspends script and opens a modeless "Resume" dialog.

Parameters
messageString to display in dialog box

◆ triggerAction()

Object triggerAction ( string name)

Triggers a menu action of the main window, as if the user had selected it.

Parameters
nameName of the action
Returns
true if the action was found and triggered, false if no action has that name

◆ webDisk()

Object webDisk ( string rep)

Return IPACS WebDisk object for project in given iPACS repository.

Parameters
repDICOM repository, including URL/path to repository and path to WebDisk directory

◆ writeFile()

bool writeFile ( string filepath,
string text )

Writes file to disk with given text.

Note
If file exists, will overwrite file.
Parameters
filepathPath to output file
textText to write to output file