Weasis Architecture
Weasis is built on a modular architecture powered by OSGi: the dynamic module system for Java. This design allows for a highly flexible, dynamic, and extendable structure. At its core, Weasis utilizes the Apache Felix OSGi framework, a lightweight open-source implementation of the OSGi specification.
Key Architectural Features
The following diagrams illustrate the main plugin types (known as bundles in OSGi terminology) and their relationships. These include Viewer, Viewer Tool Pane, Tool Bar, Data Explorer, and Codec bundles, which are dynamically registered using Declarative Services—a mechanism to seamlessly provide or consume services in the OSGi environment.
Understanding The Categories of Plugins
Weasis employs a modular approach, where individual plugins (or bundles in OSGi terminology) handle specific functionalities. Here are the plugin categories represented by layers in the diagram:
- Media Viewer and Editor
This category handles the main viewing and editing functionalities. Except the 2D viewer, it includes specialized viewers for different modalities and representations. - UI Aggregator
UI Aggregator plugins bring together various interface components to create a cohesive and user-friendly experience. They dynamically adapt the interface to include provided tools or modules, ensuring that Weasis remains customizable and modular. - Data Access and Management (Data Explorer)
This category focuses on managing how data is loaded, retrieved, and handled within the system. - Codec (Media Decoding)
Codec plugins are responsible for decoding and interpreting medical media files in the DICOM format and other supported formats. They sometimes include native libraries. - Utility and Core Services
This plugin provides essential utility functions and core services needed to support the other modules.
Each of these categories contributes to the flexibility and extensibility of Weasis, enabling it to be customized and adapted to different clinical and research workflows.
Fragment Bundles
A fragment bundle is a special type of bundle that is attached to a host bundle to provide additional resources or classes. In Weasis, fragment bundles are used to provide translations and native libraries for codecs. This design allows for a clean separation of concerns and ensures that only the required resources are loaded at runtime.
Bundle Translation Management
Each bundle has its translation files packaged in a separate bundle fragment (ending in i18n
), an OSGi concept that merges these files dynamically during runtime. This design allows translations to be maintained independently, and they are automatically loaded by the application whenever they are available.
Codec Support with Native Libraries
Certain Codec bundles contain fragments with native libraries (using JNI wrappers). The Weasis launcher dynamically loads only the required native binaries relevant to the platform on which it is running, ensuring lightweight and efficient operation.