|
VivoQuant 6.5.0
|
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 () |
| 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.
| 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().
| rep | Repository |
| level | projects, studies, series or images |
| target | Object with StudyInstanceUID, SeriesInstanceUID and SOPInstanceUID, as far down as the level needs; other properties are ignored. Unused at project level. |
| form | Form name; no '/' or '*' |
| values | Object 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. |
| formVersion | Form version (default 1) |
| bool appendFile | ( | string | filepath, |
| string | text ) |
Appends text to file on disk.
| filepath | Path of output file |
| text | Text to write to output file |
| 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.
| ask | If true, a prompt will ask the user to enter a reason if they do something that cancels the script while it is running |
| bool askYesNoQuestion | ( | string | msg, |
| bool | modal = true ) |
Displays dialog box with "Yes" or "No" option.
| msg | Message displayed in dialog box |
| modal | Determines whether VivoQuant is inaccesible while dialog box is open (true) or accesible (false) |
| void auditTrailMessage | ( | string | msg, |
| string | project = "/", | ||
| string | type = string() ) |
Creates an audit trail message on the current repository.
| msg | The message to be logged |
| project | The project to log the message to |
| type | Message type |
| Array< string > availableItems | ( | string | name | ) |
Returns available items from widget with multiple options.
| name | Name of widget |
| Array< string > availableItemsObj | ( | Object | obj | ) |
Returns available items from widget with multiple options.
| obj | Widget object, which can be accessed by VQ.getWidget() |
| 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.
| filePath | Path to the HTML file to create. Overwrites any existing file. |
| 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.
| filePath | Path to the JSON file to write when endWidgetDumpJson is called. |
| Object BrainAtlasTool | ( | bool | visible = true, |
| bool | quiet = false ) |
Opens the Brain Atlas Tool.
| visible | Whether or not the tool dialog is shown upon being created |
| quiet | Whether or not the tool is in quiet mode. In quiet mode no warnings or popups will be displayed. |
| bool copyFile | ( | string | filepath, |
| string | newpath ) |
Copies file from one path to another.
| filepath | Current path to file |
| newpath | New path to file |
|
inline |
Returns cosine of angle.
| f | Angle (in radians) |
|
inline |
Convenience function to return a 0-padded counter.
| c | Number to pad |
| s | Number of digits in padded output |
| Object dcmRep | ( | string | text | ) |
Creates and returns a DICOM repository object.
| text | Location 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://". |
| void debug | ( | string | text | ) |
Prints output to debugger and/or logfile.
| text | String to be printed |
| bool deleteFile | ( | string | filepath | ) |
Deletes file at given path.
| filepath | Path to file |
| bool deletePath | ( | string | path | ) |
Deletes folder and all its contents at given path.
| path | to be deleted |
| Object dicomBrowser | ( | AbstractDicomRepository * | rep | ) |
Returns VivoQuant's Data Browser object for a given DICOM repository.
| rep | DICOM repository to use with Data Browser object |
| 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.
| rep | DICOM repository |
| studyInstanceUID | StudyInstanceUID of study in which image(s) are found |
| seriesInstanceUID | SeriesInstanceUID of series in which image(s) are found |
| append | Determines 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 |
| void dicomBrowserLoad | ( | DicomBrowser * | dcmBrowser, |
| string | studyInstanceUID, | ||
| string | seriesInstanceUID, | ||
| string | sopInstanceUID = string() ) |
Downloads image(s) from DICOM repository and loads them into Data Manager.
| dcmBrowser | DICOM browser object |
| studyInstanceUID | StudyInstanceUID of study in which image(s) are found |
| seriesInstanceUID | SeriesInstanceUID of series in which image(s) are found |
| sopInstanceUID | SOPInstanceUID of image(s) |
| Object downloadImages | ( | AbstractDicomRepository * | rep, |
| string | studyInstanceUID, | ||
| string | seriesInstanceUID, | ||
| string | sopInstanceUID = string() ) |
Downloads image to cache.
| rep | DICOM repository |
| studyInstanceUID | StudyInstanceUID of study |
| seriesInstanceUID | SeriesInstanceUID of series |
| sopInstanceUID | SOPInstanceUID of image |
| Object downloadImages | ( | string | targetDir, |
| AbstractDicomRepository * | rep, | ||
| string | studyInstanceUID, | ||
| string | seriesInstanceUID, | ||
| string | sopInstanceUID = string() ) |
Downloads image to a location on disk.
| targetDir | Desired location on disk |
| rep | DICOM repository |
| studyInstanceUID | StudyInstanceUID of study |
| seriesInstanceUID | SeriesInstanceUID of series |
| sopInstanceUID | SOPInstanceUID of image |
| Object downloadImages | ( | string | targetDir, |
| bool | forceRedownload, | ||
| AbstractDicomRepository * | rep, | ||
| string | studyInstanceUID, | ||
| string | seriesInstanceUID, | ||
| string | sopInstanceUID = string() ) |
Downloads image to a location on disk.
| targetDir | Desired location on disk |
| rep | DICOM repository |
| studyInstanceUID | StudyInstanceUID of study |
| seriesInstanceUID | SeriesInstanceUID of series |
| sopInstanceUID | SOPInstanceUID of image |
| forceRedownload | whether to re-download if the image is already in the cache |
| 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.
| showInteractive | Whether to include interactive widgets in the output. |
| showNonInteractive | Whether to include structural non-interactive named widgets. |
| 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.
| 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.
| target | A Object wrapping an object that implements IDumpableWidget. |
| showInteractive | Whether to include interactive widgets in the output. |
| showNonInteractive | Whether to include structural non-interactive named widgets. |
| 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.
| target | A Object wrapping an object that implements IDumpableWidget. |
| 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.
| 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.
| 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.
| enforce | true to refuse the stores, false to go back to the preference |
| 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.
| bool fileExists | ( | string | path | ) |
Checks whether file at specified path exists.
| path | Full path to file |
| 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).
| rep | Repository |
| level | projects, studies, series or images |
| target | Object with StudyInstanceUID, SeriesInstanceUID and SOPInstanceUID, as far down as the level needs; or null for every object at the level. Unused at project level. |
| query | A form name, or an object:
|
| 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));.
| i | The first level position |
| bool folderExists | ( | string | path | ) |
Checks whether file at specified path exists.
| path | Full path to folder |
| float frand | ( | ) |
Returns a random float.
| 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.
| name | Name of the action |
null if no action has that name | string getConfig | ( | string | entry, |
| string | defaultValue = string() ) |
Returns current value of option in VivoQuant configuration.
| entry | Option in VivoQuant configuration |
| defaultValue | (optional) Value returned if the option is not set |
| 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.
| rep | DICOM repository |
| tag | DICOM tag |
| studyInstanceUID | StudyInstanceUID of study |
| seriesInstanceUID | SeriesInstanceUID of series |
| sopInstanceUID | SOPInstanceUID of image |
| 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().
| modality | DICOM modality code, e.g. "CT", "PT", "NM", "MR" (case-insensitive) |
| dynamic | false (default) for static data, true for dynamic data |
| string getDefaultPal | ( | string | modality, |
| int | i ) |
get default palette from modality
| modality | Image modality |
| i | Index in Data Manager |
| string getEnv | ( | string | key, |
| string | defaultValue = string() ) |
Get the system's environment variables.
| key | Name of system environment variable |
| defaultValue | The default value if they key does not exists |
| double getHalfLife | ( | string | name | ) |
Get an isotope's half life.
| name | The isotope's name |
|
inline |
Returns current value of key in hash.
| key | Key in hash |
| def | (optional) Value returned if the key is not in the hash |
|
inline |
Returns current numerical value of key in hash.
| key | Key in hash |
| def | (optional) Value returned if the key is not in the hash |
| 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.
| i | The first level position |
| 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.
| i | The first level position (parent) |
| j | The second level position (child) |
| Array< string > getLocalFiles | ( | string | caption = "Select files:", |
| string | startDir = string(".") ) |
Returns array of paths to files selected by user in file dialog.
| caption | Text in title of dialog |
| startDir | Default path at which the file dialog starts |
| Object getLocalPath | ( | string | caption = "Select directory:", |
| string | startDir = string(".") ) |
Returns path of directory selected by user in file dialog.
| caption | Text in title of dialog |
| startDir | Default path at which file dialog starts |
| string getOS | ( | ) |
get current Operating System name
| Object getROIStats | ( | Index | idx | ) |
Returns array of ROI quantification table information for given dataset and ALL ROIs.
| idx | Index of timestamp dataset from which to calculate stats (see flatIndex()) |
roiid field says which). Each object has the same fields as the single-ROI version of this function, and every value is a string. | Object getROIStats | ( | Index | idx, |
| int | roiID, | ||
| int | layerID = -1 ) |
Returns object with ROI quantification table information for given dataset and ROI.
| idx | Index of timestamp dataset from which to calculate stats (see flatIndex()) |
| roiID | Index 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. |
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). idx throws an error. | 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.
| datID | Flat position of the data set, as for flatIndex() (not index()) |
| 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.
| datID | Flat position of the data set, as for flatIndex() (not index()) |
| roiID | Index of ROI for which to calculate stats (0 is the background) |
| Object getSavePath | ( | string | caption = string("Select output file:"), |
| string | startDir = string("."), | ||
| string | filter = string() ) |
Returns path to file selected by user in file dialog.
| caption | Text in title of dialog |
| startDir | Default path at which file dialog starts |
| filter | File type filter for file dialog |
| string getTempFolder | ( | ) |
Returns Temp folder for current user.
| VariantMap getValues | ( | string | title, |
| VariantMap & | map, | ||
| bool | modal = true ) |
Displays a dialog requesting multiple user inputs in a single form.
Minimal example:
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.
| title | Window title of the dialog. |
| map | A map from label text to an input specification. The specification may be either a string or a VariantList: |
Supported explicit input types:
All parameters are optional unless otherwise noted.
Implicit behavior:
For item inputs, the list of items must be provided.
| modal | If true, the dialog is modal and blocks interaction with the rest of the application while open. |
| string getVersion | ( | ) |
Get the string representing the script version.
| 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.
| name | Name of widget. |
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
| Object hasAction | ( | string | name | ) |
Checks whether the main window has a menu action with the given name.
| name | Name of the action |
true if the action exists, false otherwise | Object histogramTool | ( | ) |
Returns Histogram tool object.
| 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));.
| i | The first level position |
| 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));.
| i | The first level position (parent) |
| j | The second level position (child) |
| Object isActionEnabled | ( | string | name | ) |
Checks whether a menu action of the main window is enabled.
| name | Name of the action |
true if the action exists and is enabled, false otherwise | 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.
|
inline |
True while a script or console command is being evaluated, including while it waits, and including internal callbacks evaluated during such a wait.
| Array< string > listFiles | ( | string | folder, |
| string | pattern ) |
Lists the files under a folder and all its subfolders whose name matches a wildcard pattern.
| folder | Folder to search; a relative path is relative to the folder VivoQuant was started in |
| pattern | File name wildcard, e.g. "*.taxon.vqs" |
| bool loadHash | ( | string | fileName | ) |
Loads local file, containing hash keys and values, to VivoQuant's persistent hash.
| fileName | Path to file |
| Object loadRepository | ( | string | name | ) |
Returns DICOM repository object from DICOM repository saved in VivoQuant.
| name | Name of DICOM repository saved in VivoQuant |
| 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.
| idx | Index where opened data should be positioned in the DataManager (see index()) |
| imgFiles | Index List of RGB image to load as a volume |
| voxX | Expected X voxel size |
| voxY | Expected Y voxel size |
| voxZ | Expected Z voxel size |
| rgbRep | Representation of RGB values (0=Red, 1=Green, 2=Blue, 3=AVG, 4=SUM, 5=MAX, 6=MIN) |
| forcePlanar | Force volume to load as planar |
| Object logMessage | ( | AbstractDicomRepository * | rep, |
| string | msg, | ||
| string | type = string() ) |
Creates a log message on the given DICOM repository.
| rep | The DicomRepository object |
| msg | The message to be logged |
| type | Message type |
| 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.
| dataIndex | The data index (see index()) |
| msg | The message to be logged |
| noipacsTitle | Default no iPACS title for warning |
| type | Message type |
| 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.
| showInteractive | Whether to log interactive widgets (QComboBox, QPushButton, etc). |
| showNonInteractive | Whether to log structural non-interactive named widgets. |
| 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().
| target | A Object wrapping an object that implements IDumpableWidget. |
| showInteractive | Whether to log interactive widgets (QComboBox, QPushButton, etc). |
| showNonInteractive | Whether to log structural non-interactive named widgets. |
| 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.
| dir | Directory on local disk |
| nameFilter | Expression 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) |
| Object MASTool | ( | string | libraryPath = string("") | ) |
Opens Multi-Atlas Segmentation Tool, formerly known as Whole Body Atlas).
| libraryPath | The path of the library to be used |
| void mkdir | ( | string | path, |
| string | subdir ) |
Creates sub-directory at specified path.
| path | Path in which to create new subdirectory |
| subdir | Name of new subdirectory |
| void openDataBrowser | ( | ) |
Opens the Data Browser, as File > Data Browser does.
Does nothing if DICOM loading is not available.
| bool openFileExternally | ( | string | path | ) |
Opens a local file in an external application.
| path | Full path to file |
| void openManual | ( | string | page = string() | ) |
Opens the online VivoQuant manual for this version, as Help > Manual - Online does.
| page | (optional) Page of the manual to open, e.g. "vqmanual_tools_keyboardshortcuts.html". Opens the start page if omitted. |
| void openScriptManual | ( | string | page = string() | ) |
Opens the online VQ Script manual for this version, as Help > VQ Script Manual does.
| page | (optional) Page of the manual to open. Opens the start page if omitted. |
| string preProcess | ( | string | protocol, |
| bool | showDialog = false ) |
Runs Pre-Processing Tool tool with the given protocol.
| protocol | String with protocol |
| showDialog | Whether or not the tool dialog is shown upon being created |
| Object PreProcessingTool | ( | bool | showDialog = true | ) |
Opens the Pre-Processing Tool.
| showDialog | Whether or not the tool dialog is shown upon being created |
| 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()).
| 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.
| label | Text in title of dialog box |
| cancelButtonText | Text in button that cancels process |
| minimum | Minimum value progress dialog object can take |
| maximum | Maximum value progress dialog object can take |
| 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().
| rep | iPACS repository |
| query | First 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 |
| 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.
| rep | iPACS repository |
| type | Level, lowercase plural: projects, studies, series or images |
| uid | UID for the level; empty at project level |
| form | Form name, unencoded |
| version | Form version; ignored by the server, pass 0 |
| maxup | Parent levels to include, as in queryDataPointsEx() |
| 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().
| rep | iPACS repository |
| type | Level, lowercase plural: projects, studies, series or images. Other spellings return 404. |
| uid | StudyInstanceUID, SeriesInstanceUID or SOPInstanceUID for the level. At project level leave it empty: the repository's project sets the scope. |
| form | Form name. Case-insensitive; no wildcards. Pass it unencoded (it is percent-encoded for the request). Names containing '/' can't be queried. |
| 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.
| rep | iPACS repository |
| type | Level, lowercase plural: projects, studies, series or images |
| uid | UID for the level; empty at project level |
| form | Form name, unencoded |
| version | Form 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(). |
| maxup | Parent 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. |
| Object queryImages | ( | AbstractDicomRepository * | rep, |
| string | studyInstanceUID, | ||
| string | seriesInstanceUID ) |
Performs query of DICOM repository for images within a series, and returns images matching criteria.
| rep | DICOM repository |
| studyInstanceUID | StudyInstanceUID of study |
| seriesInstanceUID | SeriesInstanceUID of series |
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.
| Object querySeries | ( | AbstractDicomRepository * | rep, |
| string | studyInstanceUID ) |
Performs query of DICOM repository for series within a given study, and returns series matching criteria.
| rep | DICOM repository |
| studyInstanceUID | StudyInstanceUID of study |
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.
| 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.
| rep | DICOM repository |
| patientName | PatientsName filter |
| patientID | PatientID filter |
| dateRange | Date filter |
| studyDesc | StudyDescription filter |
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.
| 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.
| rep | DICOM repository |
| plan | Study plan |
| cohort | Cohort |
| group | Group |
| animal | Animal |
| modality | Modality |
| date | Date |
| event | (optional) Event. If omitted, the first event of the day is returned |
| 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.
| int rand | ( | ) |
Returns a random integer.
| int rand | ( | int | max | ) |
Returns random positive integer less than given maximum.
| max | Maximum value of random positive integer |
| Object readCSVFile | ( | string | name | ) |
Parse a CSV file into arrays of values.
| name | The CSV file to read |
| Array< string > readFile | ( | string | filepath | ) |
Reads file into array of strings.
| filepath | Path to file |
| bool renameFile | ( | string | filepath, |
| string | newname ) |
Renames file at given path.
| filepath | Current path to file |
| newname | New name of the file |
| 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).
| rep | Repository |
| 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.
| rep | Repository |
| string repServerVersion | ( | AbstractDicomRepository * | rep | ) |
Returns the iPACS server version, e.g. "2021.3.12.0".
| rep | iPACS repository |
| 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.
| rep | Repository |
| projectPath | Project path, e.g. "/group/project" |
| 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.
| rep | Repository |
| quiet | true to suppress prompts |
| 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.
| rep | Repository |
| string repUrl | ( | AbstractDicomRepository * | rep | ) |
Returns the repository URL without the password, e.g. for logs and reports.
| rep | iPACS repository |
| bool rmDir | ( | string | dirpath | ) |
Removes directory at given path.
| dirpath | Path to directory |
| void saveDataViaITK | ( | string | filepath, |
| Index | idx ) |
Stores data to disk in ITK MHD/RAW or MHD/ZRAW file format.
| filepath | Path of output file. Note: should end in .RAW or .ZRAW to output MHD/RAW or MHD/ZRAW pair, respectively. |
| idx | Index of data to save in Data Manager (see index()) |
| 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.
| filepath | Path of output file, as above |
| i | Top-level position of the data in the Data Manager, as for index() (not flatIndex()) |
| 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.
| filepath | Path of output file. Note: should end in .RAW or .ZRAW to output MHD/RAW or MHD/ZRAW pair, respectively. |
| bool saveScreenshot | ( | string | fileName | ) |
Saves screenshot of VivoQuant.
| fileName | Output path of screenshot |
| 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.
| void setConfig | ( | string | entry, |
| Variant & | val, | ||
| bool | force = false ) |
Sets option in VivoQuant configuration to given value.
| entry | Option in VivoQuant configuration |
| val | Desired 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) |
| 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.
| modality | DICOM modality code, e.g. "CT", "PT", "NM", "MR" (case-insensitive) |
| format | A value of VQ.DICOMImageFormat |
| dynamic | false (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. |
|
inline |
Sets value of key in hash.
| key | Key in hash |
| val | Value for key |
| 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.
| b | true for interactive, false for non-interactive |
--script, containerized or GUI-less session interactive.| void setOption | ( | string | cbname, |
| string | opt ) |
Set widget to given option; for use with widgets with multiple options (e.g. comboboxes).
| cbname | Name of widget |
| opt | Name of option |
| void setOptionObj | ( | Object | obj, |
| string | opt ) |
Set widget to given option; for use with widgets with multiple options (e.g. comboboxes).
| obj | Widget object |
| opt | Name of option |
|
inline |
Sets VivoQuant to test mode (or not).
| b | Determines whether VivoQuant is in test mode (1) or not (0) |
| void setVersion | ( | string | version | ) |
Set a string representing the script version that will be used in audit log messages.
| version | The version string |
| void showMessage | ( | string | msg, |
| bool | modal = true ) |
Displays dialog box with user-defined message.
| msg | Message displayed in dialog box |
| modal | Determines whether VivoQuant is inaccessible while dialog box is open (true) or accessible (false) |
| 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.
| view | View 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. |
true if the view (and operator) is now active, false otherwise
|
inline |
Returns sin of angle.
| f | Angle (in radians) |
| 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.
| idx | Index of image in Data Manager (see index()) |
| string startTool | ( | string | tool, |
| string | baseDir = ".", | ||
| Array< string > | args = Array< string >() ) |
Start an external tool.
| tool | The application or external script to start |
| baseDir | The working directory for the tool |
| args | The list of arguments for the tool |
| int storeAsDICOM | ( | string | filepath, |
| Index | idx, | ||
| VQ.DICOMImageFormat | format, | ||
| bool | compress = false, | ||
| bool | quiet = true ) |
Stores data to disk in DICOM file format.
| filepath | Path of output file. |
| idx | Index of data to save in DataManager (see index()) |
| format | A value of VQ.DICOMImageFormat |
| compress | Use JPEG2000 Lossless compression |
| quiet | Hide warning, error or information dialog |
| 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.
| filepath | Path of output file |
| idx | Top-level position of the data in the DataManager, as for index() (not flatIndex()) |
| format | A value of VQ.DICOMImageFormat |
| compress | Use JPEG2000 Lossless compression |
| quiet | Hide warning, error or information dialog |
| 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.
| filepath | Path of output file |
| idx | Top-level position of the data in the DataManager, as for index() (not flatIndex()) |
| format | A value of VQ.DICOMImageFormat |
| compress | Use JPEG2000 Lossless compression |
| timepointOption | Selection of timepoints from VQ.TimePointsSettings |
| timepointPerFileOption | Selection 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); |
| bool storeAsRaw | ( | string | filepath, |
| Index | idx ) |
Stores data to disk in MHD/RAW (or MHD/ZRAW) file format.
| filepath | Path of output file. Note: should end in .RAW or .ZRAW to output MHD/RAW or MHD/ZRAW pair, respectively. |
| idx | Index of data to save in Data Manager (see index()) |
| 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.
| filepath | Path of output file, as above |
| i | Top-level position of the data in the Data Manager, as for index() (not flatIndex()) |
| int storeData | ( | AbstractDicomRepository * | rep, |
| Index | idx, | ||
| VQ.DICOMImageFormat | format, | ||
| bool | compress = false ) |
Stores DICOM data to a DICOM repository.
| rep | The DICOM repository object |
| idx | Index of data to save in DataManager (see index()) |
| format | A value of VQ.DICOMImageFormat |
| compress | Use JPEG2000 Lossless compression |
| 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.
| rep | The DICOM repository object |
| idx | Top-level position of the data in the DataManager, as for index() (not flatIndex()) |
| format | A value of VQ.DICOMImageFormat |
| compress | Use JPEG2000 Lossless compression |
| timepointOption | For dynamic data, 0=Save all timepoints, 1=Save current timepoint. Ignored for static data. |
| timepointPerFileOption | For dynamic images, 0=In a single file, 1=One file per timepoint. Ignored for static data. |
| bool storeHash | ( | string | fileName | ) |
Stores all keys and values in hash to local file.
| fileName | Path to output file in which to store hash keys and values |
| string stripCredentials | ( | string | url_string | ) |
Returns URL of DICOM repository with credentials (username and password) removed.
| url_string | Full URL with credentials |
| 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.
| rep | iPACS repository |
| uid | StudyInstanceUID, 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. |
| data | Object 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. |
| type | Level, lowercase plural: projects, studies, series or images. If omitted, the server stores against an image, so study and series UIDs fail. Always pass it. |
| void suspend | ( | string | message = string() | ) |
Suspends script and opens a modeless "Resume" dialog.
| message | String to display in dialog box |
| Object triggerAction | ( | string | name | ) |
Triggers a menu action of the main window, as if the user had selected it.
| name | Name of the action |
true if the action was found and triggered, false if no action has that name | Object webDisk | ( | string | rep | ) |
Return IPACS WebDisk object for project in given iPACS repository.
| rep | DICOM repository, including URL/path to repository and path to WebDisk directory |
| bool writeFile | ( | string | filepath, |
| string | text ) |
Writes file to disk with given text.
| filepath | Path to output file |
| text | Text to write to output file |