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 🙏

© 2025 – Pkg Stats / Ryan Hefner

dicomedit

v0.1.3

Published

`DicomEdit.js` is a JavaScript library that provides the ability to read DICOM objects, transform their contents based on a scripted list of commands, and to output the transformed DICOM.

Readme

DicomEdit.js

DicomEdit.js is a JavaScript library that provides the ability to read DICOM objects, transform their contents based on a scripted list of commands, and to output the transformed DICOM.

DicomEdit.js is a ported version the original Java-based library (https://wiki.xnat.org/xnat-tools/dicomedit) to work with a web-browser and Node.Js environments. This can add more safety to data privacy by allowing DICOM objects to be anonymized in users's local environment before being transferred to Server to make sure any PHI is not sent to unsecure/secure network.

DicomEdit.js uses a parser library (either Antlr4 or Peg.js (https://github.com/pegjs)) to create a parser for the DicomEdit script. Using the parser, the incoming script is converted to the abstract syntax tree, and finally the AST is transformed into the Rule groups object. and each defined rule is sequentially applied to the DICOM object.

Demo

This is a sample React.Js based webapp that demonstrates how the DicomEdit.js library works: https://testanonymizer.web.app.

Install

DicomEdit.js is available from npm or unpkg.

npm install dicomedit
yarn add dicomedit
<script src="https://unpkg.com/dicomedit/dist/web/dicomedit.js"></script>

API Documentation

To be added

Usage

Browser or Electron with HTML

<script src="https://unpkg.com/[email protected]/dist/web/dicomedit.min.js"></script>
<script>
const script = `version "6.3"
temp := "chany"
(0008,0008) := "test"
(0010,0010) := temp
`;

(async () => {
    // Assuming that a variable named 'buffer' is declared and ArrayBuffer type of the dcm image is assigned to the variable. (Please refer to https://github.com/WoonchanCho/dicomedit/blob/master/examples/web-example.html for the ArrayBuffer assignment. )
    const { Anonymizer } = DicomEdit;
    const anonymizer = new Anonymizer(script);
    anonymizer.loadDcm(buffer)
    await anonymizer.applyRules();

    console.log(anonymizer.outputDict)
    buffer = anonymizer.write()
    console.log(buffer)
})();

</script>

Node.js with the CommonJS module system

const fs = require('fs');
const { Anonymizer } = require('dicomedit/dist/node/dicomedit.min');

const script = `version "6.3"
temp := "chany"
(0008,0008) := "test"
(0010,0010) := temp
`;

(async () => {
  try {
    const anonymizer = new Anonymizer(script);

    const inputFile = process.argv[2] || './sample.dcm';
    anonymizer.loadDcmUsingFileName(inputFile);
    await anonymizer.applyRules();

    const buffer = anonymizer.write();
    const outputFile = process.argv[3] || './anon.dcm';
    fs.writeFileSync(outputFile, new Uint8Array(buffer));
  } catch (err) {
    console.log(err);
  }
})();

License

MIT