Web-based DICOM slide microscopy viewer library
See the codeVanilla JS library for web-based visualization of DICOM VL Whole Slide Microscopy Image datasets and derived information.
The viewer visualizes slide microscopy images stored in a DICOMweb-compatible archive. It uses the dicomweb-client JavaScript library to retrieve data from the archive.
Note: The
dicom-microscopy-viewerpackage is a library for building viewer applications, not a standalone viewer application. For a full application built on this library, see Slim.
VOLUME / THUMBNAIL, OVERVIEW, LABELPOINT, MULTIPOINT, POLYLINE, POLYGON, ELLIPSE, ELLIPSOIDAPI documentation is available online at imagingdatacommons.github.io/dicom-microscopy-viewer.
Install the dicom-microscopy-viewer package using your preferred package manager:
pnpm add dicom-microscopy-viewer
Below is an example of the most basic usage: a web page that displays a collection of DICOM VL Whole Slide Microscopy Image instances of a digital slide. For more advanced usage, see the Slim viewer.
The library is packaged as two builds: one using dynamic import, and another bundling into a single larger library.
The dynamic import version uses a public path of /dicom-microscopy-viewer/ so it can be used by adding an alias to the appropriate version and then deploying that version. In a plain web application, this can be loaded as:
const DICOMMicroscopyViewer = (
await import("/dicom-microscopy-viewer/dicomMicroscopyViewer.min.js")
).default
Using a subdirectory isolates the dependencies that are unique to dicom-microscopy-viewer.
The viewer can be embedded in any website. To do so:
DICOMwebClient for retrieving frames from the archive, as well as the metadata for each DICOM image as an instance of VLWholeSlideMicroscopyImage.render() method, passing it the HTML element (or the name of the element) that should contain the viewport.import * as DICOMMicroscopyViewer from "dicom-microscopy-viewer"
import * as DICOMwebClient from "dicomweb-client"
// Construct client instance
const client = new DICOMwebClient.api.DICOMwebClient({
url: "http://localhost:8080/dicomweb",
})
// Retrieve metadata of a series of DICOM VL Whole Slide Microscopy Image instances
const retrieveOptions = {
studyInstanceUID: "1.2.3.4",
seriesInstanceUID: "1.2.3.5",
}
client.retrieveSeriesMetadata(retrieveOptions).then((metadata) => {
// Parse, format, and filter metadata
const volumeImages = []
metadata.forEach((m) => {
const image = new DICOMMicroscopyViewer.metadata.VLWholeSlideMicroscopyImage({
metadata: m,
})
const imageFlavor = image.ImageType[2]
if (imageFlavor === "VOLUME" || imageFlavor === "THUMBNAIL") {
volumeImages.push(image)
}
})
// Construct viewer instance
const viewer = new DICOMMicroscopyViewer.viewer.VolumeImageViewer({
client,
metadata: volumeImages,
})
// Render viewer instance in the "viewport" HTML element
viewer.render({ container: "viewport" })
})
We use Babel to compile (transpile), webpack to bundle, and Jest to test JavaScript code.
Get the source code by cloning the git repository:
git clone https://github.com/ImagingDataCommons/dicom-microscopy-viewer
cd dicom-microscopy-viewer
Install dependencies and build the package:
pnpm install
pnpm run build
Run tests:
pnpm run test
Build the API documentation:
pnpm run generateDocs
Useful scripts:
| Command | Description |
|---|---|
pnpm run build | Build the library |
pnpm run test | Run the test suite |
pnpm run generateDocs | Generate API documentation |
pnpm run lint | Check for lint issues |
pnpm run lint:fix | Auto-fix lint issues |
pnpm run fmt | Format source code |
pnpm run webpack:dynamic-import:watch | Watch and rebuild the dynamic-import package |
Contributions are welcome! Please read CONTRIBUTING.md for guidelines on coding style, documentation, and the development workflow.
Please cite the following article when using the viewer for scientific studies: Herrmann et al. J Path Inform. 2018:
@article{jpathinform-2018-9-37,
Author={
Herrmann, M. D. and Clunie, D. A. and Fedorov A. and Doyle, S. W. and Pieper, S. and
Klepeis, V. and Le, L. P. and Mutter, G. L. and Milstone, D. S. and Schultz, T. J. and
Kikinis, R. and Kotecha, G. K. and Hwang, D. H. and Andriole, K, P. and Iafrate, A. J. and
Brink, J. A. and Boland, G. W. and Dreyer, K. J. and Michalski, M. and
Golden, J. A. and Louis, D. N. and Lennerz, J. K.
},
Title={Implementing the {DICOM} standard for digital pathology},
Journal={Journal of Pathology Informatics},
Year={2018},
Number={1},
Volume={9},
Number={37}
}
The developers gratefully acknowledge their research support:
This software is maintained by the Imaging Data Commons (IDC) team, which has been funded in whole or in part with Federal funds from the NCI, NIH, under task order no. HHSN26110071 under contract no. HHSN261201500003I.
NCI Imaging Data Commons (IDC) (https://imaging.datacommons.cancer.gov/) is a cloud-based environment containing publicly available cancer imaging data co-located with analysis and exploration tools and resources. IDC is a node within the broader NCI Cancer Research Data Commons (CRDC) infrastructure that provides secure access to a large, comprehensive, and expanding collection of cancer research data.
Learn more about IDC from this publication:
Fedorov, A., Longabaugh, W. J. R., Pot, D., Clunie, D. A., Pieper, S. D., Gibbs, D. L., Bridge, C., Herrmann, M. D., Homeyer, A., Lewis, R., Aerts, H. J. W., Krishnaswamy, D., Thiriveedhi, V. K., Ciausu, C., Schacherer, D. P., Bontempi, D., Pihl, T., Wagner, U., Farahani, K., Kim, E. & Kikinis, R. National Cancer Institute Imaging Data Commons: Toward Transparency, Reproducibility, and Scalability in Imaging Artificial Intelligence. RadioGraphics (2023). https://doi.org/10.1148/rg.230180
This project is licensed under the MIT License.
Web-based DICOM slide microscopy viewer library
See the codeVanilla JS library for web-based visualization of DICOM VL Whole Slide Microscopy Image datasets and derived information.
The viewer visualizes slide microscopy images stored in a DICOMweb-compatible archive. It uses the dicomweb-client JavaScript library to retrieve data from the archive.
Note: The
dicom-microscopy-viewerpackage is a library for building viewer applications, not a standalone viewer application. For a full application built on this library, see Slim.
VOLUME / THUMBNAIL, OVERVIEW, LABELPOINT, MULTIPOINT, POLYLINE, POLYGON, ELLIPSE, ELLIPSOIDAPI documentation is available online at imagingdatacommons.github.io/dicom-microscopy-viewer.
Install the dicom-microscopy-viewer package using your preferred package manager:
pnpm add dicom-microscopy-viewer
Below is an example of the most basic usage: a web page that displays a collection of DICOM VL Whole Slide Microscopy Image instances of a digital slide. For more advanced usage, see the Slim viewer.
The library is packaged as two builds: one using dynamic import, and another bundling into a single larger library.
The dynamic import version uses a public path of /dicom-microscopy-viewer/ so it can be used by adding an alias to the appropriate version and then deploying that version. In a plain web application, this can be loaded as:
const DICOMMicroscopyViewer = (
await import("/dicom-microscopy-viewer/dicomMicroscopyViewer.min.js")
).default
Using a subdirectory isolates the dependencies that are unique to dicom-microscopy-viewer.
The viewer can be embedded in any website. To do so:
DICOMwebClient for retrieving frames from the archive, as well as the metadata for each DICOM image as an instance of VLWholeSlideMicroscopyImage.render() method, passing it the HTML element (or the name of the element) that should contain the viewport.import * as DICOMMicroscopyViewer from "dicom-microscopy-viewer"
import * as DICOMwebClient from "dicomweb-client"
// Construct client instance
const client = new DICOMwebClient.api.DICOMwebClient({
url: "http://localhost:8080/dicomweb",
})
// Retrieve metadata of a series of DICOM VL Whole Slide Microscopy Image instances
const retrieveOptions = {
studyInstanceUID: "1.2.3.4",
seriesInstanceUID: "1.2.3.5",
}
client.retrieveSeriesMetadata(retrieveOptions).then((metadata) => {
// Parse, format, and filter metadata
const volumeImages = []
metadata.forEach((m) => {
const image = new DICOMMicroscopyViewer.metadata.VLWholeSlideMicroscopyImage({
metadata: m,
})
const imageFlavor = image.ImageType[2]
if (imageFlavor === "VOLUME" || imageFlavor === "THUMBNAIL") {
volumeImages.push(image)
}
})
// Construct viewer instance
const viewer = new DICOMMicroscopyViewer.viewer.VolumeImageViewer({
client,
metadata: volumeImages,
})
// Render viewer instance in the "viewport" HTML element
viewer.render({ container: "viewport" })
})
We use Babel to compile (transpile), webpack to bundle, and Jest to test JavaScript code.
Get the source code by cloning the git repository:
git clone https://github.com/ImagingDataCommons/dicom-microscopy-viewer
cd dicom-microscopy-viewer
Install dependencies and build the package:
pnpm install
pnpm run build
Run tests:
pnpm run test
Build the API documentation:
pnpm run generateDocs
Useful scripts:
| Command | Description |
|---|---|
pnpm run build | Build the library |
pnpm run test | Run the test suite |
pnpm run generateDocs | Generate API documentation |
pnpm run lint | Check for lint issues |
pnpm run lint:fix | Auto-fix lint issues |
pnpm run fmt | Format source code |
pnpm run webpack:dynamic-import:watch | Watch and rebuild the dynamic-import package |
Contributions are welcome! Please read CONTRIBUTING.md for guidelines on coding style, documentation, and the development workflow.
Please cite the following article when using the viewer for scientific studies: Herrmann et al. J Path Inform. 2018:
@article{jpathinform-2018-9-37,
Author={
Herrmann, M. D. and Clunie, D. A. and Fedorov A. and Doyle, S. W. and Pieper, S. and
Klepeis, V. and Le, L. P. and Mutter, G. L. and Milstone, D. S. and Schultz, T. J. and
Kikinis, R. and Kotecha, G. K. and Hwang, D. H. and Andriole, K, P. and Iafrate, A. J. and
Brink, J. A. and Boland, G. W. and Dreyer, K. J. and Michalski, M. and
Golden, J. A. and Louis, D. N. and Lennerz, J. K.
},
Title={Implementing the {DICOM} standard for digital pathology},
Journal={Journal of Pathology Informatics},
Year={2018},
Number={1},
Volume={9},
Number={37}
}
The developers gratefully acknowledge their research support:
This software is maintained by the Imaging Data Commons (IDC) team, which has been funded in whole or in part with Federal funds from the NCI, NIH, under task order no. HHSN26110071 under contract no. HHSN261201500003I.
NCI Imaging Data Commons (IDC) (https://imaging.datacommons.cancer.gov/) is a cloud-based environment containing publicly available cancer imaging data co-located with analysis and exploration tools and resources. IDC is a node within the broader NCI Cancer Research Data Commons (CRDC) infrastructure that provides secure access to a large, comprehensive, and expanding collection of cancer research data.
Learn more about IDC from this publication:
Fedorov, A., Longabaugh, W. J. R., Pot, D., Clunie, D. A., Pieper, S. D., Gibbs, D. L., Bridge, C., Herrmann, M. D., Homeyer, A., Lewis, R., Aerts, H. J. W., Krishnaswamy, D., Thiriveedhi, V. K., Ciausu, C., Schacherer, D. P., Bontempi, D., Pihl, T., Wagner, U., Farahani, K., Kim, E. & Kikinis, R. National Cancer Institute Imaging Data Commons: Toward Transparency, Reproducibility, and Scalability in Imaging Artificial Intelligence. RadioGraphics (2023). https://doi.org/10.1148/rg.230180
This project is licensed under the MIT License.
247 followers · starred Nov 2025