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

@cic-it-nancy/dicom-brush

v1.0.0

Published

A TypeScript/JavaScript library for manipulating DICOM images, enabling redaction (masking) of image regions, metadata extraction, and transfer syntax transcoding.

Readme

Dicom Brush

A TypeScript/JavaScript library for manipulating DICOM images, enabling redaction (masking) of image regions, metadata extraction, and transfer syntax transcoding.


Features

  • ImageBrush: Apply redaction areas to DICOM images
  • ImageReader: Extract technical metadata and specific frames
  • ImageTranscoder: Transcode DICOM files between transfer syntaxes (pack/unpack)
  • Utils: Utility functions for DICOM tag manipulation

Installation

Install the package using your preferred package manager:

# Using npm
npm install @cic-it-nancy/dicom-brush

# Using pnpm
pnpm add @cic-it-nancy/dicom-brush

# Using Yarn
yarn add @cic-it-nancy/dicom-brush

Usage

Loading DICOM files

The library uses dcmjs to read and write DICOM files. You first need to obtain a dicomDict object using dcmjs:

import { data } from 'dcmjs';
import { ImageTranscoder, ImageBrush } from '@cic-it-nancy/dicom-brush';

// Load DICOM file using dcmjs
const dicomDict = data.DicomMessage.readFile(blob);

Transcoding

import { ImageTranscoder } from '@cic-it-nancy/dicom-brush';

// Initialise the transcoder (required once)
await ImageTranscoder.init();

// Transcode a DICOM file
const transcoder = new ImageTranscoder(dicomDict);

// Transcode to a different transfer syntax
const result = transcoder.transcode('1.2.840.10008.1.2.1'); // Explicit VR Little Endian

// Helper methods for common operations
const unpacked = transcoder.unpack();  // Unpack to Implicit VR Little Endian
const packed = transcoder.pack();      // Pack to JPEG 2000 Lossless

Redaction

import { ImageBrush } from '@cic-it-nancy/dicom-brush';

const brush = new ImageBrush(dicomDict);

// Add redaction area (x, y, width, height in pixels)
brush.addRedactionArea({
  x: 100,
  y: 100,
  width: 50,
  height: 50
});

// Apply the redaction
brush.apply();

// Get the modified DICOM dictionary
const redactedDicom = brush.getDicomDict();

Reading image information

import { ImageReader } from '@cic-it-nancy/dicom-brush';

const imageInfo = ImageReader.readImageInfo(dicomDict);

console.log(imageInfo.rows);           // Number of rows
console.log(imageInfo.columns);        // Number of columns
console.log(imageInfo.numberOfFrames); // Total frames
console.log(imageInfo.transferSyntaxUID);

Supported Transfer Syntaxes

Transfer syntax support depends on the dcmjs-codecs library, which provides WebAssembly-based codecs. Currently supported:

  • Uncompressed:

    • Implicit VR Little Endian (1.2.840.10008.1.2)
    • Explicit VR Little Endian (1.2.840.10008.1.2.1)
    • Deflated Explicit VR Little Endian (1.2.840.10008.1.2.1.99)
    • Explicit VR Big Endian (1.2.840.10008.1.2.2)
  • JPEG:

    • JPEG Baseline (1.2.840.10008.1.2.4.50)
    • JPEG Lossless (1.2.840.10008.1.2.4.70)
  • JPEG 2000:

    • JPEG 2000 Lossless (1.2.840.10008.1.2.4.90)
  • RLE Lossless (1.2.840.10008.1.2.5)

Note: The actual supported transfer syntaxes are determined by dcmjs-codecs. Check the dcmjs-codecs repository for the most up-to-date list.


Technical details

  • Build output: CJS (lib/cjs/) and ESM (lib/esm/)
  • TypeScript: Strict mode, type declarations available in types/index.d.ts
  • Dependencies: dcmjs (0.50.1) for DICOM I/O, dcmjs-codecs (0.0.8) for transcoding

Project structure

dicom-brush/
├── src/          # TypeScript source files
├── lib/
│   ├── cjs/      # CommonJS build
│   └── esm/      # ES Module build
├── types/        # TypeScript type definitions
├── README.md
└── Transfer Syntax.md

Authors & Contributors

  • CIC-IT Nancy — Author
  • Pierre 'AlasDiablo' M (GitHub) — Contributor

License

GNU Lesser General Public License v3.0 (LGPL-3.0) - CIC-IT Nancy