dicom

dwv. dicom

Classes

DataReader
DataWriter
DicomElementsWrapper
DicomParser
DicomWriter
Tag

Members

(static) dictionary

Source:

DICOM tag dictionary. Generated using xml standard conversion from https://github.com/ivmartel/dcmbench/tree/master/view/part06 with http://medical.nema.org/medical/dicom/current/source/docbook/part06/part06.xml Conversion changes:

  • (vr) "See Note" -> "NONE", "OB or OW" -> "ox", "US or SS" -> "xs"
  • added "GenericGroupLength" element to each group Local changes:
  • tag numbers with 'xx' were replaced with '00', 'xxx' with '001' and 'xxxx' with '0004'

Methods

(static) checkUnknownVR(element)

Source:

Fix for broken DICOM elements: Replace "UN" with correct VR if the element exists in dictionary

Parameters:
Name Type Description
element object

The DICOM element.

(static) cleanString(inputStr) → {string}

Source:

Clean string: trim and remove ending.

Parameters:
Name Type Description
inputStr string

The string to clean.

Returns:

The cleaned string.

Type
string

(static) flattenArrayOfTypedArrays(initialArray) → {object}

Source:

Helper method to flatten an array of typed arrays to 2D typed array

Parameters:
Name Type Description
initialArray Array

array of typed arrays

Returns:

a typed array containing all values

Type
object

(static) flipArrayEndianness(array)

Source:

Flip an array's endianness. Inspired from DataStream.js.

Parameters:
Name Type Description
array object

The array to flip (modified).

(static) generatePixelDataFromJSONTags(tags, startOffset, pixGeneratorName, sliceNumber, images, numberOfSlices) → {object}

Source:

Get the DICOM pixel data from a DICOM tags object.

Parameters:
Name Type Description
tags object

The DICOM tags object.

startOffset object

The start offset of the pixel data.

pixGeneratorName string

The name of a pixel generator.

sliceNumber number

The slice number.

images Array

The images to pass to the generator.

numberOfSlices number

The result number of slices.

Returns:

The DICOM pixel data element.

Type
object

(static) getDataElementPrefixByteSize(vr, isImplicit) → {number}

Source:

Get the number of bytes occupied by a data element prefix, i.e. without its value.

Parameters:
Name Type Description
vr string

The Value Representation of the element.

isImplicit boolean

Does the data use implicit VR?

Returns:

The size of the element prefix. WARNING: this is valid for tags with a VR, if not sure use the 'isTagWithVR' function first. Reference:

| Tag | VR | VL | Value | | 4 | 2 | 2 | X | -> regular explicit: 8 + X | 4 | 2+2 | 4 | X | -> 32bit VL: 12 + X

| Tag | VL | Value | | 4 | 4 | X | -> implicit (32bit VL): 8 + X

| Tag | Len | Value | | 4 | 4 | X | -> item: 8 + X

Type
number

(static) getDicomElement(tagName) → {object}

Source:

Get a DICOM element from its tag name (value set separatly).

Parameters:
Name Type Description
tagName string

The string tag name.

Returns:

The DICOM element.

Type
object

(static) getDwvUIDPrefix() → {string}

Source:

Get the dwv UID prefix. Issued by Medical Connections Ltd (www.medicalconnections.co.uk) on 25/10/2017.

Returns:

The dwv UID prefix.

Type
string

(static) getElementsFromJSONTags(tags) → {object}

Source:

Get the DICOM element from a DICOM tags object.

Parameters:
Name Type Description
tags object

The DICOM tags object.

Returns:

The DICOM elements and the end offset.

Type
object

(static) getFileListFromDicomDir(data) → {Array}

Source:

Get the file list from a DICOMDIR

Parameters:
Name Type Description
data object

The buffer data of the DICOMDIR

Returns:

The file list as an array ordered by STUDY > SERIES > IMAGES.

Type
Array

(static) getFileMetaInformationGroupLengthTag() → {object}

Source:

Get the FileMetaInformationGroupLength Tag.

Returns:

The tag.

Type
object

(static) getImageDataData(image) → {object}

Source:

Extract the image data from an image.

Parameters:
Name Type Description
image Image

The image to get the data from.

Returns:

The image data buffer.

Type
object

(static) getItemDelimitationItemTag() → {dwv.dicom.Tag}

Source:

Get the ItemDelimitationItem Tag.

Returns:

The tag.

Type
dwv.dicom.Tag

(static) getItemTag() → {dwv.dicom.Tag}

Source:

Get the Item Tag.

Returns:

The tag.

Type
dwv.dicom.Tag

(static) getPixelDataTag() → {dwv.dicom.Tag}

Source:

Get the PixelData Tag.

Returns:

The tag.

