DicomParser

DicomParser class.

Constructor

new DicomParser()

Example
// XMLHttpRequest onload callback
const onload = function (event) {
  // setup the dicom parser
  const dicomParser = new dwv.DicomParser();
  // parse the buffer
  dicomParser.parse(event.target.response);
  // get the dicom tags
  const tags = dicomParser.getDicomElements();
  // display the modality
  const div = document.getElementById('dwv');
  div.appendChild(document.createTextNode(
    'Modality: ' + tags['00080060'].value[0]
  ));
};
// DICOM file request
const request = new XMLHttpRequest();
const url = 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm';
request.open('GET', url);
request.responseType = 'arraybuffer';
request.onload = onload;
request.send();

Methods

getDefaultCharacterSet() → {string}

Get the default character set.

Returns:

The default character set.

Type: 
string

getDicomElements() → {Object.<string, DataElement>}

Get the DICOM data elements.

Returns:

The data elements.

Type: 
Object.<string, DataElement>

parse(buffer)

Parse the complete DICOM file (given as input to the class). Fills in the member object 'dataElements'.

Parameters:
NameTypeDescription
bufferArrayBuffer

The input array buffer.

setDecoderCharacterSet(characterSet)

Set the text decoder character set.

Parameters:
NameTypeDescription
characterSetstring

The input character set.

setDefaultCharacterSet(characterSet)

Set the default character set.

Parameters:
NameTypeDescription
characterSetstring

The input character set.