new DicomWriter()
DICOM writer.
Example usage: var parser = new dwv.dicom.DicomParser(); parser.parse(this.response);
var writer = new dwv.dicom.DicomWriter(parser.getRawDicomElements()); var blob = new Blob([writer.getBuffer()], {type: 'application/dicom'});
var element = document.getElementById("download"); element.href = URL.createObjectURL(blob); element.download = "anonym.dcm";
- Source
Members
anonymisationRules
Example anonymisation rules.
- Source
rules
Public (modifiable) rules. Set of objects as: name : { action: 'actionName', value: 'optionalValue } The names are either 'default', tagName or groupName. Each DICOM element will be checked to see if a rule is applicable. First checked by tagName and then by groupName, if nothing is found the default rule is applied.
- Source
Methods
encodeSpecialString(str) → {Uint8Array}
Encode data as a UTF-8.
Name | Type | Description |
---|---|---|
str | number | The string to write. |
- Source
The encoded string.
- Type:
- Uint8Array
encodeString(str) → {Uint8Array}
Encode string data.
Name | Type | Description |
---|---|---|
str | number | The string to encode. |
- Source
The encoded string.
- Type:
- Uint8Array
getBuffer(dicomElements) → {ArrayBuffer}
Get the ArrayBuffer corresponding to input DICOM elements.
Name | Type | Description |
---|---|---|
dicomElements | Array | The wrapped elements to write. |
- Source
The elements as a buffer.
- Type:
- ArrayBuffer
getElementToWrite(element) → {object}
Get the element to write according to the class rules. Priority order: tagName, groupName, default.
Name | Type | Description |
---|---|---|
element | object | The element to check |
- Source
The element to write, can be null.
- Type:
- object
setElementValue(element, value, isImplicit, bitsAllocated) → {number}
Set a DICOM element value according to its VR (Value Representation).
Name | Type | Description |
---|---|---|
element | object | The DICOM element to set the value. |
value | object | The value to set. |
isImplicit | boolean | Does the data use implicit VR? |
bitsAllocated | number | Bits allocated used for pixel data. |
- Source
The total element size.
- Type:
- number
useSpecialTextEncoder()
Use a TextEncoder instead of the default text decoder.
- Source
writeDataElement(writer, element, byteOffset, isImplicit) → {number}
Write a data element.
Name | Type | Description |
---|---|---|
writer | dwv. | The raw data writer. |
element | object | The DICOM data element to write. |
byteOffset | number | The offset to start writing from. |
isImplicit | boolean | Is the DICOM VR implicit? |
- Source
The new offset position.
- Type:
- number
writeDataElementItems(writer, byteOffset, items, isImplicit) → {number}
Write a list of items.
Name | Type | Description |
---|---|---|
writer | dwv. | The raw data writer. |
byteOffset | number | The offset to start writing from. |
items | Array | The list of items to write. |
isImplicit | boolean | Is the DICOM VR implicit? |
- Source
The new offset position.
- Type:
- number
writeDataElementValue(writer, element, byteOffset, value, isImplicit) → {number}
Write data with a specific Value Representation (VR).
Name | Type | Description |
---|---|---|
writer | dwv. | The raw data writer. |
element | object | The element to write. |
byteOffset | number | The offset to start writing from. |
value | Array | The array to write. |
isImplicit | boolean | Is the DICOM VR implicit? |
- Source
The new offset position.
- Type:
- number
writePixelDataElementValue(writer, element, byteOffset, value, isImplicit) → {number}
Write a pixel data element.
Name | Type | Description |
---|---|---|
writer | dwv. | The raw data writer. |
element | object | The element to write. |
byteOffset | number | The offset to start writing from. |
value | Array | The array to write. |
isImplicit | boolean | Is the DICOM VR implicit? |
- Source
The new offset position.
- Type:
- number