RunKit + npm: dwv parse #1
// canvas for Konva
const c = require('canvas');
var dwv = require('dwv');
var request = require('xhr-request');
var url = 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm';
var onload = function (buffer) {
// setup the dicom parser
var dicomParser = new dwv.dicom.DicomParser();
// parse the buffer
dicomParser.parse(buffer);
// get the raw dicom tags
var rawTags = dicomParser.getRawDicomElements();
// display the modality
console.log('Modality: ' + rawTags.x00080060.value[0]);
// get the wrapped dicom tags
var tags = dicomParser.getDicomElements();
// display the modality
console.log('Modality (bis): ' + tags.getFromName('Modality'));
};
// request
request(url, {responseType: 'arraybuffer'}, function (err, data, resp) {
onload(data);
});
no comments