Type
dwv.dicom.Tag

(static) getReverseOrientation(ori) → {string}

Source:

Get patient orientation label in the reverse direction.

Parameters:
Name Type Description
ori string

Patient Orientation value.

Returns:

Reverse Orientation Label.

Type
string

(static) getSequenceDelimitationItemTag() → {dwv.dicom.Tag}

Source:

Get the SequenceDelimitationItem Tag.

Returns:

The tag.

Type
dwv.dicom.Tag

(static) getSyntaxDecompressionName(syntax) → {string}

Source:

Tell if a given syntax needs decompression.

Parameters:
Name Type Description
syntax string

The transfer syntax to test.

Returns:

The name of the decompression algorithm.

Type
string

(static) getTagFromDictionary(tagName) → {object}

Source:

Get a tag from the dictionary using a tag string name.

Parameters:
Name Type Description
tagName string

The tag string name.

Returns:

The tag object.

Type
object

(static) getTagFromKey(key) → {object}

Source:

Split a group-element key used to store DICOM elements.

Parameters:
Name Type Description
key string

The key in form "x00280102" as generated by tag::getKey.

Returns:

The DICOM tag.

Type
object

(static) getTransferSyntaxName(syntax) → {string}

Source:

Get the transfer syntax name. Reference: UID Values.

Parameters:
Name Type Description
syntax string

The transfer syntax.

Returns:

The name of the transfer syntax.

Type
string

(static) getTransferSyntaxUIDTag() → {object}

Source:

Get the TransferSyntaxUID Tag.

Returns:

The tag.

Type
object

(static) getTypedArray(bitsAllocated, pixelRepresentation, size) → {Array}

Source:

Get the appropriate TypedArray in function of arguments.

Parameters:
Name Type Description
bitsAllocated number

The number of bites used to store the data: [8, 16, 32].

pixelRepresentation number

The pixel representation, 0:unsigned;1:signed.

size dwv.image.Size

The size of the new array.

Returns:

The good typed array.

Type
Array

(static) getUID(tagName) → {string}

Source:
See:

Get a UID for a DICOM tag.

Parameters:
Name Type Description
tagName string

The input tag.

Returns:

The corresponding UID.

Type
string

(static) getUtfLabel(charSetTerm) → {string}

Source:

Get the utfLabel (used by the TextDecoder) from a character set term References:

Parameters:
Name Type Description
charSetTerm string

The DICOM character set.

Returns:

The corresponding UTF label.

Type
string

(static) getVrPad(vr) → {boolean}

Source:

Get the VR specific padding value.

Parameters:
Name Type Description
vr string

The element VR.

Returns:

The value used to pad.

Type
boolean

(static) guessTransferSyntax(firstDataElement) → {object}

Source:

Guess the transfer syntax from the first data element. See https://github.com/ivmartel/dwv/issues/188 (Allow to load DICOM with no DICM preamble) for more details.

Parameters:
Name Type Description
firstDataElement object

The first data element of the DICOM header.

Returns:

The transfer syntax data element.

Type
object

(static) hasDicomPrefix(buffer) → {boolean}

Source:

Check that an input buffer includes the DICOM prefix 'DICM' after the 128 bytes preamble. Ref: DICOM File Meta

Parameters:
Name Type Description
buffer ArrayBuffer

The buffer to check.

Returns:

True if the buffer includes the prefix.

Type
boolean

(static) is32bitVLVR(vr) → {boolean}

Source:

Does this Value Representation (VR) have a 32bit Value Length (VL). Ref: Data Element explicit.

Parameters:
Name Type Description
vr string

The data Value Representation (VR).

Returns:

True if this VR has a 32-bit VL.

Type
boolean

(static) isBigEndianTransferSyntax(syntax) → {boolean}

Source:

Tell if a given syntax is a big endian syntax.

Parameters:
Name Type Description
syntax string

The transfer syntax to test.

Returns:

True if a big endian syntax.

Type
boolean

(static) isEven(number) → {boolean}

Source:

Return true if the input number is even.

Parameters:
Name Type Description
number number

The number to check.

Returns:

True is the number is even.

Type
boolean

(static) isFileMetaInformationGroupLengthTag(tag) → {boolean}

Source:

Is the input tag the FileMetaInformationGroupLength Tag.

Parameters:
Name Type Description
tag dwv.dicom.Tag

The tag to test.

Returns:

True if the asked tag.

Type
boolean

(static) isImplicitLengthItem(element) → {boolean}

Source:

Is this element an implicit length item?

Parameters:
Name Type Description
element object

The element to check.

Returns:

True if it is.

Type
boolean

(static) isImplicitLengthPixels(element) → {boolean}

Source:

Is this element an implicit length pixel data?

