Members

(constant) DRAW_DEBUG

Draw Debug flag.

(constant) InteractionEventNames

List of interaction event names.

(constant) RequiredDicomSegTags

List of DICOM Seg required tags.

(constant) binderList

List of binders.

(constant) customUI

Overridalbe custom UI object for client defined UI.

(constant) d65

CIE Standard Illuminant D65, standard 2° observer.

(constant) decoderScripts

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

(constant) defaultArrowLabelText

Default draw label text.

(constant) defaultCircleLabelText

Default draw label text.

(constant) defaultEllipseLabelText

Default draw label text.

(constant) defaultFreeHandLabelText

Default draw label text.

(constant) defaultPresets :Object.<string, Object.<string, {center: number, width: number}>>

List of default window level presets.

Type:
  • Object.<string, Object.<string, {center: number, width: number}>>

(constant) defaultProtractorLabelText

Default draw label text.

(constant) defaultRectangleLabelText

Default draw label text.

(constant) defaultRoiLabelText

Default draw label text.

(constant) defaultRulerLabelText

Default draw label text.

(constant) dictionary

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'

(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

Minimum window width value.

(constant) viewEventNames :Array

List of view event names.

Type:
  • Array

Methods

addDataRow(id)

Add a data row.

Parameters:
NameTypeDescription
idnumber

The data index.

addLayerGroup(id)

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

Parameters:
NameTypeDescription
idstring

The id of the layer.

addTagsToDictionary(group, tags)

Add tags to the dictionary.

Parameters:
NameTypeDescription
groupstring

The group key.

tagsobject

The tags to add.

arrayEquals(arr0, arr1) → {boolean}

Check for array equality.

Parameters:
NameTypeDescription
arr0Array

First array.

arr1*

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.

arr1*

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
nodeobject

The node to bound the position.

minobject

The minimum position as {x,y}.

maxobject

The maximum position as {x,y}.

Returns:

True if the position was corrected.

Type: 
boolean

buildLut(func) → {Array}

Build a LUT of size lut_range_max.

Parameters:
NameTypeDescription
funcfunction

The i to lut function.

Returns:

The LUT.

Type: 
Array

buildMultipart(parts, boundary) → {Uint8Array}

Build a multipart message. See: https://en.wikipedia.org/wiki/MIME#Multipart_messages See: https://hg.orthanc-server.com/orthanc-dicomweb/file/tip/Resources/Samples/JavaScript/stow-rs.js

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}

Test if a canvas with the input size can be created.

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
nodeobject

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

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.

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(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

checkUnknownVR(element)

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

Parameters:
NameTypeDescription
elementDataElement

The DICOM element.

cielabToCiexyz(triplet) → {object}

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

Parameters:
NameTypeDescription
tripletobject

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

Returns:

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

Type: 
object

cielabToSrgb(triplet) → {object}

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: 
object

ciexyzToCielab(triplet) → {object}

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

Parameters:
NameTypeDescription
tripletobject

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

Returns:

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

Type: 
object

ciexyzToSrgb(triplet) → {object}

Convert CIE XYZ to sRGB.

Parameters:
NameTypeDescription
tripletobject

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

Returns:

sRGB triplet as {r,g,b}.

Type: 
object

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.

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}

Parameters:
NameTypeDescription
greyscaleobject

The input greyscale-

Returns:

A gradient object

Type: 
object

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

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.

createImage(elements) → {Image}

Create an Image from DICOM elements.

Parameters:
NameTypeDescription
elementsobject

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

The DICOM elements.

Returns:

The mask Image object.

Type: 
Image

createView(elements, image) → {View}

Create a View from DICOM elements and image.

Parameters:
NameTypeDescription
elementsobject

The DICOM elements.

imageImage

The associated image.

Returns:

The View object.

Type: 
View

decodeKeyValueUri(uri, replaceMode) → {Array}

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. replaceMode 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

decodeManifest(manifest, nslices) → {Array}

Decode an XML manifest.

Parameters:
NameTypeDescription
manifestobject

The manifest to decode.

nslicesnumber

The number of slices to load.

Returns:

The decoded manifest.

Type: 
Array

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

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

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) → {object|undefined}

Get the minimum position in a groups' anchors.

Parameters:
NameTypeDescription
groupobject

The group that contains anchors.

Returns:

The minimum position as {x,y}.

Type: 
object | 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

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(rgbTriplet) → {number}

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

Parameters:
NameTypeDescription
rgbTripletobject

RGB triplet.

Returns:

The brightness ([0,1]).

Type: 
number

getCode(dataElements) → {object}

Get a code object from a dicom element.

Parameters:
NameTypeDescription
dataElementsDataElements

The dicom element.

Returns:

A code object.

Type: 
object

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, i.e. without its value.

Parameters:
NameTypeDescription
vrstring

The Value Representation of the element.

isImplicitboolean

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

getDataLayerGroupIds(dataViewConfig) → {Array}

Get the layer group ids associated to a data.

Parameters:
NameTypeDescription
dataViewConfigArray

The data view config.

Returns:

The list of 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}

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

Parameters:
NameTypeDescription
array3DArray

The 3D array.

orientationMatrix33

The orientation 3D matrix.

Returns:

The values reordered to compensate the orientation.

Type: 
Array

getDefaultAnchor(x, y, id, style) → {object}

Get the default anchor shape.

Parameters:
NameTypeDescription
xnumber

The X position.

ynumber

The Y position.

idstring

The shape id.

styleobject

The application style.

Returns:

The default anchor shape.

Type: 
object

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

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

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

getElement(containerDivId, name) → {object}

Get a HTML element associated to a container div.

Parameters:
NameTypeDescription
containerDivIdstring

The id of the container div.

namestring

The name or id to find.

Deprecated
  • Yes
Returns:

The found element or null.

Type: 
object

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

Get the DICOM elements from a 'simple' DICOM json tags object. The json 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
jsonTagsObject.<string, any>

The DICOM json tags object.

Returns:

The DICOM elements.

Type: 
Object.<string, DataElement>

getEllipseIndices(center, radius, dir) → {Array}

Get the indices that form a ellpise.

Parameters:
NameTypeDescription
centerIndex

The ellipse center.

radiusArray

The 2 ellipse radiuses.

dirArray

The 2 ellipse directions.

Returns:

The indices of the ellipse.

Type: 
Array

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

getEventOffset(event) → {Array}

Get the offset of an input event.

Parameters:
NameTypeDescription
eventobject

The event to get the offset from.

Returns:

The array of offsets.

Type: 
Array

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}

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

getFullStats(array) → {object}

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

Parameters:
NameTypeDescription
arrayArray

The array of values to extract stats from.

Returns:

A full stats object.

Type: 
object

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) → {object}

Extract the 2D size from dicom elements.

Parameters:
NameTypeDescription
elementsobject

The DICOM elements.

Returns:

The size.

Type: 
object

getIndexCompareFunction(direction) → {function}

Get an array sort callback. f(a,b) > 0 -> b,a f(a,b) < 0 -> a,b f(a,b) = 0 -> original order

Parameters:
NameTypeDescription
directionnumber

The direction to use to compare indices.

Returns:

A function that compares two Index.

Type: 
function

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.

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

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

getMatrixFromName(name) → {Matrix33}

Get an orientation matrix from a name.

Parameters:
NameTypeDescription
namestring

The orientation name.

Returns:

The orientation matrix.

Type: 
Matrix33

getMatrixInverse(m) → {Matrix33|undefined}

Get the inverse of an input 3*3 matrix.

Parameters:
NameTypeDescription
mMatrix33

The input matrix.

Returns:

The inverse matrix or undefined if the determinant is zero.

Type: 
Matrix33 | undefined

getMetaDataWithNames(metaData) → {object}

Get the meta data with names instead of tag keys.

Parameters:
NameTypeDescription
metaDataobject

The initial meta data.

Returns:

The list of meta data.

Type: 
object

getObjectUrlFromTags(config) → {string}

Create an object url from (JSON) tags.

