npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@babelfhir-ts/dicomweb

v0.1.2

Published

DICOMweb client for SMART-authenticated imaging — URL builders (QIDO-RS / WADO-RS), FHIR ImagingStudy mapping, Cornerstone3D helpers. Zero FHIR-version dependencies.

Downloads

1,603

Readme

@babelfhir-ts/dicomweb

npm License: MIT

DICOMweb client for SMART-authenticated imaging — URL builders (WADO-RS / QIDO-RS), FHIR ImagingStudy mapping, and Cornerstone3D helpers. Zero runtime dependencies, FHIR-version agnostic.

Installation

npm install @babelfhir-ts/dicomweb

No runtime dependencies. Works with FHIR R4, R4B, and R5 ImagingStudy resources via structural typing.

Usage

DICOMweb Client

import { createDicomwebClient } from '@babelfhir-ts/dicomweb';

const dw = createDicomwebClient({
  baseUrl: 'https://pacs.example.com/dicomweb',
  getAccessToken: () => smartAuth.getToken()?.access_token ?? null,
});

// WADO-RS URLs
const thumb = dw.studyThumbnailUrl('1.2.840.113619.2.55.3...');
const meta  = dw.studyMetadataUrl('1.2.840.113619.2.55.3...');
const rendered = dw.instanceRenderedUrl(studyUID, seriesUID, sopUID);

// QIDO-RS URLs
const seriesUrl    = dw.seriesSearchUrl(studyUID);
const instancesUrl = dw.instancesSearchUrl(studyUID, seriesUID);

// Authenticated headers for fetch
const response = await fetch(meta, { headers: dw.authHeaders() });

FHIR ImagingStudy Mapping

import { getStudyInstanceUID, getPrimaryModality, getStudyTitle, getModalityInfo } from '@babelfhir-ts/dicomweb';

// Extract DICOM Study Instance UID from any FHIR ImagingStudy
const uid = getStudyInstanceUID(imagingStudy); // "1.2.840.113619..."

// Get primary modality code
const modality = getPrimaryModality(imagingStudy); // "CT"

// Human-readable study title (procedureCode → description → fallback)
const title = getStudyTitle(imagingStudy); // "Chest CT with Contrast"

// Modality display info
const info = getModalityInfo('CT'); // { label: "CT Scan", emoji: "🔬" }

Cornerstone3D Helpers

Separate entrypoint for tree-shaking — only imported if you use Cornerstone3D:

import { buildImageId, fetchSeriesImageIds } from '@babelfhir-ts/dicomweb/cornerstone';

// Build a wadors: image ID for Cornerstone3D
const imageId = buildImageId(wadoRsRoot, studyUID, seriesUID, sopUID);
// "wadors:https://pacs.example.com/dicomweb/studies/.../instances/..."

// Fetch all image IDs for a series via QIDO-RS
const imageIds = await fetchSeriesImageIds(wadoRsRoot, studyUID, seriesUID, headers);

With BabelFHIR-TS Generated Code

When you generate an IG with --dicomweb, the generated output includes a dicomweb/ directory with typed wrappers narrowed to the IG's ImagingStudy profiles:

// Generated code narrows ImagingStudyLike → your IG's actual profiles
import { getStudyInstanceUID, createDicomwebClient } from './dicomweb';
import type { ImagingStudyProfile } from './dicomweb';

// Type-safe — only accepts ImagingStudy profiles from your IG
const uid = getStudyInstanceUID(myProfiledImagingStudy);

API

Main Entrypoint (@babelfhir-ts/dicomweb)

| Export | Description | |---|---| | createDicomwebClient(config) | Factory returning a DicomwebClient with bound URL builders and auth | | getStudyInstanceUID(study) | Extract DICOM Study Instance UID from urn:dicom:uid or urn:oid: identifiers | | getPrimaryModality(study) | Get primary modality code (study-level, falls back to first series) | | getStudyTitle(study) | Human-readable title from procedureCode, description, or fallback | | getModalityInfo(code) | Map DICOM modality code to { label, emoji } (15 modalities) | | ImagingStudyLike | Structural interface accepting R4/R4B/R5 ImagingStudy resources | | DicomwebClient | Client interface with URL builders and authHeaders() | | DicomwebClientConfig | Configuration: baseUrl + optional getAccessToken callback | | ModalityInfo | { label: string; emoji: string } |

Cornerstone Entrypoint (@babelfhir-ts/dicomweb/cornerstone)

| Export | Description | |---|---| | buildImageId(wadoRsRoot, studyUID, seriesUID, sopUID, frame?) | Build wadors: URI for Cornerstone3D | | fetchSeriesImageIds(wadoRsRoot, studyUID, seriesUID, headers?) | QIDO-RS query returning an array of Cornerstone3D image IDs |

Part of BabelFHIR-TS

This package provides DICOMweb helpers for BabelFHIR-TS-generated code. Use the --dicomweb CLI flag to generate typed wrappers narrowed to your IG's ImagingStudy profiles. Can also be used standalone for any FHIR + DICOMweb integration.

License

MIT