Weasis Web Protocol
The Weasis Protocol enables the launch of Weasis (starting from
v3.6.0
) in a web context using a specific URI scheme: weasis://commands
.
How to Use the Weasis Protocol
To launch Weasis from various contexts:
- From a Web Page: Create a link that begins with
weasis://
(see below How to build an URI).
If certain web frameworks (e.g. WIKI) or contexts only support HTTP protocols, you can use a URL redirection starting withhttps://
. A tool such as Weasis PACS Connector can assist with this. - From the Command Line: Utilize the appropriate Weasis command from the terminal:
start weasis://%24dicom%3Aget+-w+%22https%3A%2F%2Fnroduit.github.io%2Fdemo-archive%2FLumbar%2Fmf.xml%22
xdg-open weasis://%24dicom%3Aget+-w+%22https%3A%2F%2Fnroduit.github.io%2Fdemo-archive%2FLumbar%2Fmf.xml%22
open weasis://%24dicom%3Aget+-w+%22https%3A%2F%2Fnroduit.github.io%2Fdemo-archive%2FLumbar%2Fmf.xml%22
How to Build a URI
The weasis://
URI scheme allows you to launch Weasis directly from the system’s URI handler. By constructing the correct URI path, you can execute Weasis commands to load images or perform other actions.
Weasis PACS Connector can dynamically generate manifests (listing references for images to load) and build the required URI through an API. This tool also manages user preferences and other launch parameters.
If you’re not using the Weasis PACS Connector, you can build a URI manually by following these steps:
- Choose Commands: Select one or more commands to execute.
- Encode the Commands: Use a URL encoder to format the commands correctly for URI inclusion.
- Prefix the Commands: Add the
weasis://
scheme at the beginning of the encoded command string to create the final URI.
Example: Loading a Remote Image
- Use $dicom:get to load an image from URL
$dicom:get -r "https://nroduit.github.io/demo-archive/us-palette.dcm"
- Format the URI path with a URL encoder
%24dicom%3Aget+-r+%22https%3A%2F%2Fnroduit.github.io%2Fdemo-archive%2Fus-palette.dcm%22
- Make the final URI by adding “weasis://” at the beginning Open the remote image
Tip
For loading multiple images, it’s recommended to use a manifest file that references all desired images instead of including each image individually in the URI. The easiest way to build this manifest dynamically is by using the Weasis PACS Connector. Alternatively, you can create the manifest manually following the provided instructions.
Examples to Load Images
If you use weasis-pacs-connector, please refer to Launch Weasis.
- Use $dicom:get to load a static XML manifest containing direct links (without WADO server)
Launch
$dicom:get -w "https://nroduit.github.io/demo-archive/Lumbar/mf.xml"
- Use $dicom:rs to load DICOM files with DICOMWeb RESTful services (see other examples)
Launch
$dicom:rs --url "https://demo.orthanc-server.com/dicom-web" -r "patientID=5Yp0E"
- Use $dicom:get to load an image from URL and remove all the previous images if Weasis is already open
Launch
$dicom:close --all $dicom:get -r "https://nroduit.github.io/demo-archive/us-palette.dcm"
- Use $dicom:get to load multiple local folders and a remote image
Launch
$dicom:get -l "D:/DICOM/Overlay" -l "D:/DICOM/Shutter" -r "https://nroduit.github.io/demo-archive/us-palette.dcm"
- Use $image:get to load a non DICOM image
Launch
$image:get -u "https://user-images.githubusercontent.com/993975/59107662-6c9ed300-8939-11e9-83ee-28f2725f4ae1.jpg"
Modify the Launch Parameters
The command for modifying the configuration at launch is $weasis:config
which can have different arguments:
- cdb is the Weasis web context (The URL of weasis.war). If the value is null, the weasis version installed from the native installer is used. In the weasis-pacs-connector configuration, the default value is defined by
weasis.base.url
. - cdb-ext is the extension web context of Weasis (The URL of weasis-ext.war containing additionnal plugins). In the weasis-pacs-connector configuration, the default value is defined by
weasis.ext.url
. - arg is an argument for the launcher. The value must start by $, like arg="$dicom:close –all" (Note: the value can also be directly in the base URI, outside $weasis:config). Single-valued argument but can be specified multiple times.
- pro is a property for the launcher containing a key and a value separate by a space. Single-valued property but can be specified multiple times.
- auth is the web authorization parameter
- wcfg is the URL the remote Weasis configuration service.
Here are some examples that modify the launcher properties without using weasis-pacs-connector:
- Configuration for launching Weasis Dicomizer
Launch
$weasis:config pro="felix.extended.config.properties file:conf/dicomizer.json" pro="gosh.port 17181"
- Change the user, by default is the one of the current system session. The local preferences are associated to a user.
Launch
$weasis:config pro="weasis.user user2"