The Workflow Assistant guides you through a task one step at a time, such as a lab’s standard analysis procedure. Each workflow is a plain Markdown file with written instructions, images, links and, optionally, VivoScript that the user can run with a click.

VivoQuant comes with one workflow, a tutorial that shows how to use the Workflow Assistant and how to write your own workflows.

Getting There

The Workflow Assistant may be reached via Workflow Assistant in the Tools menu, or with the Workflow Assistant button on the main toolbar. It opens in a dock, which you can move or pop out like any other dock.

The first time the Workflow Assistant opens, VivoQuant creates your workflows folder and copies the tutorial into it.

Using a Workflow

  • Choose a workflow from the list at the top. The steps of the workflow are listed below it.
  • Use the arrow buttons at the bottom to go to the previous or next step, or click a step in the list to jump to it.
  • Links in the page move between steps, open web pages and files, or open another workflow.
  • Nothing in VivoQuant changes until you click something. A step can contain VivoScript, shown with a ▶ Run link or a link marked with ▶. Read the step first, then click the link when you are ready.
  • What a snippet or script prints, and any error, is shown in the Output area under the page. See Script Output. Other messages, such as a missing file, are shown in a line under the page.

Workflows in your own workflows folder update as soon as they are saved, staying on the same step, and workflows added to or removed from that folder show up in the list straight away. Workflows in additional folders are read when the Workflow Assistant first opens. To see changes made there since, click the refresh button next to the workflow list, which reads all workflow folders again.

Text Size

Hold Ctrl and turn the mouse wheel over the page to make the text larger or smaller. The Edit menu has the same commands, and Normal Text Size to go back to the default size. The text size is remembered the next time VivoQuant starts.

The Edit Menu

The Edit menu button next to the workflow list has the following commands:

Command Description
New Workflow… Asks for a title, creates a workflow from a template in your workflows folder and opens it in your editor.
Edit Workflow Opens the current workflow in the program set up to open .md files. If there is none, the folder is opened instead.
Open Workflows Folder Shows your workflows folder, for example to add, rename or delete workflows.
Workflow Folders… Adds other folders to read workflows from, such as a shared lab folder, and sets the order they are read in.
Larger Text, Smaller Text, Normal Text Size Changes the size of the text. See Text Size.
Restore Tutorial Copies the tutorial back into your workflows folder, for example after you deleted or changed it. Asks before replacing your copy.

Where Workflows Are Kept

Every .md file in your workflows folder is listed in the Workflow Assistant. The folder is in your user profile, so you can add, change and delete workflows without administrator rights:

System Workflows folder
Windows %APPDATA%\Perceptive\VivoQuant\workflows
macOS ~/Library/VivoQuant/workflows
Linux ~/.VivoQuant/workflows

Use Open Workflows Folder in the Edit menu to go straight to it.

The tutorial is an ordinary workflow in this folder. Once you no longer need it, delete example.md and its example folder. Use Restore Tutorial to bring it back. Installing or updating VivoQuant never changes your workflows folder.

Additional Workflow Folders

Use Workflow Folders… in the Edit menu to also read workflows from other folders, such as a folder on a network drive that your lab shares. Workflows in these folders are listed together with your own.

  • Folders are read from top to bottom. Your own folder is always first.
  • If two workflows have the same title, only the first one found is listed. To change a shared workflow for yourself, copy it into your own folder and edit the copy; your copy is the one listed.
  • These folders don’t update by themselves. When a workflow in one of them has changed, click the refresh button next to the workflow list. This way the Workflow Assistant never waits for a slow network drive while you work.
  • If a folder is not available, for example because the network drive is not connected, a message is shown under the page and the other folders are still read.

Writing a Workflow

A workflow is a Markdown (.md) file, a plain text format that is easy to read and write. Any text editor can be used. The Workflow Assistant follows GitHub Flavored Markdown, so a workflow looks much the same here as on GitHub or in Markdown editors such as Visual Studio Code, Typora or Obsidian.

The quickest way to start is New Workflow… in the Edit menu. Keep the editor and the Workflow Assistant side by side while you write: every time you save, the Workflow Assistant shows the change. This works for workflows in your own workflows folder, so write and test a workflow there, then copy it to a shared folder.

Steps

# My Workflow

Text before the first step is shown as an "Overview" step.

## Load the data

Each `##` heading starts a new step. Use **bold**, *italic*,
lists, tables and `code` as usual.

## Draw ROIs

...
  • The first # heading is the workflow title shown in the workflow list. If there is none, the file name is used.
  • Each ## heading starts a step, which is listed in the step list. Use ### headings for sections within a step.
  • Write step headings as plain text. Formatting such as **bold** is shown as typed in a heading, and links to the step (see Links) may not match what other Markdown viewers expect.
  • HTML tags are not supported and are shown as plain text. This keeps every workflow looking the same in the Workflow Assistant and in any other Markdown viewer.
  • A file that starts with a front matter block (--- lines) may set the title with a title: line. The rest of the block is ignored.

Files That Belong to a Workflow

Keep images, scripts and other files that belong to a workflow in a folder next to it, with the same name. To share the workflow, copy the .md file together with this folder.

my-workflow.md
my-workflow/
    load-data.png
    draw-rois.png
    analysis.vqs