Parameters:
Name Type Description
element object

The element to check.

Returns:

True if it is.

Type
boolean

(static) isImplicitLengthSequence(element) → {boolean}

Source:

Is this element an implicit length sequence?

Parameters:
Name Type Description
element object

The element to check.

Returns:

True if it is.

Type
boolean

(static) isImplicitTransferSyntax(syntax) → {boolean}

Source:

Tell if a given syntax is an implicit one (element with no VR).

Parameters:
Name Type Description
syntax string

The transfer syntax to test.

Returns:

True if an implicit syntax.

Type
boolean

(static) isItemDelimitationItemTag(tag) → {boolean}

Source:

Is the input tag the ItemDelimitationItem Tag.

Parameters:
Name Type Description
tag dwv.dicom.Tag

The tag to test.

Returns:

True if the asked tag.

Type
boolean

(static) isItemTag(tag) → {boolean}

Source:

Is the input tag the Item Tag.

Parameters:
Name Type Description
tag dwv.dicom.Tag

The tag to test.

Returns:

True if the asked tag.

Type
boolean

(static) isJpeg2000TransferSyntax(syntax) → {boolean}

Source:

Tell if a given syntax is a JPEG 2000 one.

Parameters:
Name Type Description
syntax string

The transfer syntax to test.

Returns:

True if a jpeg 2000 syntax.

Type
boolean

(static) isJpegBaselineTransferSyntax(syntax) → {boolean}

Source:

Tell if a given syntax is a JPEG baseline one.

Parameters:
Name Type Description
syntax string

The transfer syntax to test.

Returns:

True if a jpeg baseline syntax.

Type
boolean

(static) isJpegLosslessTransferSyntax(syntax) → {boolean}

Source:

Tell if a given syntax is a JPEG Lossless one.

Parameters:
Name Type Description
syntax string

The transfer syntax to test.

Returns:

True if a jpeg lossless syntax.

Type
boolean

(static) isJpeglsTransferSyntax(syntax) → {boolean}

Source:

Tell if a given syntax is a JPEG-LS one.

Parameters:
Name Type Description
syntax string

The transfer syntax to test.

Returns:

True if a jpeg-ls syntax.

Type
boolean

(static) isJpegRetiredTransferSyntax(syntax) → {boolean}

Source:

Tell if a given syntax is a retired JPEG one.

Parameters:
Name Type Description
syntax string

The transfer syntax to test.

Returns:

True if a retired jpeg syntax.

Type
boolean

(static) isNativeLittleEndian()

Source:

Is the Native endianness Little Endian.

(static) isNonStringVr(vr) → {boolean}

Source:

Is the input VR a non string VR.

Parameters:
Name Type Description
vr string

The element VR.

Returns:

True if the VR is a non string one.

Type
boolean

(static) isPixelDataTag(tag) → {boolean}

Source:

Is the input tag the PixelData Tag.

Parameters:
Name Type Description
tag dwv.dicom.Tag

The tag to test.

Returns:

True if the asked tag.

Type
boolean

(static) isReadSupportedTransferSyntax(syntax) → {boolean}

Source:

Tell if a given syntax is supported for reading.

Parameters:
Name Type Description
syntax string

The transfer syntax to test.

Returns:

True if a supported syntax.

Type
boolean

(static) isRleTransferSyntax(syntax) → {boolean}

Source:

Tell if a given syntax is a RLE (Run-length encoding) one.

Parameters:
Name Type Description
syntax string

The transfer syntax to test.

Returns:

True if a RLE syntax.

Type
boolean

(static) isSequenceDelimitationItemTag(tag) → {boolean}

Source:

Is the input tag the SequenceDelimitationItem Tag.

Parameters:
Name Type Description
tag dwv.dicom.Tag

The tag to test.

Returns:

True if the asked tag.

Type
boolean

(static) isStringVr(vr) → {boolean}

Source:

Is the input VR a string VR.

Parameters:
Name Type Description
vr string

The element VR.

Returns:

True if the VR is a string one.

Type
boolean

(static) isVrToPad(vr) → {boolean}

Source:

Is the input VR a VR that could need padding.

Parameters:
Name Type Description
vr string

The element VR.

Returns:

True if the VR needs padding.

Type
boolean

(static) padElementValue(element, value) → {string}

Source:

Pad an input value according to its VR. see http://dicom.nema.org/dicom/2013/output/chtml/part05/sect_6.2.html

Parameters:
Name Type Description
element object

The DICOM element to get the VR from.

value object

The value to pad.

Returns:

The padded value.

Type
string

(static) setElementValue(element, value, isImplicit) → {number}

Source:

Set a DICOM element value according to its VR (Value Representation).

Parameters:
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?

Returns:

The total element size.

Type
number