new DicomParser()
DicomParser class.
- Source
// XMLHttpRequest onload callback
var onload = function (event) {
// setup the dicom parser
var dicomParser = new dwv.dicom.DicomParser();
// parse the buffer
dicomParser.parse(event.target.response);
// get the wrapped dicom tags
// (raw tags are available via 'getRawDicomElements')
var tags = dicomParser.getDicomElements();
// display the modality
var div = document.getElementById('dwv');
div.appendChild(document.createTextNode(
'Modality: ' + tags.getFromName('Modality')
));
};
// DICOM file request
var request = new XMLHttpRequest();
var 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();
Members
dicomElements :Array
The list of DICOM elements.
- Array
- Source
Methods
decodeSpecialString(buffer) → {string}
Decode an input string buffer using the 'special' text decoder.
Name | Type | Description |
---|---|---|
buffer | Uint8Array | The buffer to decode. |
- Source
The decoded string.
- Type:
- string
decodeString(buffer) → {string}
Decode an input string buffer using the default text decoder.
Name | Type | Description |
---|---|---|
buffer | Uint8Array | The buffer to decode. |
- Source
The decoded string.
- Type:
- string
getDefaultCharacterSet() → {string}
Get the default character set.
- Source
The default character set.
- Type:
- string
getDicomElements() → {object}
Get the DICOM data elements.
- Source
The DICOM elements.
- Type:
- object
getRawDicomElements() → {object}
Get the raw DICOM data elements.
- Source
The raw DICOM elements.
- Type:
- object
interpret(elements, reader, pixelRepresentation, bitsAllocated)
Interpret the data of a list of elements.
Name | Type | Description |
---|---|---|
elements | Array | A list of data elements. |
reader | dwv. | The raw data reader. |
pixelRepresentation | number | PixelRepresentation 0->unsigned, 1->signed. |
bitsAllocated | number | Bits allocated. |
interpretElement(element, reader, pixelRepresentation, bitsAllocated) → {object}
Interpret the data of an element.
Name | Type | Description |
---|---|---|
element | object | The data element. |
reader | dwv. | The raw data reader. |
pixelRepresentation | number | PixelRepresentation 0->unsigned, 1->signed (needed for pixel data or VR=xs). |
bitsAllocated | number | Bits allocated (needed for pixel data). |
- Source
The interpreted data.
- Type:
- object
parse(buffer)
Parse the complete DICOM file (given as input to the class). Fills in the member object 'dicomElements'.
Name | Type | Description |
---|---|---|
buffer | object | The input array buffer. |
readDataElement(reader, offset, implicit) → {object}
Read a DICOM data element. Reference: DICOM VRs.
Name | Type | Description |
---|---|---|
reader | dwv. | The raw data reader. |
offset | number | The offset where to start to read. |
implicit | boolean | Is the DICOM VR implicit? |
- Source
An object containing the element 'tag', 'vl', 'vr', 'data' and 'endOffset'.
- Type:
- object
readItemDataElement(reader, offset, implicit) → {object}
Read an item data element.
Name | Type | Description |
---|---|---|
reader | dwv. | The raw data reader. |
offset | number | The offset where to start to read. |
implicit | boolean | Is the DICOM VR implicit? |
- Source
The item data as a list of data elements.
- Type:
- object
readPixelItemDataElement(reader, offset, implicit) → {Array}
Read the pixel item data element. Ref: Single frame fragments.
Name | Type | Description |
---|---|---|
reader | dwv. | The raw data reader. |
offset | number | The offset where to start to read. |
implicit | boolean | Is the DICOM VR implicit? |
- Source
The item data as an array of data elements.
- Type:
- Array
readTag(reader, offset) → {object}
Read a DICOM tag.
Name | Type | Description |
---|---|---|
reader | dwv. | The raw data reader. |
offset | number | The offset where to start to read. |
- Source
An object containing the tag and the end offset.
- Type:
- object
setDecoderCharacterSet(characterSet)
Set the text decoder character set.
Name | Type | Description |
---|---|---|
characterSet | string | The input character set. |
- Source
setDefaultCharacterSet(characterSet)
Set the default character set.
Name | Type | Description |
---|---|---|
characterSet | string | The input character set. |
- Source