Subsections of Customize
Integration
How to launch Weasis from any environments
Here we present how to launch Weasis with associated images from any context either using weasis-pacs-connector or by building your own connector. The launch of the application is based on the weasis protocol available since Version3.5.3.
Using weasis-pacs-connector allows a high degree of integration and facilitates connection to a PACS. Here are some of the advantages:
- Automatically build a manifest according to a configuration with a PACS
- The initial URL starts with HTTP and is then redirected to weasis:// (as weasis:// is not allowed by wiki, blog…)
- Manages to build the manifest simultaneously with the start of Weasis (Loading time optimization)
- The URL returns a manifest ID which can be requested only once (and must be consumed within 5 min)
However, it is also possible
- To build your own connector for particular integrations
- To let Weasis querying DICOMWeb services directly.
Requires Weasis installed on the system with the native installer.
Use weasis-pacs-connector
For connecting to dcm4chee web interface, follow the instructions in Installing Weasis in DCM4CHEE. Otherwise, refer to the documentation of weasis-pacs-connector.
Standard workflow when connecting Weasis to a PACS, RIS, EMR, EPR or any web interface:
The schema above shows that the queries to the PACS are made at the same time as the viewer starts. This makes it possible to optimize the launch by simultaneously launching weasis and building the manifest.
weasis-pacs-connector services allow either to build a manifest from a PACS via DICOM C-Find or to upload the manifest by http POST.
Build your own connector
This documentation describes how to create your own connector without weasis-pacs-connector and with different DICOM archive types. The weasis protocol allows you to build URIs to launch Weasis according to different configurations and allows to load DICOM files locally or remotely.
Here are examples with XML manifests or with DICOMWeb RESTful services.
Build an XML manifest
Use $dicom:get to load a XML manifest returned by your service.
$dicom:get -w "https://myservice/manifest?studyUID=2.16.756.5.5.100.397184556.14391.1373576413.1508"
Build an XML file containing the UIDs of the images which will be retrieved from Weasis. There is XLS to validate the content of xml. This output file can be either compressed in gzip or uncompressed. Here is an example:
<?xml version="1.0" encoding="UTF-8" ?>
<manifest xmlns="http://www.weasis.org/xsd/2.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<arcQuery additionnalParameters="" arcId="1001" baseUrl="http://archive-weasis.rhcloud.com/archive/wado" requireOnlySOPInstanceUID="false">
<Patient PatientID="H13885_9M" PatientName="TEST NON SQUARE PIXELS" PatientSex="F">
<Study AccessionNumber="" ReferringPhysicianName="" StudyDate="20130711" StudyDescription="TEST NON SQUARE PIXELS" StudyID="PKD" StudyInstanceUID="2.16.756.5.5.100.397184556.14391.1373576413.1508" StudyTime="170013">
<Series Modality="US" SeriesDescription="NON SQUARE PIXELS: PIXEL ASPECT RATIO" SeriesInstanceUID="1.2.40.0.13.1.1.87878503032592846377547034671833520632" SeriesNumber="2">
<Instance InstanceNumber="107" SOPInstanceUID="1.2.40.0.13.1.1.126082073005720329436273995268222863740"/>
</Series>
<Series Modality="MR" SeriesDescription="NON SQUARE PIXELS: PIXEL SPACING" SeriesInstanceUID="2.16.756.5.5.100.397184556.7220.1373578035.1" SeriesNumber="40001">
<Instance InstanceNumber="1" SOPInstanceUID="2.16.756.5.5.100.397184556.7220.1373578035.1.0"/>
<Instance InstanceNumber="2" SOPInstanceUID="2.16.756.5.5.100.397184556.7220.1373578035.1.1"/>
<Instance InstanceNumber="3" SOPInstanceUID="2.16.756.5.5.100.397184556.7220.1373578035.1.2"/>
<Instance InstanceNumber="4" SOPInstanceUID="2.16.756.5.5.100.397184556.7220.1373578035.1.3"/>
</Series>
<Series Modality="MR" SeriesDescription="NON SQUARE PIXELS: PIXEL SPACING" SeriesInstanceUID="2.16.756.5.5.100.397184556.7220.1373578664.2" SeriesNumber="50001">
<Instance InstanceNumber="1" SOPInstanceUID="2.16.756.5.5.100.397184556.7220.1373578664.2.0"/>
<Instance InstanceNumber="2" SOPInstanceUID="2.16.756.5.5.100.397184556.7220.1373578664.2.1"/>
<Instance InstanceNumber="3" SOPInstanceUID="2.16.756.5.5.100.397184556.7220.1373578664.2.2"/>
<Instance InstanceNumber="4" SOPInstanceUID="2.16.756.5.5.100.397184556.7220.1373578664.2.3"/>
</Series>
</Study>
</Patient>
</arcQuery>
</manifest>
Important Parameters (except mandatory parameters defined in xsd):
PatientBirthDate
helps to identify a patient.StudyDate,
StudyTime
,Modality
,SeriesNumber
andInstanceNumber
help to sort data before downloading images.SeriesDescription
andStudyDescription
allow immediately displaying the descriptions before downloading the images.
From Weasis 2.5 it is possible to have multiple archives (allows several arcQuery tags) and the presentations tag which contains the image annotations.
Build an XML manifest (no WADO server)
This example requires only a WEB server. Weasis will download DICOM files by URLs.
Use $dicom:get to load a XML manifest containing direct links Launch
$dicom:get -w "https://nroduit.github.io/demo-archive/Lumbar/mf.xml"
Required Parameters:
DirectDownloadFile
defines the URL of the DICOM file to download (the final URL is the combination of wadoURL + DirectDownloadFile)DirectDownloadThumbnail
defines the URL of the JPEG file representing the series (the final URL is the combination of wadoURL + DirectDownloadThumbnail)- See in the previous note above.
Download directly with DICOMWeb RESTful services
This integration requires a PACS/VNA with DICOMweb services (QUERY/RETRIEVE) where the requests are managed directly by Weasis. Here are some of the advantages:
- Straightforward integration
- Do not require to install weasis-pacs-connector
- Allow passing token directly in headers (not in the URL)
The following configurations allow images to be loaded by initiating the request from a WEB context. However, it is possible to access DICOMWeb services by initiating the request directly from the Weasis import.
Use $dicom:rs to load DICOM files. Here are some configuration examples of DICOMweb applications:
dcm4chee-arc-light
This configuration requires at least dcm4chee-arc-light 5.22.2 and Weasis 3.6.0. To activate Weasis in dcm4chee-arc-light user interface, you need to add the four following properties in the web portal from the left menu Configuration > Devices > dcm4chee-arc > Extensions > Edit extension > Child Objects > Web Applications > DCM4CHEE
IID_PATIENT_URL=weasis://$dicom:rs --url "{{qidoBaseURL}}{{qidoBasePath}}" -r "patientID={{patientID}}" --query-ext "&includedefaults=false" -H "Authorization: Bearer {{access_token}}"
IID_STUDY_URL=weasis://$dicom:rs --url "{{qidoBaseURL}}{{qidoBasePath}}" -r "studyUID={{studyUID}}" --query-ext "&includedefaults=false" -H "Authorization: Bearer {{access_token}}"
IID_URL_TARGET=_self
The properties can also be passed directly to the docker-compose.env file:
IID_PATIENT_URL=weasis://$dicom:rs --url "{{qidoBaseURL}}{{qidoBasePath}}" -r "patientID={{patientID}}" --query-ext "\&includedefaults=false" -H "Authorization: Bearer {{access_token}}"
IID_STUDY_URL=weasis://$dicom:rs --url "{{qidoBaseURL}}{{qidoBasePath}}" -r "studyUID={{studyUID}}" --query-ext "\&includedefaults=false" -H "Authorization: Bearer {{access_token}}"
IID_URL_TARGET=_self
Finally, refresh the page for having the viewer button.
Configuration notes:
- See configuration for versions before 5.22.2.
- From 5.24.0 {{qidoBaseURL}} must be replaced by your base URL (e.g. https://pacs2.test.com:8443)
- The character ‘&’ must be escaped in the Docker environment variables.
- The Authorization header is not required for unsecure service.
- URL with HTTPS requires a real valid certificate; otherwise, the certificate must be imported into the Weasis Java keystore. For testing purposes in secure mode, you can use the HTTP URL if it is mapped in the OIDC client of keycloack (–url “http://
:8080/dcm4chee-arc/aets/DCM4CHEE/rs”).
Known issue: Weasis cannot open the images because of the token length which is cut by IE and Chrome only under Windows. It is working with Firefox on Windows.
Orthanc WEB Server
https://www.orthanc-server.com/static.php?page=dicomweb
$dicom:rs --url "https://demo.orthanc-server.com/dicom-web" -r "patientID=ozp00SjY2xG"
Currently, the DICOMWeb service of Orthanc doesn’t support:
- Thumbnail service is not implemented.
Google Cloud Healthcare API
https://cloud.google.com/healthcare/docs/how-tos/dicomweb
$weasis:config pro="dicom.qido.query.multi.params true" $dicom:rs --url "https://healthcare.googleapis.com/v1beta1/projects/chc-nih-chest-xray/locations/us-central1/datasets/nih-chest-xray/dicomStores/nih-chest-xray/dicomWeb" -r "studyUID=1.3.6.1.4.1.11129.5.5.184301693334578016850836775758484230512396" -H "Authorization: Bearer <your-token>"
Currently, the DICOMWeb service for getting thumbnails doesn’t work in the Google API.
<your-token>
must be replaced by a valid token.
DICOMcloud (for Azure cloud)
https://github.com/DICOMcloud/DICOMcloud
$dicom:rs --url "https://dicomcloud.azurewebsites.net/api" -r "studyUID=1.3.6.1.4.1.14519.5.2.1.4429.7055.198257099234774234268879426857"
The demo server is no longer accessible.
Currently, the DICOMWeb service of DICOMcloud doesn’t support:
- Thumbnail service is not implemented.
Preferences
The WEB distribution (weasis.war) allows delivering preferences from the server-side to the client-side. Some preferences on the server-side are used by Weasis only during the first launch because they can be changed later in the Weasis user interface. The other preferences at the server-side are used by Weasis at every launch.
Local preferences can be changed by:
- The Weasis user interface: File > Preferences
- The weasis protocol with the command weasis:config and the pro parameter
Preferences on the server-side can be changed by:
- Replacing ext-config.properties which extends and overrides config.properties, see the tip below.
- Using query parameters in weasis-pacs-connector
- The weasis protocol with the command weasis:config and the pro parameter
How to modify ext-config.properties:
- Unzip weasis.war, modify the file and zip it again.
- It is also possible to change the default location of ext-config.properties with the Java property “felix.extended.config.properties” with the parameter
cdb-ext
of the weasis service. The ext-config.properties file can also be placed in a plugin package, see How to build and install a plug-in.
Priority order for loading a property
Here is the priority order to set a property:
- Java System property providing from parameters of weasis:config or the launching URI)
- Property defined in weasis/conf/xxx.json
- The default value of the property (see table below)
Example to change language property (It will work only during the first launch of Weasis on a user session, otherwise delete ${user.home}/.weasis/preferences/).
- If you are using weasis-pacs-connector, add the property
locale.lang.code
:http://localhost:8080/weasis-pacs-connector/weasis?patientID=9702672&pro="locale.lang.code%20fr_CH"
- Add the property in weasis/conf/xxx.json:
locale.lang.code=fr_CH
- The default value is “en_US”
List of preferences
- GUI: if yes, the property can be modified in the Weasis user interface.
- Type: F: only caught at the first launch of the viewer. A: always caught by the viewer. AP: always caught by the viewer but only from ext-config.properties or config.properties .
Property | Default value | GUI | Type | Description |
---|---|---|---|---|
weasis.confirm.closing | false (since v2.0.0 ) | yes | F | Show a message of confirmation when closing the application. |
weasis.show.disclaimer | true | no | A | Show a disclaimer (requires to be accepted to start the application) during the first launch of Weasis. |
weasis.show.release | true (since v2.0.0 ) | no | A | Show a message when the release has changed |
weasis.export.dicom | true (since v1.2.5 ) | no | A | Allows exporting DICOM files. |
weasis.portable.dicom.cache | true | no | A | Cache the images imported from directories defined in weasis.portable.dicom.directory. If true, it is similar to the WEB import. |
org.apache.sling.commons.log.level | INFO | yes | F | Sets the logging level of the loggers. This may be any of the defined logging levels TRACE, DEBUG, INFO, WARN, ERROR. |
org.apache.sling.commons.log.file.activate | false | yes | F | Activate the log file. If this property is false, log messages are written to System.out. Since Weasis 2.0.4 |
org.apache.sling.commons.log.file.number | 5 | yes | F | The number of rotated files to keep. |
org.apache.sling.commons.log.file.size | 10MB | yes | F | Defines how the log file is rotated by size. |
org.apache.sling.commons.log.pattern | {0,date,dd.MM.yyyy HH:mm:ss.SSS} *{4}* [{2}] {3} {5} | no | F | Formatting log messages. java.util.MessageFormat pattern supporting up to six arguments: {0} The timestamp of type java.util.Date, {1} the log marker, {2} the name of the current thread, {3} the name of the logger, {4} the debug level and {5} the actual debug message. |
locale.lang.code | en | yes | F | Language code (see Java Locale). If the value is “system” then the locale of the operating system will be used (client-side). |
locale.format.code | system | yes | F | Format code for number and date (see Java Locale). If the value is “system” then the locale of the operating system will be used (client-side). |
weasis.name | Weasis | no | AP | Change the name of the application everywhere in UI |
weasis.profile | default | no | AP | Application profile, it allows having a custom preferences directory on the client side (will not shared preferences with other Weasis instances) |
weasis.resources.url | ${weasis.codebase.url}/resources.zip | no | A | Application resource files (logo, presets, LUTs…). “resources.zip” is downloaded again only when the last modified date has changed. |
weasis.download.immediately | true | yes | F | Start to download series immediately |
download.concurrent.series | 3 | no | A | The number of concurrent series downloads |
download.concurrent.series.images | 4 | no | A | The number of concurrent image downloads in a series |
audit.log | false | no | A | Audit log for giving statistics about usage of Weasis |
weasis.color.wl.apply | true | yes | F | Allow to apply Window/Level on color images |
weasis.dicom.root.uid | 2.25 | no | A | Set value for dicom root UID when creating DICOM objects (KO or PR). See company list. |
{ui keys} | true | no | A | Make visible or not the Toolbars, Tools, some buttons, main menu and context menu items (see ext-config.properties file) |
weasis.aet | WEASIS_AE | no | A | Calling AETitle for DICOM send and DICOM print |
org.apache.sling.commons.log.stack.limit | 3 | yes | F | Defines the maximum number of lines for stack trace (0 => NONE, -1 => ALL) |
weasis.export.dicom.send | true | no | A | Allows DICOM send. Is always false when weasis.export.dicom=false. |
weasis.import.dicom | true | no | A | Allows importing DICOMs |
weasis.import.dicom.qr | true | no | A | Allows DICOM Q/R. Is always false when weasis.import.dicom=false. |
weasis.acquire.meta.global.display | PatientID,PatientName, PatientBirthDate, PatientSex, AccessionNumber, StudyDescription | no | A | Global tags at the patient or study level that are visible in Dicomizer |
weasis.acquire.meta.global.edit | StudyDescription | no | A | Global tags which are editable |
weasis.acquire.meta.global.required | PatientID, PatientName, AccessionNumber, StudyDescription | no | A | Global tags which are required for publication |
weasis.acquire.meta.series.display | Modality, OperatorsName, ReferringPhysicianName, BodyPartExamined, SeriesDescription | no | A | Tags at the series level that are visible in Dicomizer |
weasis.acquire.meta.series.edit | ReferringPhysicianName, BodyPartExamined, SeriesDescription | no | A | Series tags which are editable |
weasis.acquire.meta.series.required | Modality, SeriesDescription | no | A | Series tags which are required for publication |
weasis.acquire.meta.image.display | ImageComments, ContentDate, ContentTime | no | A | Tags at the image level that are visible in Dicomizer |
weasis.acquire.meta.image.edit | ImageComments, ContentDate, ContentTime | no | A | Image tags which are editable |
weasis.acquire.meta.image.required | ContentDate | no | A | Image tags which are required for publication |
weasis.acquire.dest.host | localhost | no | A | Hostname of DICOM send destination for Dicomizer. If no value, the list of DICOM nodes for storage is displayed. |
weasis.acquire.dest.aet | DCM4CHEE | no | A | AETitle of DICOM send destination for Dicomizer |
weasis.acquire.dest.port | 11112 | no | A | Port of DICOM send destination for Dicomizer |
weasis.acquire.meta.study.description | Pictures of follow-up,Pictures of observation,Pictures preoperative,Pictures intraoperative,Pictures postoperative | no | A | Comma-separated list of study description elements. Comment this property to have a free text field. |
weasis.acquire.meta.series.description | no | A | Comma-separated list of series description elements. Comment this property to have a free text field. | |
weasis.level.inverse v2.6.0 | true | yes | F | Inverse level direction (moving the cursor down to increase brightness) |
weasis.apply.latest.pr v2.6.0 | false | yes | F | Apply by default the most recent Presentation State to the related image |
weasis.user v2.6.0 | system user | no | A | Defines a user with its own preferences |
weasis.pref.store.local.session v3.5.3 | false | no | A | Store user preferences when weasis.user is not specified (only with remote preferences service) |
weasis.theme v4.0.0 | org.weasis.launcher.FlatWeasisTheme | yes | F | FlatWeasisTheme is the default dark theme. All the themes comes from FlatLaf |
weasis.theme.${system} v4.0.0 | org.weasis.launcher.FlatWeasisTheme | yes | F | Apply a default theme specific to the platform (macosx, linux, windows). |
flatlaf.uiScale v4.0.0 | 1.0 (or the default scale factor of the Operating System) | yes | F | Specifies a custom scale factor used to scale the user interface. Allowed values: e.g. 1.5, 1.5x, 150% or 144dpi (96dpi is 100%) |
weasis.update.release v4.0.1 | true | no | A | Show a message when a new release is available |
Examples of properties in ext-config.properties
Changing the default theme of the user interface
# Define the theme for the first launch according to the platform (macosx, linux, windows)
weasis.theme=org.weasis.launcher.FlatWeasisTheme
weasis.theme.macosx=com.formdev.flatlaf.FlatIntelliJLaf
weasis.theme.linux=com.formdev.flatlaf.FlatDarculaLaf
Customize resources
The default resources are located:
- For the web distribution in “resources.zip” at the root of weasis.war (see above how to set a new URL for resources)
- For the installed distribution in installedPath/app/resources
How to add DICOM nodes or DICOM printers at the server-side
- From the graphical user interface, configure the DICOM printers from File > Print > DICOM Print or DICOM nodes from File > Preferences > Dicom node list
- Go to the folder ${user.home}/.weasis/data/weasis-dicom-explorer
- Copy the desired configuration files: dicomNodes.xml, dicomPrinterNodes.xml, dicomWebNodes.xml and dicomCallingNodes.xml
- Paste at the root path of resources. For web distribution, unzip, place files and zip again.
- The new configurations should appear for all the users as non-editable configurations in Weasis
Build Plug-ins
How to build and install a plug-in
This page describes how to build new Weasis plug-ins and how they can be incorporated into the distributions, see also this page for the IDE configuration.
List of plug-ins types
- Media viewer or editor (main central panel that implements
ViewerPlugin
orImageViewerPlugin
and the factory implementsSeriesViewerFactory
) - Toolbar associated with a viewer (implements
Toolbar
) - Tool associated with a viewer (right panel that implements
DockableTool
) - Data Explorer (data model implements
DataExplorerModel
and data view implementsDataExplorerView
, and the factory implementsDataExplorerViewFactory
) - Import data into an explorer (ex.
ImportDicom
and the factory implementsDicomImportFactory
) - Export data into an explorer (ex.
ExportDicom
and the factory implementsDicomExportFactory
) - DICOM editor or viewer for special modalities (
DicomSpecialElementFactory
andSeriesViewerFactory
), see weasis-dicom-sr - Media codec (implements
Codec
) - Preferences (implements
PreferencesPageFactory
) - UI aggregator. This is the application main user interface bundle. The maven artifact of this bundle must be defined in config.properties (ex. weasis.main.ui=weasis-base-ui)
See the Weasis Architecture to understand the plug-in hierarchy.
Build plug-ins from Maven archetype
- From the folder Weasis/archetype execute: mvn install
- Generate a sample project by executing the following command: mvn archetype:generate -DarchetypeCatalog=local
- Select the archetype:
- weasis-plugin-base-viewer-archetype (example of a toolbar and a tool for the non DICOM viewer)
- weasis-plugin-dicom-viewer-archetype (example of a toolbar and a tool for the DICOM viewer)
From Eclipse: File > New > Maven Project and Search for weasis archetype in catalog filter.
From Intellij: File > New Project > Maven, select the “Maven Archetype” generators and select a Weasis archetype from Default local catalog.
In the pom.xml of the new plug-in, the tag <relativePath> must be adapted to your relative path of Weasis sources.
The default value is <relativePath>../Weasis/weasis-parent/pom.xml</relativePath>
Install plug-ins
This documentation has not been updated since version 4.2.0 where the properties configuration files have been replaced by json files.
The way to add plugins will also evolve soon with the new weasis-manager component.
For the installed distribution
The file “app/conf/ext-config.properties” must be adapted and plug-ins must be placed in the directory “app/plugins”.
Example with weasis-isowriter:
-
Add in app/conf/ext-config.properties:
felix.auto.start.85=${weasis.codebase.url}/plugins/weasis-isowriter-2.6.1.jar
TipIf you want to use another directory for a plugin on your computer, you should use one of the following properties:
On Windows:felix.auto.start.85=file:///C:/path/to/weasis-isowriter-2.6.1.jar
On linux:felix.auto.start.85=file:///home/Username/path/to/weasis-isowriter-2.6.1.jar
On macOS:felix.auto.start.85=file:///Users/Username/path/to/weasis-isowriter-2.6.1.jar
TipFor not modifying the current ext-config.properties create a new file and add to the launcher the following VM argument:
-Dfelix.extended.config.properties="file:///your_plugin_path/myplugin-config.properties"
-
Place the file “weasis-isowriter-2.6.1.jar” in the directory “/weasis/plugins”
For the WEB distribution
Build a new war file containing the plug-ins and the ext-config.properties file.
-
Build “weasis-ext.war” with the following structure:
weasis-ext/ ├── conf/ │ ├── ext-config.properties ├── WEB-INF/ │ ├── web.xml ├── plugin1.jar └── plugin2.jar
-
In /weasis-ext/conf/ext-config.properties, add the plug-ins references:
felix.auto.start.85= \ ${weasis.codebase.ext.url}/plugin1.jar \ ${weasis.codebase.ext.url}/plugin2.jar
NoteUsing
${weasis.codebase.ext.url}
allows you to keep the base URL abstract, so moving the package to another server won’t be a problem. Otherwise absolute URLs must be used. The default value of${weasis.codebase.ext.url}
is ${weasis.codebase.url}-ext. -
weasis-ext is the default web context when launching Weasis, using another web context requires modifying the property weasis.ext.url, it can be done by:
weasis.ext.url=${server.base.url}/weasis-newext
-
Changing the property in weasis-pacs-connector configuration.
NoteIt is also possible to add the code base for plugins (cdb-ext) directly in the URL:
http://localhost:8080/weasis-pacs-connector/viewer?patientID=9702672&cdb-ext=http://localhost:8080/plugins/weasis-ext
For debugging a specific configuration: add to the launcher the following VM argument:
-Dfelix.extended.config.properties="http://server:port/weasis-ext/conf/ext-config.properties
An example that makes a package of weasis-isowriter plugin:
- Build “weasis-ext.war”:
weasis-ext/ ├── conf/ │ ├── ext-config.properties ├── WEB-INF/ │ ├── web.xml └── weasis-isowriter-2.0.3.jar
Build OSGi services
All the plug-in type described in the list above are OSGi services that are registered and aggregated in the GUI. Building the plug-in from the Maven archetype will configure the OSGi service automatically. For adding new OSGi services, here is the procedure:
-
Create a class implementing one of the plug-in types and add at least the annotations @Component and @Service, for instance:
@Component(immediate = false) @Service public class SamplePrefFactory implements PreferencesPageFactory { ... }
TipFor more information about annotations see the Apache Felix SCR Annotations.
-
Add in pom.xml of the plug-in the maven-scr-plugin (to generate XML file from the Java annotations) and the property for loading any XML file in maven-bundle-plugin:
<build> <plugins> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-scr-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> </plugin> ...