Socket
Book a DemoInstallSign in
Socket

@umessen/dicom-deidentifier

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@umessen/dicom-deidentifier

DICOM de-identification library for TypeScript

latest
Source
npmnpm
Version
1.0.0-beta.4
Version published
Maintainers
2
Created
Source

Dicom Deidentifier

🧰 DICOM de-identification library for TypeScript.

A configurable TypeScript port of DicomDeidentify to deidentify DICOM files according to http://dicom.nema.org/medical/dicom/current/output/html/part15.html#table_E.1-1

Getting Started

Installing

npm i @umessen/dicom-deidentifier

Usage

Usage is similar to DicomDeidentify.

const deidentifier = new Deidentifier({
  profileOptions: [RetainDeviceIdentOption, RetainLongModifDatesOption],
  dummies: {
    default: 'removed',
    lookup: {
      [Tag.forName("PatientName")]: 'JOHN^DOE',
    },
  },
  keep: [Tag.forName("PatientAddress")],
})

const result = deidentifier.deidentify(new Uint8Array(dicomFile));
writeFileSync('deidentified.dcm', result);

Special Handlers

You can add special handlers for custom processing:

new Deidentifier({
  /* ... */
  specialHandlers: [
    // Special handler that removes all date elements
    (element, options) => {
      if (element.getVR() === 'DA' || element.getVR() === 'DT') {
        element.delete();
        // Return true to skip the default deidentification logic and any futher special handlers for this element.
        return true;
      } else {
        // Return false if you want to run further special handlers, including the default deidentification logic.
        return false;
      }
    },
    // Logging special handler
    // Note: This will not run for date elements as the previous special handler will return early.
    (element, options) => {
      console.log(element);
      return false;
    }
  ],
});

License

This project is Open Source Software provided under the terms of the MIT License. More information is available in embedded licensing files.

Keywords

DICOM

FAQs

Package last updated on 13 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts