Members

(constant) DRAW_DEBUG

Draw Debug flag.

(constant) InteractionEventNames

List of interaction event names.

(constant) Orientation

Default anatomical plane orientations.

(constant) RequiredDicomSegTags

List of DICOM Seg required tags.

(constant) TagKeys

Small list of used tag keys.

(constant) TagKeys

Small list of used tag keys.

(constant) binderList

List of binders.

(constant) customUI

Overridalbe custom UI object for client defined UI.

(constant) d65

CIE Standard Illuminant D65, standard 2° observer.

Ref: https://en.wikipedia.org/wiki/Illuminant_D65.

(constant) decoderScripts

Decoder scripts to be passed to web workers for image decoding.

(constant) defaultPresets :Object.<string, Object.<string, WindowLevel>>

List of default window level presets.

Type:

(constant) dictionary :Object.<string, Object.<string, Array.<string>>>

DICOM tag dictionary 2022a. Generated using xml standard conversion from https://github.com/ivmartel/dcmStdToJs v0.1.0.

Conversion changes:

  • (vr) 'See Note' -> 'NONE',
  • (vr) 'OB or OW' -> 'ox',
  • (vr) 'US or SS' -> 'xs',
  • (vr) 'US or OW' -> 'xx',
  • (vr) 'US or SS or OW' -> 'xs',
  • added 'GenericGroupLength' element to each group.

Local changes:

  • tag numbers with 'xx' were replaced with '00', 'xxx' with '001' and 'xxxx' with '0004'.
Type:
  • Object.<string, Object.<string, Array.<string>>>

(constant) i18n

Namespace for translation function (in a namespace to allow for override from client).

(constant) lut_range_max

Lookup tables for image colour display.

(constant) luts :Object.<string, ColourMap>

List of available lookup tables (lut).

Type:

(constant) minWindowWidth

(constant) tagGroups :Object.<string, string>

Tag groups: key to name pairs. Copied from gdcm-2.6.1\Source\DataDictionary\GroupName.dic -> removed duplicates (commented).

Type:
  • Object.<string, string>

(constant) toolList :Object.<string, any>

List of client provided tools to be added to the default ones.

Type:
  • Object.<string, any>

(constant) transferSyntaxKeywords :Object.<string, string>

Transfer syntaxes indexed by keyword.

Type:
  • Object.<string, string>

(constant) transferSyntaxes :Object.<string, string>

Type:
  • Object.<string, string>

(constant) viewEventNames :Array.<string>

List of view event names.

Type:
  • Array.<string>

(constant) vr32bitVL :Object.<string, boolean>

List of Value Representation (VR) with 32bit Value Length (VL).

Added locally used 'ox'. See http://dicom.nema.org/medical/dicom/2022a/output/chtml/part05/chapter_7.html#table_7.1-1.

Type:
  • Object.<string, boolean>

(constant) vrCharSetString :Object.<string, boolean>

List of string VR with extended or replaced default character repertoire defined in Specific Character Set (0008,0005).

See https://dicom.nema.org/medical/dicom/2022a/output/chtml/part05/chapter_6.html#sect_6.1.2.2.

Type:
  • Object.<string, boolean>

(constant) vrTypes :Object.<string, string>

Type:
  • Object.<string, string>

(constant) writerActions :Object.<string, function()>

Possible writer actions.

Type:
  • Object.<string, function()>

Methods

addDataRow(dataId)

Add a data row.

Parameters:
NameTypeDescription
dataIdstring

The data id.

addLayerGroup(id)

Append a layer div in the root 'dwv' one.

Parameters:
NameTypeDescription
idstring

The id of the layer.

addLayerGroups(number)

Add Layer Groups.

Parameters:
NameTypeDescription
numbernumber

The number of layer groups.

addTagsToDictionary(group, tags)

Add tags to the dictionary.

Parameters:
NameTypeDescription
groupstring

The group key.

tagsObject.<string, Array.<string>>

The tags to add as an object indexed by element key with values as: [VR, multiplicity, TagName] (all strings).

arrayContains(arr0, arr1) → {boolean}

Check if the first input array contains all the elements of the second input array.

Parameters:
NameTypeDescription
arr0Array.<string>

The test array.

arr1Array.<string>

The elements to check in the first array.

Returns:

True if all the elements of arr1 are included in arr0.

Type: 
boolean

arrayEquals(arr0, arr1) → {boolean}

Check for array equality.

Parameters:
NameTypeDescription
arr0Array

First array.

arr1Array

Second array.

Returns:

True if both array are defined and contain same values.

Type: 
boolean

arraySortEquals(arr0, arr1) → {boolean}

Check for array equality after sorting.

Parameters:
NameTypeDescription
arr0Array

First array.

arr1Array

Second array.

Returns:

True if both array are defined and contain same values.

Type: 
boolean

b64urlToArrayBuffer(str) → {ArrayBuffer}

Convert a base64 url to an ArrayBuffer. Something like: 'data:application/dicom;base64,SGVsbG8sIFdvcmxkIQ==' The function is independent from the mime type.

Parameters:
NameTypeDescription
strstring

Base64 url string.

Returns:

The corresponding buffer.

Type: 
ArrayBuffer

bindAppToControls()

Bind app to controls.

boundNodePosition(node, min, max) → {boolean}

Bound a node position.

Parameters:
NameTypeDescription
nodeKonva.Node

The node to bound the position.

minPoint2D

The minimum position.

maxPoint2D

The maximum position.

Returns:

True if the position was corrected.

Type: 
boolean

buildLut(func) → {Array.<number>}

Build a LUT of size lut_range_max.

Parameters:
NameTypeDescription
funcfunction

The i to lut function.

Returns:

The LUT.

Type: 
Array.<number>

buildMultipart(parts, boundary) → {Uint8Array}

Parameters:
NameTypeDescription
partsArray

The message parts as an array of object containing content headers and messages as the data property (as returned by parse).

boundarystring

The message boundary.

Returns:

The full multipart message.

Type: 
Uint8Array

canCreateCanvas(width, height) → {boolean}

Parameters:
NameTypeDescription
widthnumber

The canvas width.

heightnumber

The canvas height.

Returns:

True is the canvas can be created.

Type: 
boolean

canNodeChangeColour(node) → {boolean}

Is the input node a node that has the 'stroke' method.

Parameters:
NameTypeDescription
nodeKonva.Node

A Konva node.

Returns:

True if the node's name is 'anchor' and 'label'.

Type: 
boolean

capitaliseFirstLetter(string) → {string}

Capitalise the first letter of a string.

Parameters:
NameTypeDescription
stringstring

The string to capitalise the first letter.

Returns:

The new string.

Type: 
string

checkAndFixUnknownVR(element, isLittleEndianopt)

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

Parameters:
NameTypeAttributesDescription
elementDataElement

The DICOM element.

isLittleEndianboolean<optional>

Flag to tell if the data is little or big endian (default: true).

checkIterator(assert, getIter, theoValues, name)

Check iter.

Parameters:
NameTypeDescription
assertobject

The qunit assert.

getIterfunction

Function to get the iter at a given position.

theoValuesArray

Theoretical values.

namestring

String to identify test.

checkLoad(assert, id, data, nData, nDataOk)

Check the events of memory load.

Parameters:
NameTypeDescription
assertobject

The Qunit assert object.

idstring

An id for the test.

dataArray

The data to load as a string array.

nDatanumber

The theoretical number of data.

nDataOknumber

The theoretical number of data with no error.

checkResponseEvent(event, reqName) → {boolean}

Check a response event and print error if any.

Parameters:
NameTypeDescription
eventobject

The load event.

reqNamestring

The request name.

Returns:

True if response is ok.

Type: 
boolean

checkSelected(parser) → {boolean}

Check if a parser is checked.

Parameters:
NameTypeDescription
parserobject

The parser to check.

Returns:

True isf selected.

Type: 
boolean

checkTag(element, name, valuesopt) → {string}

Check an input tag.

Parameters:
NameTypeAttributesDescription
elementobject

The element to check.

namestring

The element name.

valuesArray<optional>

The expected values.

Returns:

A warning if the element is not as expected.

Type: 
string

checkTag(dataElements, tagDefinition)

Check that a DICOM tag definition is present in a parsed element.

Parameters:
NameTypeDescription
dataElementsDataElements

The root dicom element.

tagDefinitionobject

The tag definition as {name, tag, type, enum}.

checkTags(tags, requiredTags, withLog) → {boolean}

Check a list of input tags against a required list.

Parameters:
NameTypeDescription
tagsobject

The tags to check.

requiredTagsArray

Array of tag names.

withLogboolean

Flag to log errors or not.

Returns:

True if all required tags are present in the input.

Type: 
boolean

cielabToCiexyz(triplet) → {Scalar3D}

Convert CIE LAB to CIE XYZ (standard illuminant D65, 2degree 1931).

Ref: https://en.wikipedia.org/wiki/CIELAB_color_space#From_CIELAB_to_CIEXYZ.

Parameters:
NameTypeDescription
tripletobject

CIE LAB triplet as {l,a,b}.

Returns:

CIE XYZ triplet as {x,y,z}.

Type: 
Scalar3D

cielabToSrgb(triplet) → {RGB}

Convert CIE LAB to sRGB (standard illuminant D65).

Parameters:
NameTypeDescription
tripletobject

CIE LAB triplet as {l,a,b}.

Returns:

'sRGB' triplet as {r,g,b}.

Type: 
RGB

ciexyzToCielab(triplet) → {object}

Convert CIE XYZ to CIE LAB (standard illuminant D65, 2degree 1931).

Ref: https://en.wikipedia.org/wiki/CIELAB_color_space#From_CIEXYZ_to_CIELAB.

Parameters:
NameTypeDescription
tripletScalar3D

CIE XYZ triplet as {x,y,z}.

Returns:

CIE LAB triplet as {l,a,b}.

Type: 
object

ciexyzToSrgb(triplet) → {RGB}

Parameters:
NameTypeDescription
tripletScalar3D

CIE XYZ triplet as {x,y,z}.

Returns:

'sRGB' triplet as {r,g,b}.

Type: 
RGB

cleanString(inputStr) → {string}

Clean string: remove zero-width space ending and trim. Warning: no tests are done on the input, will fail if null or undefined or not string. Exported for tests only.

Parameters:
NameTypeDescription
inputStrstring

The string to clean.

Returns:

The cleaned string.

Type: 
string

clearDataTable()

Clear the data table.

colourNameToHex(name) → {string}

Get the hex code of a string colour for a colour used in pre dwv v0.17.

Parameters:
NameTypeDescription
namestring

The name of a colour.

Returns:

The hex representing the colour.

Type: 
string

colourRange(colours, end) → {object}

Get a colour iterator. The input array defines the colours and their start index.

Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols.

Parameters:
NameTypeDescription
coloursArray

An array of {index, colour} pairs.

endnumber

The end of the range (excluded).

Returns:

An iterator folowing the iterator and iterable protocol.

Type: 
object

compare(jsonTags, dicomElements, name, comparator)

Compare JSON tags and DICOM elements.

Parameters:
NameTypeDescription
jsonTagsobject

The JSON tags.

dicomElementsobject

The DICOM elements.

namestring

The name of the test.

comparatorobject

An object with an equal function (such as Qunit assert).

compareImageAndBuffer(image, size, buffer, rsi) → {object}

Compare an image and a buffer.

Parameters:
NameTypeDescription
imageobject

The input image.

sizeobject

The size of the input buffer.

bufferArray

The input buffer.

rsiobject

The rescale slope of the input buffer.

Returns:

Statistics of the value and rescaled value differences.

Type: 
object

comparePosPat(a, b) → {number}

Compare two pos pat keys.

Parameters:
NameTypeDescription
astring

The key of the first item.

bstring

The key of the second item.

Returns:

Negative if a<b, positive if a>b.

Type: 
number

computeGradX(greyscale) → {Array}

Compute the X gradient.

Parameters:
NameTypeDescription
greyscaleobject

The values.

Returns:

The gradient.

Type: 
Array

computeGradY(greyscale) → {Array}

Compute the Y gradient.

Parameters:
NameTypeDescription
greyscaleobject

The values.

Returns:

The gradient.

Type: 
Array

computeGradient(greyscale) → {object}

Compute gradient.

Parameters:
NameTypeDescription
greyscaleobject

The input greyscale.

Returns:

A gradient object.

Type: 
object

computeGreyscale(data, width, height) → {object}

Compute grey scale.

Parameters:
NameTypeDescription
dataArray

The input data.

widthnumber

The width of the output.

heightnumber

The height of the output.

Returns:

A greyscale object.

Type: 
object

computeLaplace(greyscale) → {object}

Parameters:
NameTypeDescription
greyscaleobject

The input greyscale.

Returns:

A laplace object.

Type: 
object

computeSides(dist, gradX, gradY, greyscale) → {object}

Compute the sides.

Parameters:
NameTypeDescription
distnumber

The distance.

gradXArray

The X gradient.

gradYArray

The Y gradient.

greyscaleobject

The value.

Returns:

The sides.

Type: 
object

createAndPutHtml(data, id)

Create and append html.

Parameters:
NameTypeDescription
dataobject

Data configuration object.

idstring

The html list element.

createDefaultReplaceFormat(length) → {string}

Create a default replace format from a given length. For example: '{v0}, {v1}'.

Parameters:
NameTypeDescription
lengthnumber

The length of the format.

Returns:

A replace format.

Type: 
string

createImage(elements) → {Image}

Create an Image from DICOM elements.

Parameters:
NameTypeDescription
elementsObject.<string, DataElement>

The DICOM elements.

Returns:

The Image object.

Type: 
Image

createImage(colourMapName, colourMap)

Create the colour map image and add it to the document.

Parameters:
NameTypeDescription
colourMapNamestring

The colour map name.

colourMapobject

The colour map values.

createMaskImage(elements) → {Image}

Create a mask Image from DICOM elements.

Parameters:
NameTypeDescription
elementsObject.<string, DataElement>

The DICOM elements.

Returns:

The mask Image object.

Type: 
Image

createOverlayData(dicomElements, configs) → {Array}

Create overlay data array for a DICOM image.

Parameters:
NameTypeDescription
dicomElementsobject

DICOM elements of the image.

configsobject

The overlay data configs.

Returns:

Overlay data array.

Type: 
Array

createOverlayDataForDom(info, configs) → {Array}

Create overlay data array for a DOM image.

Parameters:
NameTypeDescription
infoobject

Meta data.

configsobject

The overlay data configs.

Returns:

Overlay data array.

Type: 
Array

createRoiBuffers(image, segments) → {object}

Create ROI buffers.

Parameters:
NameTypeDescription
imageImage

The mask image.

segmentsArray.<MaskSegment>

The mask segments.

Returns:

The ROI buffers.

Type: 
object

createRoiSliceBuffers(image, segments, sliceOffset) → {object}

Create ROI slice buffers.

Parameters:
NameTypeDescription
imageImage

The mask image.

segmentsArray.<MaskSegment>

The mask segments.

sliceOffsetnumber

The slice offset.

Returns:

The ROI slice image buffers.

Type: 
object

createView(elements, image) → {View}

Create a View from DICOM elements and image.

Parameters:
NameTypeDescription
elementsObject.<string, DataElement>

The DICOM elements.

imageImage

The associated image.

Returns:

The View object.

Type: 
View

dcmdump(dicomElements) → {string}

Dump the DICOM tags to a string in the same way as the DCMTK dcmdump command (https://support.dcmtk.org/docs-dcmrt/dcmdump.html).

Parameters:
NameTypeDescription
dicomElementsObject.<string, DataElement>

The dicom elements.

Returns:

The dumped file.

Type: 
string

decodeKeyValueUri(uri, replaceMode) → {Array.<string>}

Decode a Key/Value pair URI. If a key is repeated, the result be an array of base + each key.

Parameters:
NameTypeDescription
uristring

The URI to decode.

replaceModestring

The key replace mode. Can be:

  • key (default): keep the key
  • other than key: do not use the key 'file' is a special case where the '?' of the query is not kept.
Returns:

The list of input file urls.

Type: 
Array.<string>

decodeManifest(manifest, nslices) → {Array.<string>}

Decode an XML manifest.

Parameters:
NameTypeDescription
manifestobject

The manifest to decode.

nslicesnumber

The number of slices to load.

Returns:

The decoded manifest.

Type: 
Array.<string>

decodeQuery(query, callback, options)

Generic URI query decoder. Supports manifest: [dwv root]?input=encodeURIComponent('[manifest file]')&type=manifest. Or encoded URI with base and key value/pairs: [dwv root]?input=encodeURIComponent([root]?key0=value0&key1=value1).

Parameters:
NameTypeDescription
queryobject

The query part to the input URI.

callbackfunction

The function to call with the decoded file urls.

optionsobject

Optional url request options.

endsWith(str, search) → {boolean}

Check if a string ends with the input element.

Parameters:
NameTypeDescription
strstring

The input string.

searchstring

The searched ending.

Returns:

True if the input string ends with the searched string.

Type: 
boolean

equalPosPat(pos1, pos2) → {boolean}

Check two position patients for equality.

Parameters:
NameTypeDescription
pos1*

The first position patient.

pos2*

The second position patient.

Returns:

True is equal.

Type: 
boolean

fileCheckTags(tags, image) → {boolean}

Check tags are coherent with image size.

Parameters:
NameTypeDescription
tagsobject

The tags to check.

imageobject

The associated image.

Returns:

True if the tags are ok.

Type: 
boolean

fillGithubHostedWithExample(base, files)

Fill github hosted inputs with preset strings.

Parameters:
NameTypeDescription
basestring

The base url href.

filesstring

The coma separated list of files.

findInArraySubset(arr, callbackFn, start, endopt) → {number|undefined}

Array find in a subset of the input array. Equivalent to: arr.slice(start, end).find(callbackFn).

Parameters:
NameTypeAttributesDescription
arrUint8Array

The input array to search.

callbackFnfunction

The find function.

startnumber | undefined

The array start index.

endnumber | undefined<optional>

The array end index.

Returns:

The index where the element was found.

Type: 
number | undefined

flattenArrayOfTypedArrays(initialArray) → {object}

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

Parameters:
NameTypeDescription
initialArrayArray

Array of typed arrays.

Returns:

A typed array containing all values.

Type: 
object

flipArrayEndianness(array)

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

Parameters:
NameTypeDescription
arrayobject

The array to flip (modified).

gaussianBlur(buffer, out)

Gaussian blur an input buffer.

Parameters:
NameTypeDescription
bufferArray

The input buffer.

outArray

The result.

generate()

Generate DICOM data.

generateBinary(tags) → {object}

Simple BinaryPixGenerator.

Parameters:
NameTypeDescription
tagsobject

The input tags.

Returns:

The pixel buffer.

Type: 
object

generateGradSquare(tags) → {object}

Simple GradSquarePixGenerator.

Parameters:
NameTypeDescription
tagsobject

The input tags.

Returns:

The pixel buffer.

Type: 
object

generateImageDataMonochrome(array, iterator, alphaFunc, windowLut, colourMap)

Generate image data for 'MONOCHROME*' photometric interpretation.

Parameters:
NameTypeDescription
arrayImageData

The array to store the outut data.

iteratorobject

Position iterator.

alphaFuncfunction

The alpha function.

windowLutWindowLut

The window/level LUT.

colourMapColourMap

The colour map.

generateImageDataPaletteColor(array, iterator, alphaFunc, colourMap, is16BitsStored)

Generate image data for 'PALETTE COLOR' photometric interpretation.

Parameters:
NameTypeDescription
arrayImageData

The array to store the outut data.

iteratorobject

Position iterator.

alphaFuncfunction

The alpha function.

colourMapColourMap

The colour map.

is16BitsStoredboolean

Flag to know if the data is 16bits.

generateImageDataRgb(array, iterator, alphaFunc)

Generate image data for 'RGB' photometric interpretation.

Parameters:
NameTypeDescription
arrayImageData

The array to store the outut data.

iteratorobject

Position iterator.

alphaFuncfunction

The alpha function.

generateImageDataYbrFull(array, iterator, alphaFunc)

Generate image data for 'YBR_FULL' photometric interpretation.

Parameters:
NameTypeDescription
arrayImageData

The array to store the outut data.

iteratorobject

Position iterator.

alphaFuncfunction

The alpha function.

generateSlice(pixelGeneratorName, sliceNumber) → {Blob}

Parameters:
NameTypeDescription
pixelGeneratorNamestring

The name of the pixel generator.

sliceNumbernumber

The slice to generate.

Returns:

A blob with the slice DICOM data.

Type: 
Blob

getAnchorMin(group) → {Point2D|undefined}

Get the minimum position in a groups' anchors.

Parameters:
NameTypeDescription
groupKonva.Group

The group that contains anchors.

Returns:

The minimum position.

Type: 
Point2D | undefined

getAngle(line0, line1) → {number}

Get the angle between two lines in degree.

Parameters:
NameTypeDescription
line0Line

The first line.

line1Line

The second line.

Returns:

The angle.

Type: 
number

getBasicStats(values) → {Statistics}

Get simple stats: minimum, maximum, mean and standard deviation of an array of values.

Parameters:
NameTypeDescription
valuesArray.<number>

The array of values to extract stats from.

Returns:

Simple statistics (no median, p25 nor p75).

Type: 
Statistics

getBasicStats(array) → {object}

Get basic stats for an array.

Parameters:
NameTypeDescription
arrayArray

Input array.

Returns:

Min, max, mean and standard deviation.

Type: 
object

getBpeForVrType(vrType) → {number}

Get the number of bytes per element for a given VR type.

Parameters:
NameTypeDescription
vrTypestring

The VR type as defined in the dictionary.

Returns:

The bytes per element.

Type: 
number

getBrightness(rgb) → {number}

Get the brightness of a RGB colour: calculates the luma (Y) of the YIQ colour space.

Ref: https://en.wikipedia.org/wiki/YIQ#From_RGB_to_YIQ.

Parameters:
NameTypeDescription
rgbRGB

RGB triplet.

Returns:

The brightness ([0,1]).

Type: 
number

getCode(dataElements) → {DicomCode}

Get a code object from a dicom element.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The dicom element.

Returns:

A code object.

Type: 
DicomCode

getCodeFromSimpleDicom(simpleElements) → {DicomCode}

Get a dicom code from simple dicom elements.

Parameters:
NameTypeDescription
simpleElementsObject.<string, DataElement>

DICOM simple elements.

Returns:

The corresponding DICOM code.

Type: 
DicomCode

getCommonPrefix(values) → {string|undefined}

Get a common prefix from a list of strings.

Parameters:
NameTypeDescription
valuesArray.<string>

The values to extract the prefix from.

Returns:

The common prefix.

Type: 
string | undefined

getComparePosPat(orientation) → {compareFn}

Get a position patient compare function accroding to an input orientation.

Parameters:
NameTypeDescription
orientationMatrix33

The orientation matrix.

Returns:

The position compare function.

Type: 
compareFn

getConfigsHtmlList(configs) → {object}

Create list from configs.

Parameters:
NameTypeDescription
configsArray

An array of data cofiguration.

Returns:

The html list element.

Type: 
object

getControlDiv(id, name, min, max, value, callback, precision) → {object}

Get a control div: label, range and number field.

Parameters:
NameTypeDescription
idstring

The control id.

namestring

The control name.

minnumber

The control minimum value.

maxnumber

The control maximum value.

valuenumber

The control value.

callbackfunction

The callback on control value change.

precisionnumber

Optional number field float precision.

Returns:

The control div.

Type: 
object

getCoronalMat33() → {Matrix33}

Create a 3x3 coronal (xzy) matrix.

Returns:

The coronal matrix.

Type: 
Matrix33

getData() → {Array}

Get the selected data.

Returns:

The selected data.

Type: 
Array

getDataElement(tagName) → {DataElement}

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

Parameters:
NameTypeDescription
tagNamestring

The string tag name.

Returns:

The DICOM element.

Type: 
DataElement

getDataElementPrefixByteSize(vr, isImplicit) → {number}

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

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
Parameters:
NameTypeDescription
vrstring

The Value Representation of the element.

isImplicitboolean

Does the data use implicit VR?

Returns:

The size of the element prefix.

Type: 
number

getDataLayerGroupDivIds(dataId) → {Array}

Get the layer group div ids associated to a data id.

Parameters:
NameTypeDescription
dataIdstring

The data id.

Returns:

The list of div ids.

Type: 
Array

getDate(element) → {Object|undefined}

Get a 'date' object with {year, monthIndex, day} ready for the Date constructor from a DICOM element with vr=DA.

Parameters:
NameTypeDescription
elementobject

The DICOM element with date information.

Returns:

The 'date' object.

Type: 
Object | undefined

getDateTime(element) → {Object|undefined}

Get a 'dateTime' object with {date, time} ready for the Date constructor from a DICOM element with vr=DT.

Parameters:
NameTypeDescription
elementobject

The DICOM element with date-time information.

Returns:

The time object.

Type: 
Object | undefined

getDeOrientedArray3D(array3D, orientation) → {Array.<number>}

Get the raw values of an oriented input 3D array.

Parameters:
NameTypeDescription
array3DArray.<number>

The 3D array.

orientationMatrix33

The orientation 3D matrix.

Returns:

The values reordered to compensate the orientation.

Type: 
Array.<number>

getDecayedDose(elements) → {object}

Get the decayed dose (Bq).

Parameters:
NameTypeDescription
elementsobject

The DICOM elements to check.

Returns:

The value and a warning if the elements are not as expected.

Type: 
object

getDefaultAnchor(x, y, id, style) → {Konva.Ellipse}

Get the default anchor shape.

Parameters:
NameTypeDescription
xnumber

The X position.

ynumber

The Y position.

idstring

The shape id.

styleStyle

The application style.

Returns:

The default anchor shape.

Type: 
Konva.Ellipse

getDefaultAnonymisationRules() → {Object.<string, WriterRule>}

Get simple (non official) DICOM anonymisation rules.

Returns:

The rules.

Type: 
Object.<string, WriterRule>

getDefaultDicomSegJson() → {object}

Get the default DICOM seg tags as an object.

Returns:

The default tags.

Type: 
object

getDefaultImage(width, height, sliceIndex, imageBuffer, numberOfFrames, imageUid) → {object}

Get an image from an input context imageData.

Parameters:
NameTypeDescription
widthnumber

The width of the coresponding image.

heightnumber

The height of the coresponding image.

sliceIndexnumber

The slice index of the imageData.

imageBufferobject

The image buffer.

numberOfFramesnumber

The final number of frames.

imageUidstring

The image UID.

Returns:

The corresponding view.

Type: 
object

getDicomCodeItem(code) → {Object.<string, any>}

Get a simple dicom element item from a code object.

Parameters:
NameTypeDescription
codeDicomCode

The code object.

Returns:

The item as a list of (key, value) pairs.

Type: 
Object.<string, any>

getDicomDate(date) → {string}

Get a DICOM formated date.

Parameters:
NameTypeDescription
dateDate

The date to format.

Returns:

The formated date.

Type: 
string

getDicomMeasureItem(spacing) → {object}

Get a dicom item from a measure sequence.

Parameters:
NameTypeDescription
spacingSpacing

The spacing object.

Returns:

The dicom item.

Type: 
object

getDicomPlaneOrientationItem(orientation) → {object}

Get a dicom element from a plane orientation sequence.

Parameters:
NameTypeDescription
orientationMatrix33

The image orientation.

Returns:

The dicom element.

Type: 
object

getDicomSegmentFrameInfoItem(frameInfo) → {Object.<string, any>}

Get a dicom item from a frame information object.

Parameters:
NameTypeDescription
frameInfoobject

The frame information object.

Returns:

The item as a list of (key, value) pairs.

Type: 
Object.<string, any>

getDicomSegmentItem(segment) → {Object.<string, any>}

Get a dicom simple tag from a segment object.

Parameters:
NameTypeDescription
segmentMaskSegment

The segment object.

Returns:

The item as a list of (key, value) pairs.

Type: 
Object.<string, any>

getDicomTime(date) → {string}

Get a DICOM formated time.

Parameters:
NameTypeDescription
dateDate

The date to format.

Returns:

The formated time.

Type: 
string

getDimensionOrganization(dataElements) → {object}

Check the dimension organization from a dicom element.

Parameters:
NameTypeDescription
dataElementsDataElements

The root dicom element.

Returns:

The dimension organizations and indices.

Type: 
object

getDivIds(dataViewConfig) → {Array}

Get the layer group div ids associated to a view config.

Parameters:
NameTypeDescription
dataViewConfigArray

The data view config.

Returns:

The list of div ids.

Type: 
Array

getDwvUIDPrefix() → {string}

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

getDwvUrl(uri) → {string}

Get the dwv url from a data input uri.

Parameters:
NameTypeDescription
uri*

The dwv input uri.

Returns:

The full dwv url.

Type: 
string

getDwvVersion() → {string}

Get the version of the library.

Returns:

The version of the library.

Type: 
string

getElementAsString(tag, dicomElement, prefixopt) → {string}

Get a data element as a string.

Parameters:
NameTypeAttributesDescription
tagTag

The DICOM tag.

dicomElementobject

The DICOM element.

prefixstring<optional>

A string to prepend this one.

Returns:

The element as a string.

Type: 
string

getElementValueAsString(tag, dicomElement, prettyopt) → {string}

Get a data element value as a string.

Parameters:
NameTypeAttributesDescription
tagTag

The DICOM tag.

dicomElementobject

The DICOM element.

prettyboolean<optional>

When set to true, returns a 'pretified' content.

Returns:

A string representation of the DICOM element.

Type: 
string

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

Get the DICOM elements from a 'simple' DICOM tags object. The input object is a simplified version of the oficial DICOM json with tag names instead of keys and direct values (no value property) for simple tags. See synthetic test data (in tests/dicom) for examples.

Parameters:
NameTypeDescription
simpleTagsObject.<string, any>

The 'simple' DICOM tags object.

Returns:

The DICOM elements.

Type: 
Object.<string, DataElement>

getEllipseIndices(center, radius, dir) → {Array.<Index>}

Get the indices that form a ellpise.

Parameters:
NameTypeDescription
centerIndex

The ellipse center.

radiusArray.<number>

The 2 ellipse radiuses.

dirArray.<number>

The 2 ellipse directions.

Returns:

The indices of the ellipse.

Type: 
Array.<Index>

getEqualPoint3DFunction(point) → {function}

Get an array find callback for an equal input point.

Parameters:
NameTypeDescription
pointPoint3D

The point to compare to.

Returns:

A function that compares, using equals, its input point to the one given as input to this function.

Type: 
function

getFileConfigsHtmlList(fileName)

Get the list of configs and display them with a download link.

Parameters:
NameTypeDescription
fileNamestring

The input file name.

getFileExtension(filePath) → {string}

Get a file extension: anything after the last dot. File name starting with a dot are discarded. Extensions are expected to contain at least one letter.

Parameters:
NameTypeDescription
filePathstring

The file path containing the file name.

Returns:

The lower case file extension or null for none.

Type: 
string

getFileListFromDicomDir(data) → {Array|undefined}

Get the file list from a DICOMDIR.

Parameters:
NameTypeDescription
dataobject

The buffer data of the DICOMDIR.

Returns:

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

Type: 
Array | undefined

getFileMetaInformationGroupLengthTag() → {Tag}

Get the FileMetaInformationGroupLength Tag.

Returns:

The tag.

Type: 
Tag

getFindArrayInArrayCallback(arr1) → {function}

Get a find in array callback.

Parameters:
NameTypeDescription
arr1Uint8Array

The array to find.

Returns:

The find callback function.

Type: 
function

getFlags(inputStr) → {Array.<string>}

Get flags from an input string. Flags are words surrounded with curly braces.

Parameters:
NameTypeDescription
inputStrstring

The input string.

Returns:

An array of found flags.

Type: 
Array.<string>

getFullStats(values) → {Statistics}

Get full stats: minimum, maximum, mean, standard deviation, median, 25% and 75% percentile of an array of values.

Parameters:
NameTypeDescription
valuesArray.<number>

The array of values to extract stats from.

Returns:

Complete statistics (includes median, p25 and p75).

Type: 
Statistics

getHierarchyLog(layer, prefix) → {string}

Debug function to output the layer hierarchy as text.

Parameters:
NameTypeDescription
layerobject

The Konva layer.

prefixstring

A display prefix (used in recursion).

Returns:

A text representation of the hierarchy.

Type: 
string

getIdentityMat33() → {Matrix33}

Create a 3x3 identity matrix.

Returns:

The identity matrix.

Type: 
Matrix33

getImage2DSize(elements) → {Array.<number>}

Extract the 2D size from dicom elements.

Parameters:
NameTypeDescription
elementsDataElements

The DICOM elements.

Returns:

The size.

Type: 
Array.<number>

getIndexFromStringId(inputStr) → {Index}

Get an index from an id string in the form of: '#0-1_#1-2' (result of index.toStringId).

Parameters:
NameTypeDescription
inputStrstring

The input string.

Returns:

The corresponding index (minimum size is 3D).

Type: 
Index

getItemDelimitationItemTag() → {Tag}

Get the ItemDelimitationItem Tag.

Returns:

The tag.

Type: 
Tag

getItemTag() → {Tag}

Get the Item Tag.

Returns:

The tag.

Type: 
Tag

getIteratorValues(iterator) → {Array}

Get a list of values for a given iterator.

Parameters:
NameTypeDescription
iteratorobject

The iterator to use to loop through data.

Returns:

The list of values.

Type: 
Array

getLPSGroup(code) → {string|undefined}

Get the LPS 'group' (axial, coronal or sagittal) from a LPS code.

Parameters:
NameTypeDescription
codestring

The LPS code string.

Returns:

The group.

Type: 
string | undefined

getLayerDetailsFromEvent(event) → {object}

Get the layer details from a mouse event.

Parameters:
NameTypeDescription
eventobject

The event to get the layer div id from. Expecting an event origininating from a canvas inside a layer HTML div with the 'layer' class and id generated with getLayerDivId.

Returns:

The layer details as {groupDivId, layerId}.

Type: 
object

getLayerDetailsFromLayerDivId(idString) → {object}

Get the layer details from a div id.

Parameters:
NameTypeDescription
idStringstring

The layer div id.

Returns:

The layer details as {groupDivId, layerId}.

Type: 
object

getLayerDivId(groupDivId, layerId) → {string}

Get the layer div id.

Parameters:
NameTypeDescription
groupDivIdstring

The layer group div id.

layerIdnumber

The lyaer id.

Returns:

A string id.

Type: 
string

getLayerGroupDivIds(dataViewConfigs) → {Array}

Get the layer groups div ids from the data view configs.

Parameters:
NameTypeDescription
dataViewConfigsobject

The configs.

Returns:

The list of ids.

Type: 
Array

getMPRDataViewConfig(dataIds) → {object}

Get MPR view config(s).

Parameters:
NameTypeDescription
dataIdsArray

The list of dataIds.

Returns:

The view config.

Type: 
object

getMatrixFromName(name) → {Matrix33|undefined}

Get an orientation matrix from a name.

Parameters:
NameTypeDescription
namestring

The orientation name.

Returns:

The orientation matrix.

Type: 
Matrix33 | undefined

getMatrixInverse(m) → {Matrix33|undefined}

Parameters:
NameTypeDescription
mMatrix33

The input matrix.

Returns:

The inverse matrix or undefined if the determinant is zero.

Type: 
Matrix33 | undefined

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

Get the meta data indexed by tag names instead of tag keys.

Parameters:
NameTypeDescription
metaDataObject.<string, DataElement>

The meta data index by tag keys.

Returns:

The meta data indexed by tag names.

Type: 
Object.<string, DataElement>

getMousePoint(event) → {Point2D}

Get the offset of an input mouse event.

Parameters:
NameTypeDescription
eventobject

The event to get the offset from.

Returns:

The 2D point.

Type: 
Point2D

getNumberToPrecision(precision) → {function}

Get a number toprecision function with the provided precision.

Parameters:
NameTypeDescription
precisionnumber

The precision to achieve.

Returns:

The to precision function.

Type: 
function

getObjectUrlFromTags(config) → {string}

Create an object url from (JSON) tags.

Parameters:
NameTypeDescription
configobject

The data configuration.

Returns:

The object URL.

Type: 
string

getOnInstancesLoad(seriesUID, numberOfSeries) → {function}

Get an instances QIDO query load handler.

Parameters:
NameTypeDescription
seriesUIDstring

The series UID.

numberOfSeriesnumber

The number of series.

Returns:

The hanlder.

Type: 
function

getOnLoadError(reqName) → {function}

Get a load error handler.

Parameters:
NameTypeDescription
reqNamestring

The request name.

Returns:

The error handler.

Type: 
function

getOnebyOneDataViewConfig(dataIds) → {object}

Create 1*2 view config(s).

Parameters:
NameTypeDescription
dataIdsArray

The list of dataIds.

Returns:

The view config.

Type: 
object

getOnebyTwoDataViewConfig(dataIds) → {object}

Create 1*2 view config(s).

Parameters:
NameTypeDescription
dataIdsArray

The list of dataIds.

Returns:

The view config.

Type: 
object

getOrientationFromCosines(cosines) → {Matrix33|undefined}

Get the orientation matrix associated to the direction cosines.

Parameters:
NameTypeDescription
cosinesArray.<number>

The direction cosines.

Returns:

The orientation matrix.

Type: 
Matrix33 | undefined

getOrientationMatrix(dataElements) → {Matrix33|undefined}

Get an orientation matrix from a dicom orientation element.

Parameters:
NameTypeDescription
dataElementsDataElements

The dicom element.

Returns:

The orientation matrix.

Type: 
Matrix33 | undefined

getOrientationName(orientation) → {string|undefined}

Get the name of an image orientation patient.

Parameters:
NameTypeDescription
orientationArray.<number>

The image orientation patient.

Returns:

The orientation name: axial, coronal or sagittal.

Type: 
string | undefined

getOrientationStringLPS(matrix) → {string}

Get the orientation code of an orientation matrix. Each letter defines the towards direction. Letters are: R (right), L (left), A (anterior), P (posterior), I (inferior) and S (superior).

Parameters:
NameTypeDescription
matrixMatrix33

The orientation matrix.

Returns:

The orientation code.

Type: 
string

getOrientedArray3D(array3D, orientation) → {Array.<number>}

Get the oriented values of an input 3D array.

Parameters:
NameTypeDescription
array3DArray.<number>

The 3D array.

orientationMatrix33

The orientation 3D matrix.

Returns:

The values reordered according to the orientation.

Type: 
Array.<number>

getPercentile(values, ratio) → {number}

Get an arrays' percentile. Uses linear interpolation for percentiles that lie between data points. See: https://en.wikipedia.org/wiki/Percentile (second variant interpolation).

Parameters:
NameTypeDescription
valuesArray.<number>

The sorted array of values.

rationumber

The percentile ratio [0-1].

Returns:

The percentile.

Type: 
number

getPerpendicularLine(line, point, length) → {object}

Get a perpendicular line to an input one.

Parameters:
NameTypeDescription
lineLine

The line to be perpendicular to.

pointPoint2D

The middle point of the perpendicular line.

lengthnumber

The length of the perpendicular line.

Returns:

A perpendicular line.

Type: 
object

getPixelDataTag() → {Tag}

Get the PixelData Tag.

Returns:

The tag.

Type: 
Tag

getPixelGeneratorName() → {string}

Returns:

The name of the selected pixel generator.

Type: 
string

getPixelSpacing(elements) → {Spacing}

Get the pixel spacing from the different spacing tags.

Parameters:
NameTypeDescription
elementsDataElements

The DICOM elements.

Returns:

The read spacing or the default [1,1].

Type: 
Spacing

getPixelUnit(elements) → {string|null}

Get the pixel data unit.

Parameters:
NameTypeDescription
elementsDataElements

The DICOM elements.

Returns:

The unit value if available.

Type: 
string | null

getPrecisionRound(precision) → {function}

Get a rounding function for a specific precision.

Parameters:
NameTypeDescription
precisionnumber

The rounding precision.

Returns:

The rounding function.

Type: 
function

getRegionSliceIterator(image, index, isRescaled, min, max) → {object}

Get a slice index iterator for a rectangular region.

Parameters:
NameTypeDescription
imageImage

The image to parse.

indexIndex

The current position.

isRescaledboolean

Flag for rescaled values (default false).

minPoint2D

The minimum position (optional).

maxPoint2D

The maximum position (optional).

Returns:

The slice iterator.

Type: 
object

getReverseOrientation(ori) → {string}

Get patient orientation label in the reverse direction.

Parameters:
NameTypeDescription
oristring

Patient Orientation value.

Returns:

Reverse Orientation Label.

Type: 
string

getRootPath(path) → {string}

Get the root of an input path. Splits using / as separator.

Parameters:
NameTypeDescription
pathstring

The input path.

Returns:

The input path without its last part.

Type: 
string

getRulesAndResult0(config) → {object}

Get writing rules #0 and resulting tags.

Parameters:
NameTypeDescription
configobject

A JSON config representing DICOM tags.

Returns:

Rules and resulting tags.

Type: 
object

getSagittalMat33() → {Matrix33}

Create a 3x3 sagittal (yzx) matrix.

Returns:

The sagittal matrix.

Type: 
Matrix33

getScaledOffset(offset, scale, newScale, center) → {Scalar2D}

Get a scaled offset to adapt to new scale and such as the input center stays at the same position.

Parameters:
NameTypeDescription
offsetScalar2D

The previous offset as {x,y}.

scaleScalar2D

The previous scale as {x,y}.

newScaleScalar2D

The new scale as {x,y}.

centerScalar2D

The scale center as {x,y}.

Returns:

The scaled offset as {x,y}.

Type: 
Scalar2D

getSegment(dataElements) → {MaskSegment}

Get a segment object from a dicom element.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The dicom element.

Returns:

A segment object.

Type: 
MaskSegment

getSegmentFrameInfo(dataElements) → {DicomSegmentFrameInfo}

Get a frame information object from a dicom element.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The dicom element.

Returns:

A frame information object.

Type: 
DicomSegmentFrameInfo

getSequenceDelimitationItemTag() → {Tag}

Get the SequenceDelimitationItem Tag.

Returns:

The tag.

Type: 
Tag

getShadowColour(hexColour) → {string}

Get the shadow colour of an input colour.

Parameters:
NameTypeDescription
hexColourstring

The colour (as '#ab01ef').

Returns:

The shadow colour (white or black).

Type: 
string

getShapeDisplayName(shape) → {string}

Get the display name of the input shape.

Parameters:
NameTypeDescription
shapeKonva.Shape

The Konva shape.

Returns:

The display name.

Type: 
string

getSliceGeometrySpacing(origins) → {number|undefined}

Get the slice spacing from the difference in the Z directions of input origins.

Parameters:
NameTypeDescription
originsArray.<Point3D>

An array of Point3D.

Returns:

The spacing.

Type: 
number | undefined

getSliceIndex(volumeGeometry, sliceGeometry) → {Index}

Get the slice index of an input slice into a volume geometry.

Parameters:
NameTypeDescription
volumeGeometryGeometry

The volume geometry.

sliceGeometryGeometry

The slice geometry.

Returns:

The index of the slice in the volume geomtry.

Type: 
Index

getSliceIterator(image, position, isRescaled, viewOrientation) → {object}

Get a slice index iterator.

Parameters:
NameTypeDescription
imageImage

The image to parse.

positionIndex

The current position.

isRescaledboolean

Flag for rescaled values (default false).

viewOrientationMatrix33

The view orientation.

Returns:

The slice iterator.

Type: 
object

getSpacingFromMeasure(dataElements) → {Spacing}

Get a spacing object from a dicom measure element.

Parameters:
NameTypeDescription
dataElementsDataElements

The dicom element.

Returns:

A spacing object.

Type: 
Spacing

getSpinY(event) → {number}

Get a normalised spin speed in the Y direction to try to support trackpads (small and large deltaY) and mouse wheel (large deltaY). Should return 1 or -1 for a single mouse wheel tick.

Parameters:
NameTypeDescription
eventobject

The wheel event.

Returns:

The normalised spin Y.

Type: 
number

getStats(values, flags) → {Statistics}

Get statistics on an input array of number. Note: could use https://github.com/tmcw/simple-statistics.

Parameters:
NameTypeDescription
valuesArray.<number>

The array of values to extract stats from.

flagsArray.<string>

A list of stat value names to calculate.

Returns:

A statistics object.

Type: 
Statistics

getSuvFactor(elements) → {object}

Parameters:
NameTypeDescription
elementsobject

The DICOM elements.

Returns:

The value and a warning if the elements are not as expected.

Type: 
object

getSyntaxDecompressionName(syntax) → {string}

Tell if a given syntax needs decompression.

Parameters:
NameTypeDescription
syntaxstring

The transfer syntax to test.

Returns:

The name of the decompression algorithm.

Type: 
string

getTagFromDictionary(tagName) → {Tag|undefined}

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

Parameters:
NameTypeDescription
tagNamestring

The tag string name.

Returns:

The tag object or null if not found.

Type: 
Tag | undefined

getTagFromKey(key) → {Tag}

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

Parameters:
NameTypeDescription
keystring

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

Returns:

The DICOM tag.

Type: 
Tag

getTagKeysReducer(dataElements) → {function}

Get an array reducer to reduce an array of tag keys taken from the input dataElements and return theses dataElements indexed by tag names.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The meta data index by tag keys.

Returns:

An array reducer.

Type: 
function

getTargetOrientation(imageOrientation, viewOrientation) → {Matrix33}

Get the target orientation according to an image and view orientation. The target orientation is used to go from target to real space.

Parameters:
NameTypeDescription
imageOrientationMatrix33

The image geometry.

viewOrientationMatrix33

The view orientation.

Returns:

The target orientation.

Type: 
Matrix33

getThumbInstanceUID(json) → {string}

Get the SOPInstanceUID of the thumbnail instance.

Parameters:
NameTypeDescription
jsonobject

An instances QIDO query result.

Returns:

The SOPInstanceUID.

Type: 
string

getTime(element) → {Object|undefined}

Get a time object with {hours, minutes, seconds} ready for the Date constructor from a DICOM element with vr=TM.

Parameters:
NameTypeDescription
elementobject

The DICOM element with date information.

Returns:

The time object.

Type: 
Object | undefined

getToken() → {string|undefined}

Get the optional token.

Returns:

The token.

Type: 
string | undefined

getTouchPoints(event) → {Array.<Point2D>}

Get the offsets of an input touch event.

Parameters:
NameTypeDescription
eventobject

The event to get the offset from.

Returns:

The array of points.

Type: 
Array.<Point2D>

getTouchesPositions(touches) → {Array.<Point2D>}

Get the positions (without the parent offset) of a list of touch events.

Parameters:
NameTypeDescription
touchesArray

The list of touch events.

Returns:

The list of positions of the touch events.

Type: 
Array.<Point2D>

getTransferSyntaxName(syntax) → {string}

Get a transfer syntax name from its UID.

Parameters:
NameTypeDescription
syntaxstring

The transfer syntax UID value.

Returns:

The transfer syntax name.

Type: 
string

getTransferSyntaxUIDTag() → {Tag}

Get the TransferSyntaxUID Tag.

Returns:

The tag.

Type: 
Tag

getTypedArray(bitsAllocated, pixelRepresentation, size) → {Uint8Array|Int8Array|Uint16Array|Int16Array|Uint32Array|Int32Array}

Get the appropriate TypedArray in function of arguments.

Parameters:
NameTypeDescription
bitsAllocatednumber

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

pixelRepresentationnumber

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

sizenumber

The size of the new array.

Returns:

The good typed array.

Type: 
Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array

getUID(tagName) → {string}

Parameters:
NameTypeDescription
tagNamestring

The input tag.

Returns:

The corresponding UID.

Type: 
string

getUint8ToVrValue(value, vr, isLittleEndianopt) → {object}

Get the casted typed array value from Uint8 to vr type.

Parameters:
NameTypeAttributesDescription
valueobject

The value to cast.

vrstring

The DICOM element VR.

isLittleEndianboolean<optional>

Flag to tell if the data is little or big endian (default: true).

Returns:

The element value casted to the vr type.

Type: 
object

getUriQuery(uri) → {object}

Get the query part, split into an array, of an input URI. The URI scheme is: base?query#fragment.

Parameters:
NameTypeDescription
uristring

The input URI.

Returns:

The query part, split into an array, of the input URI.

Type: 
object

getUrlFromUri(uri) → {URL}

Get an full object URL from a string uri.

Parameters:
NameTypeDescription
uristring

A string representing the url.

Returns:

A URL object.

Type: 
URL

getUtfLabel(charSetTerm) → {string}

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

References:

Parameters:
NameTypeDescription
charSetTermstring

The DICOM character set.

Returns:

The corresponding UTF label.

Type: 
string

getVariableRegionSliceIterator(image, index, isRescaled, regions) → {object|undefined}

Get a slice index iterator for a rectangular region.

Parameters:
NameTypeDescription
imageImage

The image to parse.

indexIndex

The current position.

isRescaledboolean

Flag for rescaled values (default false).

regionsArray.<Array.<Array.<number>>>

An array of [x, y] pairs (min, max).

Returns:

The slice iterator.

Type: 
object | undefined

getVectorStringLPS(vector) → {string}

Get the orientation code of an orientation vector. Credits: David Clunie, https://www.dclunie.com/medical-image-faq/html/part2.html.

Parameters:
NameTypeDescription
vectorVector3D

The orientation vector.

Returns:

The orientation code.

Type: 
string

getViewConfig(divId) → {object}

Get a full view for a given div id.

Parameters:
NameTypeDescription
divIdstring

The div id.

Returns:

The config.

Type: 
object

getViewFromDOMImage(domImage, origin, index) → {object}

Get data from an input image using a canvas.

Parameters:
NameTypeDescription
domImageHTMLImageElement

The DOM Image, an HTMLImageElement with extra info.

originstring | File

The data origin.

indexnumber

The data index.

Returns:

A load data event.

Type: 
object

getViewFromDOMVideo(video, onloaditem, onload, onprogress, onloadend, origin, dataIndex)

Get data from an input image using a canvas.

Parameters:
NameTypeDescription
videoobject

The DOM Video, an HTMLVideoElement with extra info.

onloaditemfunction

On load callback.

onloadobject

The function to call once the data is loaded.

onprogressobject

The function to call to report progress.

onloadendobject

The function to call to report load end.

originstring | File

The data origin.

dataIndexnumber

The data index.

getViewOrientation(imageOrientation, targetOrientation) → {Matrix33}

Get the view orientation according to an image and target orientation. The view orientation is used to go from target to image space.

Parameters:
NameTypeDescription
imageOrientationMatrix33

The image geometry.

targetOrientationMatrix33

The target orientation.

Returns:

The view orientation.

Type: 
Matrix33

getVrPad(vr) → {string}

Get the VR specific padding value.

Parameters:
NameTypeDescription
vrstring

The element VR.

Returns:

The value used to pad.

Type: 
string

getZeroIndex(size) → {Index}

Get an index with values set to 0 and the input size.

Parameters:
NameTypeDescription
sizenumber

The size of the index.

Returns:

The zero index.

Type: 
Index

gradDirection(gradX, gradY, px, py, qx, qy) → {number}

Compute the gradient direction.

Parameters:
NameTypeDescription
gradXArray

The X gradient.

gradYArray

The Y gradient.

pxnumber

The point X.

pynumber

The point Y.

qxnumber

The q X.

qynumber

The q Y.

Returns:

The direction.

Type: 
number

gradUnitVector(gradX, gradY, px, py, out)

Compute the gradient unit vector.

Parameters:
NameTypeDescription
gradXArray

The X gradient.

gradYArray

The Y gradient.

pxnumber

The point X.

pynumber

The point Y.

outobject

The result.

guessTransferSyntax(firstDataElement) → {DataElement}

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:
NameTypeDescription
firstDataElementDataElement

The first data element of the DICOM header.

Returns:

The transfer syntax data element.

Type: 
DataElement

guid() → {string}

Returns:

A unique ID.

Type: 
string

hasDicomPrefix(buffer) → {boolean}

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

Ref: DICOM File Meta.

Parameters:
NameTypeDescription
bufferArrayBuffer

The buffer to check.

Returns:

True if the buffer includes the prefix.

Type: 
boolean

hexToRgb(hexStr) → {RGB}

Convert a hex color into RGB.

Parameters:
NameTypeDescription
hexStrstring

The hex color as '#ab01ef'.

Returns:

The RGB values as {r,g,b}.

Type: 
RGB

id(i) → {number}

Identity, returns i.

Parameters:
NameTypeDescription
inumber

The input index.

Returns:

The lut value.

Type: 
number

imageDataToBuffer(imageData) → {Uint8Array}

Create a simple array buffer from an ImageData buffer.

Parameters:
NameTypeDescription
imageDataobject

The ImageData taken from a context.

Returns:

The image buffer.

Type: 
Uint8Array

includesFullStatsFlags(flags) → {boolean}

Does the input flag list contain a full stat element?

Parameters:
NameTypeDescription
flagsArray.<string>

A list of stat values to calculate.

Returns:

True if one of the flags is a full stat flag.

Type: 
boolean

invId(i) → {number}

Returns lut_range_max minus one minus i.

Parameters:
NameTypeDescription
inumber

The input index.

Returns:

The lut value.

Type: 
number

is32bitVLVR(vr) → {boolean}

Does the input Value Representation (VR) have a 32bit Value Length (VL).

Parameters:
NameTypeDescription
vrstring

The data Value Representation (VR).

Returns:

True if this VR has a 32-bit VL.

Type: 
boolean

isBigEndianTransferSyntax(syntax) → {boolean}

Tell if a given syntax is a big endian syntax.

Parameters:
NameTypeDescription
syntaxstring

The transfer syntax to test.

Returns:

True if a big endian syntax.

Type: 
boolean

isCharSetStringVR(vr) → {boolean}

Does the input Value Representation (VR) have an special character repertoire.

Parameters:
NameTypeDescription
vrstring

The data VR.

Returns:

True if this VR has a special char set.

Type: 
boolean

isDarkColour(hexColour) → {boolean}

Check if a colour given in hexadecimal format is dark.

Parameters:
NameTypeDescription
hexColourstring

The colour (as '#ab01ef').

Returns:

True if the colour is dark (brightness < 0.5).

Type: 
boolean

isEqualCode(code1, code2) → {boolean}

Check if two code objects are equal.

Parameters:
NameTypeDescription
code1DicomCode

The first code.

code2DicomCode

The second code.

Returns:

True if both codes are equal.

Type: 
boolean

isEqualRgb(c1, c2) → {boolean}

Check if two rgb objects are equal.

Parameters:
NameTypeDescription
c1RGB

The first colour.

c2RGB

The second colour.

Returns:

True if both colour are equal.

Type: 
boolean

isEqualSegment(seg1, seg2) → {boolean}

Check if two segment objects are equal.

Parameters:
NameTypeDescription
seg1MaskSegment

The first segment.

seg2MaskSegment

The second segment.

Returns:

True if both segment are equal.

Type: 
boolean

isEqualSegmentFrameInfo(dsfi1, dsfi2) → {boolean}

Check if two frame info objects are equal.

Parameters:
NameTypeDescription
dsfi1DicomSegmentFrameInfo

The first frame info.

dsfi2DicomSegmentFrameInfo

The second frame info.

Returns:

True if both frame info are equal.

Type: 
boolean

isEven(number) → {boolean}

Return true if the input number is even.

Parameters:
NameTypeDescription
numbernumber

The number to check.

Returns:

True is the number is even.

Type: 
boolean

isFileMetaInformationGroupLengthTag(tag) → {boolean}

Is the input tag the FileMetaInformationGroupLength Tag.

Parameters:
NameTypeDescription
tagTag

The tag to test.

Returns:

True if the asked tag.

Type: 
boolean

isIdentityMat33(mat33) → {boolean}

Check if a matrix is a 3x3 identity matrix.

Parameters:
NameTypeDescription
mat33Matrix33

The matrix to test.

Returns:

True if identity.

Type: 
boolean

isImplicitTransferSyntax(syntax) → {boolean}

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

Parameters:
NameTypeDescription
syntaxstring

The transfer syntax to test.

Returns:

True if an implicit syntax.

Type: 
boolean

isItemDelimitationItemTag(tag) → {boolean}

Is the input tag the ItemDelimitationItem Tag.

Parameters:
NameTypeDescription
tagTag

The tag to test.

Returns:

True if the asked tag.

Type: 
boolean

isItemTag(tag) → {boolean}

Is the input tag the Item Tag.

Parameters:
NameTypeDescription
tagTag

The tag to test.

Returns:

True if the asked tag.

Type: 
boolean

isJpeg2000TransferSyntax(syntax) → {boolean}

Tell if a given syntax is a JPEG 2000 one.

Parameters:
NameTypeDescription
syntaxstring

The transfer syntax to test.

Returns:

True if a jpeg 2000 syntax.

Type: 
boolean

isJpegBaselineTransferSyntax(syntax) → {boolean}

Tell if a given syntax is a JPEG baseline one.

Parameters:
NameTypeDescription
syntaxstring

The transfer syntax to test.

Returns:

True if a jpeg baseline syntax.

Type: 
boolean

isJpegLosslessTransferSyntax(syntax) → {boolean}

Tell if a given syntax is a JPEG Lossless one.

Parameters:
NameTypeDescription
syntaxstring

The transfer syntax to test.

Returns:

True if a jpeg lossless syntax.

Type: 
boolean

isKnownVR(vr) → {boolean}

Is the input VR a known VR.

Parameters:
NameTypeDescription
vrstring

The vr to test.

Returns:

True if known.

Type: 
boolean

isNativeLittleEndian() → {boolean}

Is the Native endianness Little Endian.

Returns:

True if little endian.

Type: 
boolean

isNodeNameLabel(node) → {boolean}

Is an input node's name 'label'.

Parameters:
NameTypeDescription
nodeKonva.Node

A Konva node.

Returns:

True if the node's name is 'label'.

Type: 
boolean

isNodeNameShape(node) → {boolean}

Is an input node's name 'shape'.

Parameters:
NameTypeDescription
nodeKonva.Node

A Konva node.

Returns:

True if the node's name is 'shape'.

Type: 
boolean

isNodeNameShapeExtra(node) → {boolean}

Is a node an extra shape associated with a main one.

Parameters:
NameTypeDescription
nodeKonva.Node

A Konva node.

Returns:

True if the node's name starts with 'shape-'.

Type: 
boolean

isNodeWithId(id) → {testFn}

Get a lambda to check a node's id.

Parameters:
NameTypeDescription
idstring

The id to check.

Returns:

A function to check a node's id.

Type: 
testFn

isPixelDataTag(tag) → {boolean}

Is the input tag the PixelData Tag.

Parameters:
NameTypeDescription
tagTag

The tag to test.

Returns:

True if the asked tag.

Type: 
boolean

isPositionNode(node) → {boolean}

Is an input node a position node.

Parameters:
NameTypeDescription
nodeKonva.Node

A Konva node.

Returns:

True if the node's name is 'position-group'.

Type: 
boolean

isReadSupportedTransferSyntax(syntax) → {boolean}

Tell if a given syntax is supported for reading.

Parameters:
NameTypeDescription
syntaxstring

The transfer syntax to test.

Returns:

True if a supported syntax.

Type: 
boolean

isRleTransferSyntax(syntax) → {boolean}

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

Parameters:
NameTypeDescription
syntaxstring

The transfer syntax to test.

Returns:

True if a RLE syntax.

Type: 
boolean

isSequenceDelimitationItemTag(tag) → {boolean}

Is the input tag the SequenceDelimitationItem Tag.

Parameters:
NameTypeDescription
tagTag

The tag to test.

Returns:

True if the asked tag.

Type: 
boolean

isSimilar(a, b, tol) → {boolean}

Check if two numbers are similar.

Parameters:
NameTypeDescription
anumber

The first number.

bnumber

The second number.

tolnumber

The comparison tolerance, default to Number.EPSILON.

Returns:

True if similar.

Type: 
boolean

isSimilarSegment(seg1, seg2) → {boolean}

Check if two segment objects are similar: either the number or the displayValue are equal.

Parameters:
NameTypeDescription
seg1MaskSegment

The first segment.

seg2MaskSegment

The second segment.

Returns:

True if both segment are similar.

Type: 
boolean

isStringVr(vr) → {boolean}

Is the input VR a string VR.

Parameters:
NameTypeDescription
vrstring

The element VR.

Returns:

True if the VR is a string one.

Type: 
boolean

isTypedArrayVr(vr) → {boolean}

Is the input VR a VR that stores data in a typed array. TODO: include ox and xs?

Parameters:
NameTypeDescription
vrstring

The element VR.

Returns:

True if the VR is a typed array one.

Type: 
boolean

isValidRules() → {boolean}

Is the JSON valid?

Returns:

True if the input JSON is valid.

Type: 
boolean

isValidTags() → {boolean}

Is the JSON valid?

Returns:

True if the tags are a valid JSON.

Type: 
boolean

isVrToPad(vr) → {boolean}

Is the input VR a VR that could need padding.

See http://dicom.nema.org/medical/dicom/2022a/output/chtml/part05/sect_6.2.html.

Parameters:
NameTypeDescription
vrstring

The element VR.

Returns:

True if the VR needs padding.

Type: 
boolean

labToUintLab(triplet) → {object}

CIE LAB value (L: [0, 100], a: [-128, 127], b: [-128, 127]) to unsigned int CIE LAB ([0, 65535]).

Parameters:
NameTypeDescription
tripletobject

CIE XYZ triplet as {l,a,b} with CIE LAB range.

Returns:

CIE LAB triplet as {l,a,b} with unsigned range.

Type: 
object

launchJSONLint()

Open JSONLint to check the rules.

launchJSONLint()

Open JSONLint to check the tags.

launchMainQido()

Launch main QIDO query to retrieve series.

launchQido(url, loadCallback, reqName)

Launch a QIDO request.

Parameters:
NameTypeDescription
urlstring

The url of the request.

loadCallbackfunction

The load callback.

reqNamestring

The request name.

launchStowInstances()

Launch a STOW request per instances.

launchStowMultipart()

Launch a STOW request with multipart data. Beware: large request could timeout...

logFramePosPats(elements)

Log the DICCOM seg segments ordered by frame position patients.

Parameters:
NameTypeDescription
elementsobject

The DICOM seg elements.

mergeDataConfig(dataId, config) → {object}

Merge an app data config into the input one. Copies all but the divId and orientation property.

Parameters:
NameTypeDescription
dataIdstring

The data id.

configobject

The view config.

Returns:

The update config.

Type: 
object

mergeObjects(obj1, obj2, idKey, valueKey) → {object}

Merge two similar objects.

Objects need to be in the form of: { idKey: {valueKey: [0]}, key0: {valueKey: ["abc"]}, key1: {valueKey: [33]} }.

Merged objects will be in the form of: { idKey: {valueKey: [0,1,2], merged: true}, key0: {valueKey: { 0: ["abc"], 1: ["def"], 2: ["ghi"] }}, key1: {valueKey: { 0: [33], 1: [44], 2: [55] }} }.

Parameters:
NameTypeDescription
obj1object

The first object, can be the result of a previous merge.

obj2object

The second object.

idKeystring

The key to use as index for duplicate values.

valueKeystring

The key to use to access object values.

Returns:

The merged object.

Type: 
object

mergeTags(tags1, tags2)

Merge two tag lists.

Parameters:
NameTypeDescription
tags1object

Base list, will be modified.

tags2object

List to merge.

mprCheckTags(tags, image) → {boolean}

Check tags are coherent with image size.

Parameters:
NameTypeDescription
tagsobject

The tags to check.

imageobject

The associated image.

Returns:

True if the tags are ok.

Type: 
boolean

mulABC(a, b, c) → {number}

Mulitply the three inputs if the last two are not null.

Parameters:
NameTypeDescription
anumber

The first input.

bnumber

The second input.

cnumber

The third input.

Returns:

The multiplication of the three inputs or null if one of the last two is null.

Type: 
number

mulABC(a, b, c) → {number}

Mulitply the three inputs if the last two are not null.

Parameters:
NameTypeDescription
anumber

The first input.

bnumber

The second input.

cnumber

The third input.

Returns:

The multiplication of the three inputs or null if one of the last two is null.

Type: 
number

mulABC(a, b, c) → {number}

Mulitply the three inputs if the last two are not null.

Parameters:
NameTypeDescription
anumber

The first input.

bnumber

The second input.

cnumber

The third input.

Returns:

The multiplication of the three inputs or null if one of the last two is null.

Type: 
number

onChangeParsers(input)

Handle a parser change.

Parameters:
NameTypeDescription
inputobject

The new parser.

onChangeTests(input)

Handle a parser test change.

Parameters:
NameTypeDescription
inputobject

The new test.

onDOMContentLoaded()

Setup.

onDOMContentLoaded()

Setup.

onDOMContentLoaded()

Setup.

onDOMContentLoaded()

Setup.

onDOMContentLoaded()

Setup.

onDOMContentLoaded()

Setup.

onDOMContentLoaded()

Setup.

onGenerate()

Generate DICOM data.

onInputDICOMFile(event)

Handle input DICOM file.

Parameters:
NameTypeDescription
eventobject

The input field event.

onInputImageFiles(event)

Handle input image file.

Parameters:
NameTypeDescription
eventobject

The input field event.

onInputRulesFile(event)

Handle input rules file.

Parameters:
NameTypeDescription
eventobject

The input field event.

onInputTagsFile(event)

Handle input tags file.

Parameters:
NameTypeDescription
eventobject

The input field event.

onLoadDICOMFile(event)

Handle DICOM file load.

Parameters:
NameTypeDescription
eventobject

The onload event.

onLocalChkChange()

Update dicom links on checkbox change.

onOpacityChange(event)

Handle app opacity change.

Parameters:
NameTypeDescription
eventobject

The change event.

onSaveTags()

Save the tags as a JSON file.

onSeriesLoad(json)

Handle a series QIDO query load.

Parameters:
NameTypeDescription
jsonArray

JSON array data.

onViewGithubHosted()

Handle click on the view github hosted button.

onWLChange(event)

Handle app wl change.

Parameters:
NameTypeDescription
eventobject

The change event.

padOBValue(value) → {Array|Uint8Array}

Pad an input OB value.

Parameters:
NameTypeDescription
valueArray | Uint8Array

The input value.

Returns:

The padded input.

Type: 
Array | Uint8Array

padZeroTwoDigit(str) → {string}

Pad an input string with a '0' to form a 2 digit one.

Parameters:
NameTypeDescription
strstring

The string to pad.

Returns:

The padded string.

Type: 
string

parseMultipart(arr) → {Array}

Extract each element of a multipart ArrayBuffer.

Ref: https://en.wikipedia.org/wiki/MIME#Multipart_messages.

Parameters:
NameTypeDescription
arrArrayBuffer

The multipart array.

Returns:

The multipart parts as an array of object as {'Content-Type', ..., data} (depending on header tags).

Type: 
Array

precisionRound(number, precision) → {number}

Round a float number to a given precision.

Inspired from https://stackoverflow.com/a/49729715/3639892.

Can be a solution to not have trailing zero as when using toFixed or toPrecision. '+number.toFixed(precision)' does not pass all the tests...

Parameters:
NameTypeDescription
numbernumber

The number to round.

precisionnumber

The rounding precision.

Returns:

The rounded number.

Type: 
number

qidoResponseToTable()

Show the QIDO response as a table.

range(dataAccessor, start, maxIter, increment, blockMaxIter, blockIncrement, reverse1, reverse2) → {object}

Get an iterator for a given range for a one component data.

Using 'maxIter' and not an 'end' index since it fails in some edge cases (for ex coronal2, ie zxy).

Parameters:
NameTypeDescription
dataAccessorfunction

Function to access data.

startnumber

Zero-based index at which to start the iteration.

maxIternumber

The maximum number of iterations.

incrementnumber

Increment between indicies.

blockMaxIternumber

Number of applied increment after which blockIncrement is applied.

blockIncrementnumber

Increment after blockMaxIter is reached, the value is from block start to the next block start.

reverse1boolean

If true, loop from end to start. WARN: don't forget to set the value of start as the last index!

reverse2boolean

If true, loop from block end to block start.

Returns:

An iterator folowing the iterator and iterable protocol.

Type: 
object

range3d(dataAccessor, start, maxIter, increment, blockMaxIter, blockIncrement, reverse1, reverse2, isPlanar) → {object}

Get an iterator for a given range for a 3 components data.

Using 'maxIter' and not an 'end' index since it fails in some edge cases (for ex coronal2, ie zxy).

Parameters:
NameTypeDescription
dataAccessorfunction

Function to access data.

startnumber

Zero-based index at which to start the iteration.

maxIternumber

The maximum number of iterations.

incrementnumber

Increment between indicies.

blockMaxIternumber

Number of applied increment after which blockIncrement is applied.

blockIncrementnumber

Increment after blockMaxIter is reached, the value is from block start to the next block start.

reverse1boolean

If true, loop from end to start. WARN: don't forget to set the value of start as the last index!

reverse2boolean

If true, loop from block end to block start.

isPlanarboolean

A flag to know if the data is planar (RRRR...GGGG...BBBB...) or not (RGBRGBRGBRGB...), defaults to false.

Returns:

An iterator folowing the iterator and iterable protocol.

Type: 
object

rangeRegion(dataAccessor, start, end, increment, regionSize, regionOffset) → {object}

Get an iterator for a given range with bounds (for a one component data).

Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols.

Parameters:
NameTypeDescription
dataAccessorfunction

Function to access data.

startnumber

The start of the range (included).

endnumber

The end of the range (excluded).

incrementnumber

The increment between indicies.

regionSizenumber

The size of the region to iterate through.

regionOffsetnumber

The offset between regions.

Returns:

An iterator folowing the iterator and iterable protocol.

Type: 
object

rangeRegions(dataAccessor, start, end, increment, regions) → {object}

Get an iterator for a given range with bounds (for a one component data).

Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols.

Parameters:
NameTypeDescription
dataAccessorfunction

Function to access data.

startnumber

The start of the range (included).

endnumber

The end of the range (excluded).

incrementnumber

The increment between indicies.

regionsArray.<Array.<number>>

An array of regions: [off0, size, off1].

Returns:

An iterator folowing the iterator and iterable protocol.

Type: 
object

replaceFlags(inputStr, values) → {string}

Replace flags in a input string. Flags are keywords surrounded with curly braces in the form: '{v0}, {v1}'.

Parameters:
NameTypeDescription
inputStrstring

The input string.

valuesArray.<string>

An array of strings.

Returns:

The result string.

Type: 
string
Example
var values = ["a", "b"];
   var str = "The length is: {v0}. The size is: {v1}";
   var res = replaceFlags(str, values);
   // "The length is: a. The size is: b"

replaceFlags(inputStr, values) → {string}

Replace flags in a input string. Flags are keywords surrounded with curly braces.

Parameters:
NameTypeDescription
inputStrstring

The input string.

valuesobject

A object of {value, unit}.

Returns:

The result string.

Type: 
string

rgbToHex(rgb) → {string}

Convert RGB to its hex equivalent.

Parameters:
NameTypeDescription
rgbRGB

The RGB object as {r,g,b}.

Returns:

A string representing the hex color as '#ab01ef'.

Type: 
string

runIterator(iter) → {Array}

Run an input iterator and store values.

Parameters:
NameTypeDescription
iterobject

The iterator.

Returns:

The result array.

Type: 
Array

runRenderTest()

Run render tests.

saveRules()

Save the rules as a JSON file.

setAppTool(toolNameopt)

Set the app tool.

Parameters:
NameTypeAttributesDescription
toolNamestring<optional>

The tool to set.

setupAbout()

Setup about line.

setupBindersCheckboxes()

Setup the binders checkboxes.

setupData()

Setup the data.

setupParsers()

Setup the parsers.

setupTests()

Setup the tests.

setupTests()

Setup test line.

setupToolsCheckboxes()

Setup the tools checkboxes.

showMessage(text, typeopt)

Show a message.

Parameters:
NameTypeAttributesDescription
textstring

The text message.

typestring<optional>

The message type used as css class.

showProgress(text)

Show a progress message.

Parameters:
NameTypeDescription
textstring

The text message.

simpleRange(dataAccessor, start, end, incrementopt) → {object}

Get an simple iterator for a given range for a one component data.

Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols.

Parameters:
NameTypeAttributesDescription
dataAccessorfunction

Function to access data.

startnumber

The start of the range (included).

endnumber

The end of the range (excluded).

incrementnumber<optional>

The increment between indicies (default=1).

Returns:

An iterator folowing the iterator and iterable protocol.

Type: 
object

simpleRange3d(dataAccessor, start, end, increment, isPlanar) → {object}

Get an iterator for a given range for a 3 components data.

Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols.

Parameters:
NameTypeDescription
dataAccessorfunction

Function to access data.

startnumber

The start of the range (included).

endnumber

The end of the range (excluded). (end - start) needs to be a multiple of 3...

incrementnumber

The increment between indicies (default=1).

isPlanarboolean

A flag to know if the data is planar (RRRR...GGGG...BBBB...) or not (RGBRGBRGBRGB...), defaults to false.

Returns:

A 3 components iterator folowing the iterator and iterable protocol, the value is an array of size 3 with each component.

Type: 
object

sortByPosPatKey(obj) → {object}

Sort an object with pos pat string keys.

Parameters:
NameTypeDescription
objobject

The object to sort.

Returns:

The sorted object.

Type: 
object

splitKeyValueString(inputStr) → {object}

Split key/value string: key0=val00&key0=val01&key1=val10 will return{key0 : [val00, val01], key1 : val1}`.

Parameters:
NameTypeDescription
inputStrstring

The string to split.

Returns:

The split string.

Type: 
object

splitUri(uri) → {object}

Split an input URI: 'root?key0=val00&key0=val01&key1=val10' returns { base : root, query : [ key0 : [val00, val01], key1 : val1 ] } Returns an empty object if the input string is not correct (null, empty...) or if it is not a query string (no question mark).

Parameters:
NameTypeDescription
uristring

The string to split.

Returns:

The split string.

Type: 
object

srgbToCielab(triplet) → {object}

Convert sRGB to CIE LAB (standard illuminant D65).

Parameters:
NameTypeDescription
tripletRGB

'sRGB' triplet as {r,g,b}.

Returns:

CIE LAB triplet as {l,a,b}.

Type: 
object

srgbToCiexyz(triplet) → {Scalar3D}

Parameters:
NameTypeDescription
tripletRGB

'sRGB' triplet as {r,g,b}.

Returns:

CIE XYZ triplet as {x,y,z}.

Type: 
Scalar3D

startsWith(str, search, rawPosopt) → {boolean}

Check if a string starts with the input element.

Parameters:
NameTypeAttributesDescription
strstring

The input string.

searchstring

The searched start.

rawPosnumber<optional>

The position in this string at which to begin searching for searchString. Defaults to 0.

Returns:

True if the input string starts with the searched string.

Type: 
boolean

stringToUint8Array(str) → {Uint8Array}

Convert a string to a Uint8Array.

Parameters:
NameTypeDescription
strstring

The string to convert.

Returns:

The Uint8Array.

Type: 
Uint8Array

tagCompareFunction(a, b) → {number}

Tag compare function.

Parameters:
NameTypeDescription
aTag

The first tag.

bTag

The second tag.

Returns:

The result of the tag comparison, positive for b before a, negative for a before b and zero to keep same order.

Type: 
number

testSegment(segment, assert, testName)

MaskSegment test: translate to element and back.

Parameters:
NameTypeDescription
segmentobject

The segment as an object.

assertobject

The QUnit assert.

testNamestring

The test name.

testSegmentFrameInfo(frameInfo, assert, testName)

SegmentFrameInfo test: translate to element and back.

Parameters:
NameTypeDescription
frameInfoobject

The frameInfo as an object.

assertobject

The QUnit assert.

testNamestring

The test name.

testWriteReadDataFromConfig(config, assert, writerRulesopt, outConfigopt)

Test a JSON config: write a DICOM file and read it back.

Parameters:
NameTypeAttributesDescription
configobject

A JSON config representing DICOM tags.

assertobject

A Qunit assert.

writerRulesObject.<string, WriterRule><optional>

Optional DICOM writer rules.

outConfigobject<optional>

Optional resulting JSON after applying writer rules.

toMaxFirstThird(i) → {number}

Ramp to lut_range_max minus one on the first third values.

Parameters:
NameTypeDescription
inumber

The input index.

Returns:

The lut value.

Type: 
number

toMaxSecondThird(i) → {number}

Ramp to lut_range_max minus one on the second third values, otherwise return 0 for the first third and lut_range_max minus one for the last third.

Parameters:
NameTypeDescription
inumber

The input index.

Returns:

The lut value.

Type: 
number

toMaxThirdThird(i) → {number}

Ramp to lut_range_max minus one on the last third values, otherwise return 0.

Parameters:
NameTypeDescription
inumber

The input index.

Returns:

The lut value.

Type: 
number

uint8ArrayPush(arr, value) → {Uint8Array}

Push a value at the end of an input Uint8Array.

Parameters:
NameTypeDescription
arrArray | Uint8Array

The input array.

valueArray | Uint8Array

The value to push.

Returns:

The new array.

Type: 
Uint8Array

uint8ArrayToString(arr) → {string}

Convert a Uint8Array to a string.

Parameters:
NameTypeDescription
arrUint8Array

The array to convert.

Returns:

The array as string.

Type: 
string

uintLabToLab(triplet) → {object}

Unsigned int CIE LAB value ([0, 65535]) to CIE LAB value (L: [0, 100], a: [-128, 127], b: [-128, 127]).

Parameters:
NameTypeDescription
tripletobject

CIE LAB triplet as {l,a,b} with unsigned range.

Returns:

CIE LAB triplet as {l,a,b} with CIE LAB range.

Type: 
object

unbindAppToControls()

Unbind app to controls.

updateDataList(datalist)

Update the data list of the data runner.

Parameters:
NameTypeDescription
datalistArray

The new data list.

v01Tov02DrawingsAndDetails(inputDrawings) → {object}

Convert drawings from v0.1 to v0.2:

  • v0.1: text on its own,
  • v0.2: text as part of label.
Parameters:
NameTypeDescription
inputDrawingsArray

An array of drawings.

Returns:

The converted drawings.

Type: 
object

v02Tov03Drawings(drawings) → {object}

Convert drawings from v0.2 to v0.3:

  • v0.2: one layer per slice/frame,
  • v0.3: one layer, one group per slice. setDrawing expects the full stage.
Parameters:
NameTypeDescription
drawingsArray

An array of drawings.

Returns:

The layer with the converted drawings.

Type: 
object

v02Tov03DrawingsDetails(details) → {object}

Convert drawing details from v0.2 to v0.3:

  • v0.2: array [nslices][nframes] with all,
  • v0.3: simple array of objects referenced by draw ids.
Parameters:
NameTypeDescription
detailsArray

An array of drawing details.

Returns:

The converted drawings.

Type: 
object

v03Tov04DrawingsDetails(details) → {object}

Convert drawing details from v0.3 to v0.4:

  • v0.3: properties at group root,
  • v0.4: properties in group meta object.
Parameters:
NameTypeDescription
detailsArray

An array of drawing details.

Returns:

The converted drawings.

Type: 
object

v04Tov05Data(data) → {object}

Convert drawing from v0.4 to v0.5:

  • v0.4: position as object,
  • v0.5: position as array.
Parameters:
NameTypeDescription
dataobject

An array of drawing.

Returns:

The converted drawings.

Type: 
object

v04Tov05Drawings(inputDrawings) → {object}

Convert drawing from v0.4 to v0.5:

  • v0.4: draw id as 'slice-0_frame-1',
  • v0.5: draw id as '#2-0_#3-1'.
Parameters:
NameTypeDescription
inputDrawingsobject

An array of drawing.

Returns:

The converted drawings.

Type: 
object

validateAnchorPosition(stageSize, anchor) → {boolean}

Validate an anchor position.

Parameters:
NameTypeDescription
stageSizeScalar2D

The stage size {x,y}.

anchorKonva.Shape

The anchor to evaluate.

Returns:

True if the position was corrected.

Type: 
boolean

validateGroupPosition(stageSize, group) → {boolean}

Validate a group position.

Parameters:
NameTypeDescription
stageSizeScalar2D

The stage size {x,y}.

groupKonva.Group

The group to evaluate.

Returns:

True if the position was corrected.

Type: 
boolean

validateWindowWidth(value) → {number}

Validate an input window width.

Parameters:
NameTypeDescription
valuenumber

The value to test.

Returns:

A valid window width.

Type: 
number

viewerSetup()

Setup simple dwv app.

ybrToRgb(y, cb, cr) → {RGB}

Parameters:
NameTypeDescription
ynumber

The Y component.

cbnumber

The Cb component.

crnumber

The Cr component.

Returns:

RGB equivalent as {r,g,b}.

Type: 
RGB

Type Definitions

DataElements

Type:

DataElements

List of DICOM data elements indexed via a 8 character string formed from the group and element numbers.

Type:

DataElements

Type:

DataElements

Type:

DataViewConfigs

List of ViewConfigs indexed by dataIds.

Type:

TypedArray

List of compatible typed arrays.

Type:
  • Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array

alphaFn(value, index) → {number}

Parameters:
NameTypeDescription
valueArray.<number> | number

The pixel value.

indexnumber

The values' index.

Returns:

The opacity of the input value.

Type: 
number

alphaFn(value, index) → {number}

Parameters:
NameTypeDescription
valueArray.<number> | number

The pixel value.

indexnumber

The values' index.

Returns:

The opacity of the input value.

Type: 
number

alphaFn(value, index) → {number}

Parameters:
NameTypeDescription
valueArray.<number> | number

The pixel value.

indexnumber

The values' index.

Returns:

The opacity of the input value.

Type: 
number

compareFn(a, b) → {number}

Parameters:
NameTypeDescription
aobject

The first object.

bobject

The first object.

Returns:

0 to sort a after b, <0 to sort a before b, 0 to not change order.

Type: 
number

eventFn(event)

Parameters:
NameTypeDescription
eventobject

The event.

eventFn(event)

Parameters:
NameTypeDescription
eventobject

The event.

eventFn(event)

Parameters:
NameTypeDescription
eventobject

The event.

eventFn(event)

Parameters:
NameTypeDescription
eventobject

The event.

testFn(node) → {boolean}

Parameters:
NameTypeDescription
nodeKonva.Node

The node.

Returns:

True if the node passes the test.

Type: 
boolean