[Next step](#next)
[Back to the start](#first)
[Draw ROIs](#draw-rois)
[Perceptive website](https://www.perceptive.com/)
[Study protocol](my-workflow/protocol.pdf)
[Another workflow](other-workflow.md)
Link What happens when it is clicked
#next, #prev, #first, #last Goes to the next, previous, first or last step.
#draw-rois Goes to the step with that heading. Write the heading in lower case, replace spaces with - and leave out punctuation. This is the same rule GitHub uses, so these links also work in other Markdown viewers.
A web address Opens the page in your web browser.
A .md file Opens that workflow. Add # and a step to open it at that step, for example other-workflow.md#draw-rois.
A .vqs, .qs or .js file Runs the script. See Script Files.
A document or a folder Opens it in the program set up for it, for example a PDF protocol, a text file, a Word, Excel or PowerPoint file, an image or a video.
Any other file Asks first, because files such as programs, batch files and shortcuts can run something on your computer. Click Open only if you trust the workflow.

Paths are relative to the workflow file, unless they are absolute. Use forward slashes (/) in paths. If a path contains spaces, put it in angle brackets, for example [Study protocol](<my-workflow/study protocol.pdf>). Without them, the text is not a link.

Each step is shown on its own, so a reference-style link ([Study protocol][protocol] with [protocol]: my-workflow/protocol.pdf elsewhere in the file) only works if the reference is defined in the same step. Writing the link in full, as in the examples above, always works.

Images

![Screenshot of the Data Browser](my-workflow/load-data.png)
  • Use paths relative to the workflow file.
  • Images wider than the Workflow Assistant are scaled down to fit, so screenshots don’t need to be resized.
  • To point at a toolbar button or menu, use a screenshot of it.
  • Choose images that work on both light and dark backgrounds, such as screenshots or images with a solid background.

Callouts

Callouts draw attention to a note, a tip or a warning. They are written the same way as on GitHub and in Obsidian:

> [!WARNING]
> Check the injected dose before you continue.

The available callouts are [!NOTE], [!TIP], [!IMPORTANT], [!WARNING] and [!CAUTION]. Each is shown in its own color.

Running VivoScript from a Workflow

A workflow can let the user run VivoScript, either a short snippet written in the step itself or a script file. Scripts only run when the user clicks the link, never when a step is opened.

Running snippets and scripts requires a VivoScript license. See VQScript for an introduction to VivoScript.

Snippets

A code block marked vqs is a VivoScript snippet. It is shown with a ▶ Run link under it:

```vqs
VQ.openDataBrowser();
```

A snippet runs exactly as if it were typed into the VivoScript Console, so anything VivoScript can do works here, including #include. Included files are looked up in the workflow’s folder first.

Script Output

The Output area under the page appears with the first run. Each run adds a line with the time, the step and what ran (for example ▶ 14:02:31 2 - Load the data, snippet 1), then what the snippet or script prints with console.log() (or console.info(), console.warn(), console.error(), print()). Warnings and errors are shown in color. When the run ends, the area also shows:

  • the value of the last line, if there is one. For example, a snippet ending in greeting.length shows = 20. A list shows as its items separated by commas and an object as [object Object]; to see what an object contains, end with JSON.stringify(value).
  • the error, if the run failed, with the file and line where it happened, or
  • Done. if the run ended without either.
```vqs
var greeting = "Hello from a snippet";
console.log(greeting);
greeting.length
```
  • Output appears while the script runs, including while it waits, for example for a dialog.
  • The area keeps the last 2000 lines; drag its top edge to make it larger. What the snippet or script prints is also written to the log and shown in the VivoScript Console.
  • The output stays until another workflow is opened. Click Clear to remove it sooner and hide the area. It is never saved in the workflow file.
  • While a snippet or script runs, other ▶ Run links don’t start a second one.

Snippets are best for one-liners that do the next step for the user, such as opening a tool. Use script files for whole analyses.

Script Files

A link to a .vqs, .qs or .js file runs the script, just like Open VivoScript in the Script menu, and shows its output in the Output area. Script links are marked with ▶.

Usually the script is kept in a place your lab shares, so the link uses an absolute path:

[Run the QC analysis](S:/Lab/Scripts/qc.vqs)
[Run the QC analysis](//fileserver/lab/scripts/qc.vqs)
[Run the QC analysis](<S:/Lab Scripts/qc.vqs>)
  • Use forward slashes (/). Backslashes work in drive paths such as S:\Lab\qc.vqs, but not in network paths, because Markdown reads a double backslash as a single one.
  • If the path contains spaces, put it in angle brackets, as in the last example.
  • An absolute path only works on computers where that drive or network share is available.

A script can also be kept with the workflow, in its folder. Then use a path relative to the workflow file:

[Run the analysis](my-workflow/analysis.vqs)

Text after a ? is passed to the script in the scriptArgs array, split at each &:

[Analyze the left and right kidney](<my-workflow/analysis.vqs?Left Kidney&Right Kidney>)

In this example, scriptArgs[0] is "Left Kidney" and scriptArgs[1] is "Right Kidney". Because the text contains spaces, the link is in angle brackets.

Only one script can run at a time. If a script is already running, VivoQuant says so and the new script is not started.

VivoScript Functions for Workflows

The following functions are useful in workflow snippets:

Snippet What it does
VQ.openDataBrowser(); Opens the Data Browser.
VQ.showView("Slice View", "3D ROI Tool"); Switches to a view and, optionally, an operator. If that isn’t possible, for example because no data is loaded yet, it tells the user why.
VQ.openManual(); Opens this manual. Give a page to open that page, for example VQ.openManual("vqmanual_tools_workflowassistant.html");
VQ.openScriptManual(); Opens the VQ Script manual, which describes every VivoScript class and function.

Writing Workflows with Other Tools

Because workflows are plain Markdown, you can write them with whatever you like:

  • Markdown editors such as Visual Studio Code, Typora or Obsidian show a live preview. Images and links to steps work there too, and vqs snippets show up as ordinary code.
  • AI assistants write Markdown well. Give one the tutorial as an example of the format (use Edit Workflow to open it), describe your procedure, then save the result as a new .md file in your workflows folder.
  • Workflows can be kept in a version control system such as Git, like any other text file.