The library is intended to provide a lightweight and standard-compliant viewer for microscopy images in DICOM format.
The viewer relies on Openlayers for rendering pyramid images and dynamically retrieves pyramid tiles (image frames) via DICOMweb WADO-RS using dicomweb-client. However, the viewer API fully abstracts the underlying rendering library and doesn't expose the lower level Openlayers API directly, such that another rendering library could in principle be used in the future if this would be of advantage.
A central design choice was to not expose any Openlayers objects or functions via the public API, but always provide an abstraction layer.
Any functions or methods that receive arguments with Openlayers types as input or return values with Openlayers types as output shall be kept private and shall not be exposed at the package level, i.e., not exported in the main dicom-microscopy-viewer.js file.
Private functions shall be named with a leading underscore (e.g., _myPrivateFunction) and include the @private JSDoc tag in their docstrings.
The library is implemented in JavaScript using the 6th Edition of the ECMAScript Language Specification (ES6) or later.
Source code is linted and formatted using Biome. Semicolons are not used at the end of statements (Biome uses asNeeded).
Use the following commands to check and fix style:
$ pnpm run lint # check for issues
$ pnpm run lint:fix # auto-fix issues
$ pnpm run fmt # format code
Explanatory comments (not only API docstrings) use JSDoc-style block comments (/** … */), not // line comments. Keep // only for tooling directives (eslint-disable, biome-ignore), temporarily commented-out code, and shebang lines.
Docstrings are written in JSDoc format:
/**
* Check values.
*
* @param options - Options
* @param {string} options.foo - One option
* @param {number} options.bar - Another option
* @returns {boolean} The return value
*/
const checkValues = (options) => {}Each function or method docstring shall include the @param tag and @returns tag and they shall specify the type of parameters and return values, respectively.
To test DMV changes inside Slim without publishing to npm:
- In this repository:
pnpm link --globalandpnpm run webpack:dynamic-import:watch - In Slim:
pnpm link dicom-microscopy-viewerandpnpm run start
See Slim's README section Linking Slim to a Local dicom-microscopy-viewer Library for details and troubleshooting. Do not add link: entries to package.json — the pnpm link commands are sufficient.