Parameters:
NameTypeDescription
configobject

The data configuration.

Returns:

The object URL.

Type: 
string

getOnInstanceLoad(i) → {function}

Get an instance load handler.

Parameters:
NameTypeDescription
inumber

The id of the load.

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

getOrientationName(orientation) → {string}

Get the name of an image orientation patient.

Parameters:
NameTypeDescription
orientationArray

The image orientation patient.

Returns:

The orientation name: axial, coronal or sagittal.

Type: 
string

getOrientedArray3D(array3D, orientation) → {Array}

Get the oriented values of an input 3D array.

Parameters:
NameTypeDescription
array3DArray

The 3D array.

orientationMatrix33

The orientation 3D matrix.

Returns:

The values reordered according to the orientation.

Type: 
Array

getPercentile(array, 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
arrayArray

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) → {object}

Get the pixel spacing from the different spacing tags.

Parameters:
NameTypeDescription
elementsobject

The DICOM elements.

Returns:

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

Type: 
object

getPixelUnit(elements) → {string|null}

Get the pixel data unit.

Parameters:
NameTypeDescription
elementsobject

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

getSagittalMat33() → {Matrix33}

Create a 3x3 sagittal (yzx) matrix.

Returns:

The sagittal matrix.

Type: 
Matrix33

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

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

Parameters:
NameTypeDescription
offsetobject

The previous offset as {x,y}.

scaleobject

The previous scale as {x,y}.

newScaleobject

The new scale as {x,y}.

centerobject

The scale center as {x,y}.

Returns:

The scaled offset as {x,y}.

Type: 
object

getSegment(dataElements) → {object}

Get a segment object from a dicom element.

Parameters:
NameTypeDescription
dataElementsDataElements

The dicom element.

Returns:

A segment object.

Type: 
object

getSegmentFrameInfo(dataElements) → {object}

Get a frame information object from a dicom element.

Parameters:
NameTypeDescription
dataElementsDataElements

The dicom element.

Returns:

A frame information object.

Type: 
object

getSelectedTool() → {string}

Get the selected tool

Returns:

The tool name.

Type: 
string

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
shapeobject

The Konva shape.

Returns:

The display name.

Type: 
string

getSimilarPoint3DFunction(point, tol) → {function}

Get an array find callback for a similar input point.

Parameters:
NameTypeDescription
pointPoint3D

The point to compare to.

tolnumber

The comparison tolerance default to Number.EPSILON.

Returns:

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

Type: 
function

getSimpleStats(array) → {object}

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

Parameters:
NameTypeDescription
arrayArray

The array of values to extract stats from.

Returns:

A simple stats object.

Type: 
object

getSliceGeometrySpacing(origins, orientation, withCheckopt) → {number|undefined}

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

Parameters:
NameTypeAttributesDescription
originsArray

An array of Point3D.

orientationMatrix33

The oritentation matrix.

withCheckboolean<optional>

Flag to activate spacing variation check, default to true.

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

getStats(array, flags) → {object}

Get the minimum, maximum, mean and standard deviation of an array of values. Note: could use https://github.com/tmcw/simple-statistics.

Parameters:
NameTypeDescription
arrayArray

The array of values to extract stats from.

flagsArray

A list of stat values to calculate.

Returns:

A stats object.

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

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

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

getTouchesPositions(touches) → {Array}

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

getTransferSyntaxName(syntax) → {string}

Get the transfer syntax name. Reference: UID Values.

Parameters:
NameTypeDescription
syntaxstring

The transfer syntax.

Returns:

The name of the transfer syntax.

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}

Get a UID for a DICOM tag. Note: Use https://github.com/uuidjs/uuid?

Parameters:
NameTypeDescription
tagNamestring

The input tag.

Returns:

The corresponding UID.

Type: 
string

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

An array of regions.

Returns:

The slice iterator.

Type: 
object | undefined

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) → {object}

Convert a hex color into RGB.

Parameters:
NameTypeDescription
hexStrstring

The hex color as '#ab01ef'.

Returns:

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

Type: 
object

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

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

isEqualRgb(c1, c2) → {boolean}

Check if two rgb objects are equal.

Parameters:
NameTypeDescription
c1object

The first colour.

c2object

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
seg1object

The first segment.

seg2object

The second segment.

Returns:

True if both segment 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

isJpegRetiredTransferSyntax(syntax) → {boolean}

Tell if a given syntax is a retired JPEG one.

Parameters:
NameTypeDescription
syntaxstring

The transfer syntax to test.

Returns:

True if a retired jpeg syntax.

Type: 
boolean

isJpeglsTransferSyntax(syntax) → {boolean}

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

Parameters:
NameTypeDescription
syntaxstring

The transfer syntax to test.

Returns:

True if a jpeg-ls syntax.

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
nodeobject

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
nodeobject

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
nodeobject

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
nodeobject

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
seg1object

The first segment.

seg2object

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/dicom/2013/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 {x,y,z} 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.

launchStow()

Launch a STOW request.

logFramePosPats(elements)

Log the DICCOM seg segments ordered by frame position patients.

Parameters:
NameTypeDescription
elementsobject

The DICOM seg elements.

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

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.

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.

onMainQidoLoad(json)

Handle the data loaded by the main QIDO query.

Parameters:
NameTypeDescription
jsonArray

JSON array data.

onOpacityChange(event)

Handle app opacity change.

Parameters:
NameTypeDescription
eventobject

The change event.

onSaveTags()

Save the tags as a JSON file.

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

parseMultipart(arr) → {Array}

Extract each element of a multipart ArrayBuffer. 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

prepareAndGetMPRDataViewConfig() → {object}

Create MPR view config(s).

Returns:

The view config.

Type: 
object

prepareAndGetSimpleDataViewConfig() → {object}

Create simple view config(s).

Returns:

The view config.

Type: 
object

qidoResponseToTable(json)

Show the QIDO response as a table.

Parameters:
NameTypeDescription
jsonArray

The qido response as json object.

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).

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).

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

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.

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
rgbobject

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

saveRules()

Save the rules as a JSON file.

setupBindersCheckboxes()

Setup the binders checkboxes

setupData()

Setup the data.

setupParsers()

Setup the parsers.

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.

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

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

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.

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 returns { 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
tripletobject

sRGB triplet as {r,g,b}.

Returns:

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

Type: 
object

srgbToCiexyz(triplet) → {object}

Convert sRGB to CIE XYZ.

Parameters:
NameTypeDescription
tripletobject

sRGB triplet as {r,g,b}.

Returns:

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

Type: 
object

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

testWriteReadDataFromConfig(config, assert)

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

Parameters:
NameTypeDescription
configobject

A JSON config representing DICOM tags.

assertobject

A Qunit assert.

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
stageSizeobject

The stage size {x,y}.

anchorobject

The anchor to evaluate.

Returns:

True if the position was corrected.

Type: 
boolean

validateGroupPosition(stageSize, group) → {boolean}

Validate a group position.

Parameters:
NameTypeDescription
stageSizeobject

The stage size {x,y}.

groupobject

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) → {object}

Convert YBR to RGB.

Parameters:
NameTypeDescription
ynumber

The Y component.

cbnumber

The Cb component.

crnumber

The Cr component.

Returns:

RGB equivalent as {r,g,b}.

Type: 
object

Type Definitions

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
valueobject

The pixel value.

indexobject

The values' index.

Returns:

The value to display.

Type: 
number

alphaFn(value, index) → {number}

Parameters:
NameTypeDescription
valueobject

The pixel value.

indexobject

The values' index.

Returns:

The value to display.

Type: 
number

alphaFn(value, index) → {number}

Parameters:
NameTypeDescription
valueobject

The pixel value.

indexobject

The values' index.

Returns:

The value to display.

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.

eventFn(event)

Parameters:
NameTypeDescription
eventobject

The event.

testFn(node) → {boolean}

Parameters:
NameTypeDescription
nodeobject

The node.

Returns:

True if the node passes the test.

Type: 
boolean