0.0.10 • Published 4 months ago

dicom-rle v0.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

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.

0.0.10

4 months ago

0.0.9

8 months ago

0.0.8

12 months ago

0.0.7

1 year ago

0.0.3

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.6

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago