dicom-rle
TypeScript icon, indicating that this package has built-in type declarations

0.0.10 • Public • Published

NPM version build MIT License

dicom-rle

Javascript DICOM Run Length Encoding Encoder/Decoder for Node.js and Browser.

Install

Node.js

npm install dicom-rle

Browser

<script type="text/javascript" src="https://unpkg.com/dicom-rle"></script>

Build

npm install
npm run build

Usage

// Import objects in Node.js
const dicomRle = require('dicom-rle');
const RleEncoder = dicomRle.RleEncoder;
const RleDecoder = dicomRle.RleDecoder;

// Import objects in Browser
const RleEncoder = window.dicomRle.RleEncoder;
const RleDecoder = window.dicomRle.RleDecoder;

// Create image encoding/decoding attributes.
const attrs = {
  // Number of columns in the image.
  width: 128,
  // Number of rows in the image.
  height: 128,
  // Number of bits allocated for each pixel sample.
  bitsAllocated: 8,
  // Number of samples in this image.
  samplesPerPixel: 1,
  // For color images only.
  // Indicates whether the pixel data are sent color-by-plane or color-by-pixel.
  planarConfiguration: 0
};

// Encode uncompressed imageData to encodedData RLE byte stream.
const rleEncoder = new RleEncoder();
const encodedData = rleEncoder.encode(imageData, attrs);

// Decode encodedData RLE byte stream to uncompressed decodedData.
const rleDecoder = new RleDecoder();
const decodedData = rleDecoder.decode(encodedData, attrs);

License

dicom-rle is released under the MIT License.

Package Sidebar

Install

npm i dicom-rle

Weekly Downloads

4

Version

0.0.10

License

MIT

Unpacked Size

12.3 kB

Total Files

5

Last publish

Collaborators

  • pantelisgeorgiadis