0.0.7 • Published 2 years ago

@three-medical/dicom-loader v0.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

dicom-loader

three.js DICOM loader

NOTE: This package is a work in progress and should not be used in production.

Usage

Install

npm install @three-medical/dicom-loader

loadImageSeries

Load a DICOM image series.

// A list of URLs pointing to .dcm files
const urls = [...];

const loader = new DicomLoader();
const volume = await loader.loadImageSeries(urls);

loadImage

Load a single DICOM image.

// A URL pointing to a .dcm file
const url = [...];

const loader = new DicomLoader();
const volume = await loader.loadImage(url);

processBufferCallback (method parameter)

Optional parameter for the loadImageSeries and loadImage methods.

A callback used to process the buffer received from the URL. For example, this can be useful if the buffer received is compressed.

import pako from 'pako';

// A list of URLs pointing to .dcm.gz files (NOTE: files are compressed)
const urls = [...];

const processBufferCallback = (buffer: ArrayBuffer) => {
	// First we'll turn the buffer into a Uint8Array to make pako.inflate happy
	const uint8 = new Uint8Array(buffer);

	// Use pako to decompress the buffer
	const decompressed = pako.inflate(uint8);

	// Finally, return the buffer from the decompressed Uint8Array
	return decompressed.buffer;
};

const loader = new DicomLoader();
const volume = await loader.loadImageSeries(urls, processBufferCallback);

Acknowledgments

three.js

Other

Source

@three-medical/dicom-loader

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago