Members

(constant) ContinuityOfContents

(constant) DRAW_DEBUG

Draw Debug flag.

(constant) DcmCodes

(constant) DirectoryRecordTypes

(constant) GraphicTypes

(constant) InteractionEventNames

List of interaction event names.

(constant) MetaTagKeys

Meta tag keys.

(constant) MetaTagKeys

Meta tag keys.

(constant) Orientation

Default anatomical plane orientations.

(constant) QuantificationName2DictItem

Quantification name to dictionary item.

(constant) QuantificationUnit2UcumKey

(constant) RelationshipTypes

(constant) RequiredDicomTags

List of DICOM Seg required tags.

(constant) SctCodes

SNOMED-CT codes. List: https://browser.ihtsdotools.org.

(constant) TagKeys

DICOM code tag keys.

(constant) TagKeys

Related DICOM tag keys.

(constant) TagKeys

Related DICOM tag keys.

(constant) TagKeys

Related DICOM tag keys.

(constant) TagKeys

Related DICOM tag keys.

(constant) TagKeys

Related DICOM tag keys.

(constant) TagKeys

Small list of used tag keys.

(constant) TagKeys

Related DICOM tag keys.

(constant) TagKeys

Related DICOM tag keys.

(constant) TagKeys

Related DICOM tag keys.

(constant) TagKeys

Related DICOM tag keys.

(constant) TagKeys

Related DICOM tag keys.

(constant) TagKeys

Related DICOM tag keys.

(constant) TagKeys

Related DICOM tag keys.

(constant) TagKeys

Small list of used tag keys.

(constant) TagKeys

Related DICOM tag keys.

(constant) TagKeys

Related DICOM tag keys.

(constant) TagKeys

Related DICOM tag keys.

(constant) TagKeys

Related DICOM tag keys.

(constant) UcumCodes

(constant) ValueTypeValueTagName

DICOM value type to associated tag name.

(constant) ValueTypes

_app :App

Type:

(constant) binderList

List of binders.

(constant) custom

Overridalbe custom object for client defined items.

(constant) d65

CIE Standard Illuminant D65, standard 2° observer.

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

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

List of default label texts.

Type:
  • Object.<string, Object.<string, string>>

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

Default tool list.

Type:
  • Object.<string, any>

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

Default tool options.

Type:
  • Object.<string, Object.<string, any>>

(constant) defaultWlPresets :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) prefixes

HTML element id prefixes.

(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>
Example
import {App, AppOptions, ViewConfig, toolList} from '//esm.sh/dwv';
// custom tool
class AlertTool {
  mousedown() {alert('AlertTool mousedown');}
  init() {}
  activate() {}
}
// pass it to dwv tool list
toolList['Alert'] = AlertTool;
// create the dwv app
const app = new App();
// initialise
const viewConfig0 = new ViewConfig('layerGroup0');
const viewConfigs = {'*': [viewConfig0]};
const options = new AppOptions(viewConfigs);
options.tools = {Alert: {}};
app.init(options);
// activate tool
app.addEventListener('load', function () {
  app.setTool('Alert');
});
// load dicom data
app.loadURLs([
  'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm'
]);

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

List of client provided tool options to be added to the default ones.

Type:
  • Object.<string, Object.<string, any>>
Example
import {App, AppOptions, ViewConfig, toolOptions, ROI, Point2D}
  from '//esm.sh/dwv';
// custom factory
class LoveFactory {
  getName() {return 'love';}
  static supports(mathShape) {return mathShape instanceof ROI;}
  getNPoints() {return 1;}
  getTimeout() {return 0;}
  setAnnotationMathShape(annotation, points) {
    const px = points[0].getX();
    const py = points[0].getY();
    annotation.mathShape = new ROI([
      new Point2D(px+15,py), new Point2D(px+10,py-10),
      new Point2D(px,py), new Point2D(px-10,py-10),
      new Point2D(px-15,py), new Point2D(px,py+20)
    ]);
    annotation.getFactory = function () {return new LoveFactory();}
  }
  createShapeGroup(annotation, style) {
    const roi = annotation.mathShape;
    // konva line
    const arr = [];
    for (let i = 0; i < roi.getLength(); ++i) {
      arr.push(roi.getPoint(i).getX());
      arr.push(roi.getPoint(i).getY());
    }
    const shape = new Konva.Line({
      name: 'shape', points: arr,
      stroke: 'red', strokeWidth: 2,
      closed: true
    });
    // konva group
    const group = new Konva.Group();
    group.name('love-group');
    group.visible(true);
    group.id(annotation.trackingUid);
    group.add(shape);
    return group;
  }
}
// pass it to dwv option list
toolOptions['draw'] = {LoveFactory};
// create the dwv app
const app = new App();
// initialise
const viewConfig0 = new ViewConfig('layerGroup0');
const viewConfigs = {'*': [viewConfig0]};
const options = new AppOptions(viewConfigs);
options.tools = {Draw: {options: ['Love']}};
app.init(options);
// activate tool
app.addEventListener('load', function () {
  app.setTool('Draw');
  app.setToolFeatures({shapeName: 'Love'});
});
// load dicom data
app.loadURLs([
  'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm'
]);

(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

addDataLine(id, doc)

Add one data line.

Parameters:
NameTypeDescription
idnumber

The line id.

docobject

Individual data.

addDataLines(data)

Add all data lines.

Parameters:
NameTypeDescription
dataobject

Full demo data.

addDataViewConfig(dataId)

Add data view config for the input data.

Parameters:
NameTypeDescription
dataIdstring

The data ID.

addFooter()

Add footer.

addFooter()

Add footer.

addFooter()

Add footer.

addFooter()

Add footer.

addLayerGroupDiv(id)

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

Parameters:
NameTypeDescription
idstring

The id of the layer.

addLayerGroupsDiv()

Add Layer Groups div.

addPostLoadListeners()

Add post-load event listeners.

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

areOrthogonal(line0, line1) → {boolean}

Check if two lines are orthogonal.

Parameters:
NameTypeDescription
line0Line

The first line.

line1Line

The second line.

Returns:

True if both lines are orthogonal.

Type: 
boolean

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

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

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

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

Check a DICOM data element: checks

  • if the element is not undefined,
  • if the elements' value is not undefined,
  • if the elements' value is not empty,
  • (optional) if the elements' values have specific values.
Parameters:
NameTypeAttributesDescription
elementDataElement

The element to check.

namestring

The element name.

valuesArray<optional>

Optional list of expected values.

Returns:

A warning if the element is not as expected.

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.

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

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

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

compareVersions(a, b) → {number}

Compare versions. The input versions follow a 'm.n.p[-beta.q]' version sheme (related to semantic versioning).

Parameters:
NameTypeDescription
astring

The first version.

bstring

The second version.

Returns:

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

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

dateToDateObj(date) → {Object}

Extract date values from a Date object.

Parameters:
NameTypeDescription
dateDate

The input date.

Returns:

A 'date' object.

Type: 
Object

dateToTimeObj(date) → {Object}

Extract time values from a Date object.

Parameters:
NameTypeDescription
dateDate

The input date.

Returns:

A 'time' object.

Type: 
Object

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.

defaultGetTagPixelUnit(elements) → {string|undefined}

Default get pixel data unit.

Parameters:
NameTypeDescription
elementsObject.<string, DataElement>

The DICOM elements.

Returns:

The unit value if available.

Type: 
string | undefined

defaultOpenRoiDialog(annotation, callback)

Open a dialogue to edit roi data. Defaults to window.prompt.

Parameters:
NameTypeDescription
annotationAnnotation

The roi data.

callbackfunction

The callback to launch on dialogue exit.

displayConfigs(configs)

Parameters:
NameTypeDescription
configsobject

Synthetic data configuration.

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

formatString(template, …values) → {string}

Format string.

Parameters:
NameTypeAttributesDescription
template*

The template where to add values.

valuesany<repeatable>

The values to add to the template.

Returns:

The formated string.

Type: 
string

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.

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

Get the DICOM pixel data from a DICOM tags object.

Parameters:
NameTypeDescription
tagsobject

The DICOM tags object.

pixGeneratorNamestring

The name of a pixel generator.

sliceNumbernumber

The slice number.

imagesArray

The images to pass to the generator.

numberOfSlicesnumber

The result number of slices.

Returns:

The DICOM pixel data element.

Type: 
object

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

generateWorkerMessage(imageBuffer, imageSize) → {object}

Generate a worker message to send to the labeling worker.

Parameters:
NameTypeDescription
imageBufferTypedArray

The buffer to label.

imageSizeSize

The image size.

Returns:

The message to send to the worker.

Type: 
object

getAllPixelDataTagKeys() → {Array.<string>}

Get the list of pixel data DICOM tag keys: PixelData, FloatPixelData and DoubleFloatPixelData.

Returns:

The key list.

Type: 
Array.<string>

getAnchorIndex(id) → {number}

Get an anchor index from its id.

Parameters:
NameTypeDescription
idstring

The anchor id as 'anchor#'.

Returns:

The anchor index.

Type: 
number

getAnchorShape(group, index) → {Konva.Ellipse|undefined}

Get a Konva.Ellipse anchor shape from a group.

Parameters:
NameTypeDescription
groupKonva.Group

The group to look into.

indexnumber

The anchor index.

Returns:

The anchor shape.

Type: 
Konva.Ellipse | 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

getAnnotationDivId(annotation, dataId) → {string}

Get the annotation divId.

Parameters:
NameTypeDescription
annotationAnnotation

The annotation.

dataIdstring

The data ID.

Returns:

The divId.

Type: 
string

getAnnotationGroupDivId(dataId) → {string}

Get the annotation group divId.

Parameters:
NameTypeDescription
dataIdstring

The data ID.

Returns:

The divId.

Type: 
string

getAppViewConfig(dataId) → {object}

Get the first view config for a data id.

Parameters:
NameTypeDescription
dataIdstring

The data id.

Returns:

The view config.

Type: 
object

getAppViewConfigOrientation(divId) → {object}

Get the orientation of the first view config for a div id.

Parameters:
NameTypeDescription
divIdstring

The div id.

Returns:

The orientation.

Type: 
object

getArrayFromStringId(inputStr) → {Array}

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

Parameters:
NameTypeDescription
inputStrstring

The input string.

Returns:

The corresponding array (minimum size is 3D).

Type: 
Array

getAsSimpleElements(metaData) → {Object.<string, any>}

Get the meta data as simple elements:

  • indexed by tag names instead of tag keys,
  • no element object, just value if not sequence nor merged item.
Parameters:
NameTypeDescription
metaDataObject.<string, DataElement>

The meta data index by tag keys.

Returns:

The simple elements.

Type: 
Object.<string, any>

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

getCircleIndices(geometry, position, radiuses, dims) → {Array.<Index>}

Get the indices that form a circle. Can be an ellipse to adapt to view.

Parameters:
NameTypeDescription
geometryGeometry

The geometry.

positionPoint

The circle center.

radiusesArray.<number>

The circle radiuses.

dimsArray.<number>

The 2 dimensions.

Returns:

The indices of the circle.

Type: 
Array.<Index>

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

getColourCode() → {DicomCode}

Get a colour DICOM code.

Returns:

The 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

getConceptNameCode(name) → {DicomCode|undefined}

Get a concept name DICOM code.

Parameters:
NameTypeDescription
namestring

The measurment name as defined in a quantification object.

Returns:

The code.

Type: 
DicomCode | undefined

getConfigsHtmlList(configs) → {object}

Create list from configs.

Parameters:
NameTypeDescription
configsArray

An array of data cofiguration.

Returns:

The html list element.

Type: 
object

getContentTemplate(dataElements) → {string|undefined}

Get the content template value.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The dicom elements.

Returns:

The template as 'MappingResource'-'TemplateIdentifier'.

Type: 
string | undefined

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

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

Number field float precision.

stepnumber

The control step.

Returns:

The control div.

Type: 
HTMLDivElement

getCoronalMat33() → {Matrix33}

Create a 3x3 coronal (xzy) matrix.

Returns:

The coronal matrix.

Type: 
Matrix33

getCosinesFromOrientation(matrix) → {Array.<number>}

Get the direction cosines from an orientation matrix.

Parameters:
NameTypeDescription
matrixMatrix33

The input matrix.

Returns:

The image orientation patient cosines (6 values).

Type: 
Array.<number>

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

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
elementDataElement

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
elementDataElement

The DICOM element with date-time information.

Returns:

The time object.

Type: 
Object | undefined

getDcmDicomCode(code) → {DicomCode}

Get a DICOM code from a value and meaning.

Parameters:
NameTypeDescription
codeobject

The code value as {value, meaning}.

Returns:

The DICOM code.

Type: 
DicomCode

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.<string, DataElement>

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>

getDefaultColour(segmentNumber) → {RGB}

Get a default RGB colour for a segment.

Parameters:
NameTypeDescription
segmentNumbernumber

The segment number.

Returns:

A colour.

Type: 
RGB

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

getDicomCode(value, scheme) → {DicomCode|undefined}

Get a DICOM code from a value (~id).

Parameters:
NameTypeDescription
valuestring

The code value.

schemestring

The scheme designator.

Returns:

The DICOM code.

Type: 
DicomCode | undefined

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(dateObj) → {string}

Get a DICOM formated date string.

Parameters:
NameTypeDescription
dateObjObject

The date to format.

Returns:

The formated date.

Type: 
string

getDicomDateTime(datetime) → {string}

Get a DICOM formated datetime string.

Parameters:
NameTypeDescription
datetimeObject

The datetime to format.

Returns:

The formated datetime.

Type: 
string

getDicomDirFileList(dicomElements) → {Array|undefined}

Get a DICOMDIR file list.

Parameters:
NameTypeDescription
dicomElementsObject.<string, DataElement>

The dicom elements.

Returns:

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

Type: 
Array | undefined

getDicomImageReferenceItem(ref) → {Object.<string, any>}

Get a simple dicom element item from a reference object.

Parameters:
NameTypeDescription
refImageReference

The reference object.

Returns:

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

Type: 
Object.<string, any>

getDicomMeasureItem(spacing) → {object}

Get a dicom item from a measure sequence.

Parameters:
NameTypeDescription
spacingSpacing

The spacing object.

Returns:

The dicom item.

Type: 
object

getDicomMeasuredValueItem(value) → {Object.<string, any>}

Get a simple dicom element item from a measured value object.

Parameters:
NameTypeDescription
valueMeasuredValue

The measured value object.

Returns:

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

Type: 
Object.<string, any>

getDicomNumericMeasurementItem(measurement) → {Object.<string, any>}

Get a simple dicom element item from a measurement object.

Parameters:
NameTypeDescription
measurementNumericMeasurement

The measurement object.

Returns:

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

Type: 
Object.<string, any>

getDicomPlaneOrientationItem(orientation) → {object}

Get a dicom element from a plane orientation sequence.

Parameters:
NameTypeDescription
orientationMatrix33

The image orientation.

Returns:

The dicom element.

Type: 
object

getDicomSRContentItem(content) → {Object.<string, any>}

Get a simple dicom element item from a content item object.

Parameters:
NameTypeDescription
contentDicomSRContent

The content item object.

Returns:

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

Type: 
Object.<string, any>

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>

getDicomSopInstanceReferenceItem(ref) → {Object.<string, any>}

Get a simple dicom element item from a SOP reference object.

Parameters:
NameTypeDescription
refSopInstanceReference

The SOP reference object.

Returns:

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

Type: 
Object.<string, any>

getDicomSpatialCoordinate3DItem(scoord) → {Object.<string, any>}

Get a simple dicom element item from a scoord3d object.

Parameters:
NameTypeDescription
scoordSpatialCoordinate3D

The scoord3d object.

Returns:

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

Type: 
Object.<string, any>

getDicomSpatialCoordinateItem(scoord) → {Object.<string, any>}

Get a simple dicom element item from a scoord object.

Parameters:
NameTypeDescription
scoordSpatialCoordinate

The scoord object.

Returns:

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

Type: 
Object.<string, any>

getDicomTime(dateObj) → {string}

Get a DICOM formated time string.

Parameters:
NameTypeDescription
dateObjObject

The date to format.

Returns:

The formated time.

Type: 
string

getDimensionOrganization(dataElements) → {object}

Check the dimension organization from a dicom element.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The root dicom element.

Returns:

The dimension organizations and indices.

Type: 
object

getDimensionOrganization() → {object}

Get a dimension organisation used to index a DICOM seg.

Returns:

The indices and organisations.

Type: 
object

getDirIncr(dir) → {Array.<number>}

Get an increment vector for input directions.

Parameters:
NameTypeDescription
dirArray.<number>

The directions.

Returns:

The increment vector.

Type: 
Array.<number>

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

getDwvVersionFromImplementationClassUID(uid) → {string|undefined}

Get the dwv version from the value of the ImplementationClassUID tag.

Parameters:
NameTypeDescription
uidstring

The uid.

Returns:

The dwv version.

Type: 
string | undefined

getDwvVersionUI() → {string}

Get the version of the library as a Unique Identifier (UI), meaning just numbers and dots.

Returns:

The UI version of the library.

Type: 
string

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

Get a data element as a string.

Parameters:
NameTypeAttributesDescription
tagTag

The DICOM tag.

dicomElementDataElement

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.

dicomElementDataElement

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>

getEqualIndexCallback(i0) → {function}

Get an array find callback for an index.

Parameters:
NameTypeDescription
i0Index

The index to find.

Returns:

The find callback.

Type: 
function

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

getHtmlId(prefix, root) → {string}

Get a HTML id from a prefix and root part.

Parameters:
NameTypeDescription
prefixstring

The id prefix.

rootstring

The root.

Returns:

The HTML id.

Type: 
string

getIdentityMat33() → {Matrix33}

Create a 3x3 identity matrix.

Returns:

The identity matrix.

Type: 
Matrix33

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

Extract the 2D size from dicom elements.

Parameters:
NameTypeDescription
elementsObject.<string, DataElement>

The DICOM elements.

Returns:

The sizes as [columns, rows] or undefined if not present.

Type: 
Array.<number> | undefined

getImageDataData(image) → {object}

Extract the image data from an image.

Parameters:
NameTypeDescription
imageImage

The image to get the data from.

Returns:

The image data buffer.

Type: 
object

getImageReference(dataElements) → {ImageReference}

Get a reference object from a dicom element.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The dicom element.

Returns:

A reference object.

Type: 
ImageReference

getImplementationClassUID() → {string}

Get the value of the ImplementationClassUID tag.

Returns:

The uid.

Type: 
string

getImplementationVersionName() → {string}

Get the value of the ImplementationVersionName tag.

Returns:

The name.

Type: 
string

getIndexCompareFunction(direction) → {object}

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

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, layerIndex, 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, layerIndex, layerId}.

Type: 
object

getLayerDivId(groupDivId, layerIndex) → {string}

Get the layer div id.

Parameters:
NameTypeDescription
groupDivIdstring

The layer group div id.

layerIndexnumber

The layer index.

Returns:

A string id.

Type: 
string

getLayerGroupDivIds(dataViewConfigs) → {Array.<string>}

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

Parameters:
NameTypeDescription
dataViewConfigsobject

The configs.

Returns:

The list of ids.

Type: 
Array.<string>

getLineFromEquation(slope, intercept, point, length, spacingopt) → {Line}

Get a line from an equation, a middle point and a length.

Parameters:
NameTypeAttributesDescription
slopenumber

The line slope.

interceptnumber

The line intercept.

pointPoint2D

The middle point of the line.

lengthnumber

The line length.

spacingScalar2D<optional>

Optional image spacing, default to [1,1].

Returns:

The resulting line.

Type: 
Line

getLineShape(group) → {Konva.Line|undefined}

Get a Konva.Line shape from a group.

Parameters:
NameTypeDescription
groupKonva.Group

The group to look into.

Returns:

The shape.

Type: 
Konva.Line | undefined

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

getMeasuredValue(dataElements) → {MeasuredValue}

Get a measured value object from a dicom element.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The dicom element.

Returns:

A measured value object.

Type: 
MeasuredValue

getMeasurementUnitsCode(name) → {DicomCode|undefined}

Get a measurement units DICOM code.

Parameters:
NameTypeDescription
namestring

The unit name as defined in a quantification object.

Returns:

The code.

Type: 
DicomCode | undefined

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

getNewSegment(number) → {object}

Get a new segment.

Parameters:
NameTypeDescription
numbernumber

The segment number.

Returns:

The new segment.

Type: 
object

getNumberOfLayerGroups() → {nunmber}

Get the number of layer groups according to layout.

Returns:

The number.

Type: 
nunmber

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

getNumericMeasurement(dataElements) → {NumericMeasurement}

Get a measurement object from a dicom element.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The dicom element.

Returns:

A measurement object.

Type: 
NumericMeasurement

getObjectUrlFromTags(config) → {string}

Create an object url from (JSON) tags.

Parameters:
NameTypeDescription
configobject

The data configuration.

Returns:

The object URL.

Type: 
string

getOffsetsFromIndices(geometry, indices) → {Array.<number>}

Get the data offsets that correspond to input indices.

Parameters:
NameTypeDescription
geometryGeometry

The geometry.

indicesArray.<Index>

An array of indices.

Returns:

An array of offsets.

Type: 
Array.<number>

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*1 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 image orientation patient cosines (6 values).

Returns:

The orientation matrix.

Type: 
Matrix33 | undefined

getOrientationMatrix(dataElements) → {Matrix33|undefined}

Get an orientation matrix from a dicom orientation element.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The dicom element.

Returns:

The orientation matrix.

Type: 
Matrix33 | undefined

getOrientationName(cosines) → {string|undefined}

Get the name of an image orientation patient.

Parameters:
NameTypeDescription
cosinesArray.<number>

The image orientation patient cosines (6 values).

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>

getOriginIndexRangeFromMaskIndices(geometry, indices) → {Array.<number>}

Get the range of origin indices that correspond to input new mask indices.

Parameters:
NameTypeDescription
geometryGeometry

The geometry.

indicesArray.<Index>

An array of indices.

Returns:

Range of indices in the input origins.

Type: 
Array.<number>

getPaletteColourMap(dataElements) → {ColourMap|undefined}

Get the palette colour map.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The data elements.

Returns:

The palette colour map.

Type: 
ColourMap | undefined

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, spacingopt) → {Line}

Get a perpendicular line to an input one at a given point.

Parameters:
NameTypeAttributesDescription
lineLine

The line to be perpendicular to.

pointPoint2D

The middle point of the perpendicular line.

lengthnumber

The length of the perpendicular line.

spacingScalar2D<optional>

Optional image spacing, default to [1,1].

Returns:

The perpendicular line.

Type: 
Line

getPerpendicularLineAtDistance(line, distance, length, spacingopt) → {Line}

Get a perpendicular line to an input one at a given distance of its begin point.

Parameters:
NameTypeAttributesDescription
lineLine

The line to be perpendicular to.

distancenumber

The distance to the input line begin point.

lengthnumber

The length of the perpendicular line.

spacingScalar2D<optional>

Optional image spacing, default to [1,1].

Returns:

The perpendicular line.

Type: 
Line

getPhotometricInterpretation(dataElements) → {string|undefined}

Get the photometric interpretation from the data elements.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The data elements.

Returns:

The photometric interpretation value.

Type: 
string | undefined

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) → {Array.<number>|undefined}

Get the pixel spacing from the different spacing tags.

Parameters:
NameTypeDescription
elementsObject.<string, DataElement>

The DICOM elements.

Returns:

The spacing as [columnSapcing, rowSpacing] or undefined if not present.

Type: 
Array.<number> | undefined

getPrecisionRound(precision) → {function}

Get a rounding function for a specific precision.

Parameters:
NameTypeDescription
precisionnumber

The rounding precision.

Returns:

The rounding function.

Type: 
function

getQuantificationName(code) → {string|undefined}

Get the DICOM code for a quantification name.

Parameters:
NameTypeDescription
codeDicomCode

The Dicom code.

Returns:

The quantification name.

Type: 
string | undefined

getQuantificationUnit(code) → {string}

Get a quantification unit name.

Parameters:
NameTypeDescription
codeDicomCode

The code to get the unit from.

Returns:

The quantification unit.

Type: 
string

getRectangleIndices(center, size, dir) → {Array.<Index>}

Get the indices that form a rectangle.

Parameters:
NameTypeDescription
centerIndex

The rectangle center.

sizeArray.<number>

The 2 rectangle sizes.

dirArray.<number>

The 2 rectangle directions.

Returns:

The indices of the rectangle.

Type: 
Array.<Index>

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

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

getRootFromHtmlId(prefix, htmlId) → {string}

Get the root part from an HTML id.

Parameters:
NameTypeDescription
prefixstring

The id prefix.

htmlIdstring

The HTML id.

Returns:

The root.

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

getRunRenderTest(app) → {function}

Run render tests.

Parameters:
NameTypeDescription
appobject

The associated application.

Returns:

The run render text function.

Type: 
function

getSRContent(dataElements) → {DicomSRContent}

Get a content item object from a dicom element.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The dicom element.

Returns:

A content item object.

Type: 
DicomSRContent

getSRContentFromValue(name, value, unit, relationopt) → {DicomSRContent|undefined}

Get a DicomSRContent from a value.

Parameters:
NameTypeAttributesDescription
namestring

The value name.

valueobject

The value.

unitstring

The values' unit.

relationstring<optional>

Optional content relationhip.

Returns:

The SR content.

Type: 
DicomSRContent | undefined

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

getScoordFromShape(shape) → {SpatialCoordinate}

Get a DICOM spatial coordinate (SCOORD) from a mathematical shape.

Parameters:
NameTypeDescription
shapePoint2D | Line | Protractor | ROI | Circle | Ellipse | Rectangle

The math shape.

Returns:

The DICOM scoord.

Type: 
SpatialCoordinate

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

getSegment(segmentNumber, segments) → {object|undefined}

Get a segment from a segment list.

Parameters:
NameTypeDescription
segmentNumbernumber

The segment number.

segmentsArray.<object>

The list to search.

Returns:

The found segment.

Type: 
object | undefined

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

getSegmentHtmlId(segmentNumber, segmentationIndex) → {string}

Get the HTML id of a segment.

Parameters:
NameTypeDescription
segmentNumbernumber

The segment number.

segmentationIndexnumber

The segmentation index.

Returns:

The segment HTML id.

Type: 
string

getSegmentationCode() → {DicomCode}

Get a segmentation DICOM code.

Returns:

The code.

Type: 
DicomCode

getSegmentationHtmlId(segmentationIndex) → {string}

Get the HTML id of a segmentation.

Parameters:
NameTypeDescription
segmentationIndexnumber

The segmentation index.

Returns:

The segmentation HTML id.

Type: 
string

getSelectedToolName() → {string|undefined}

Get the selected tool name.

Returns:

The tool name.

Type: 
string | undefined

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

getShapeFromScoord(scoord) → {Point2D|Line|Protractor|ROI|Circle|Ellipse|Rectangle|undefined}

Get a mathematical shape from a DICOM spatial coordinate (SCOORD).

Parameters:
NameTypeDescription
scoordSpatialCoordinate

The DICOM scoord.

Returns:

The math shape.

Type: 
Point2D | Line | Protractor | ROI | Circle | Ellipse | Rectangle | undefined

getShapePositionRange(stageSize, shape) → {object}

Get a shape top left position range.

Parameters:
NameTypeDescription
stageSizeScalar2D

The stage size as {x,y}.

shapeKonva.Shape

The shape to evaluate.

Returns:

The range as {min, max}.

Type: 
object

getSimpleElementReducer(dataElements) → {any}

Get an array reducer to reduce an array of tag keys taken from the input dataElements and return as simple elements.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The meta data index by tag keys.

Returns:

An array reducer callbackFn.

Type: 
any

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, index, isRescaled, viewOrientation) → {object}

Get a slice index iterator.

Parameters:
NameTypeDescription
imageImage

The image to parse.

indexIndex

The current index.

isRescaledboolean

Flag for rescaled values (default false).

viewOrientationMatrix33

The view orientation.

Returns:

The slice iterator.

Type: 
object

getSlider(layerGroupDivId) → {HTMLInputElement}

Get the slider for a given layer group.

Parameters:
NameTypeDescription
layerGroupDivIdnumber

The div id.

Returns:

The slider as html range.

Type: 
HTMLInputElement

getSopInstanceReference(dataElements) → {SopInstanceReference}

Get a SOP reference object from a dicom element.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The dicom element.

Returns:

A SOP reference object.

Type: 
SopInstanceReference

getSpacingFromMeasure(dataElements) → {Spacing|undefined}

Get a spacing object from a dicom measure element.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The dicom element.

Returns:

A spacing object.

Type: 
Spacing | undefined

getSpatialCoordinate(dataElements) → {SpatialCoordinate}

Get a scoord object from a dicom element.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The dicom element.

Returns:

A scoord object.

Type: 
SpatialCoordinate

getSpatialCoordinate3D(dataElements) → {SpatialCoordinate3D}

Get a scoord3d object from a dicom element.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The dicom element.

Returns:

A scoord3d object.

Type: 
SpatialCoordinate3D

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.<string, DataElement>

The DICOM elements.

Returns:

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

Type: 
object

getSyntaxDecompressionName(syntax) → {string|undefined}

Tell if a given syntax needs decompression.

Parameters:
NameTypeDescription
syntaxstring

The transfer syntax to test.

Returns:

The name of the decompression algorithm.

Type: 
string | undefined

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

getTagPixelUnit(elements) → {string|undefined}

Get pixel data unit from a list of tags.

Parameters:
NameTypeDescription
elementsObject.<string, DataElement>

The DICOM elements.

Returns:

The unit value if available.

Type: 
string | undefined

getTagTime(elements) → {number|undefined}

Get the time from a list of tags. Defaults returns undefined.

Parameters:
NameTypeDescription
elementsObject.<string, DataElement>

The DICOM elements.

Returns:

The time value if available.

Type: 
number | undefined

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
elementDataElement

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

getUniqueDataViewConfigsDivIds(dataViewConfigs) → {Array.<string>}

Retrieves the unique div ids in the current data view configs.

Parameters:
NameTypeDescription
dataViewConfigsobject

The data view configs.

Returns:

Array of unique div ids.

Type: 
Array.<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 index.

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(layout, divId) → {object}

Get a full view for a given div id.

Parameters:
NameTypeDescription
layoutstring

The layout.

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

getWindowPresets(dataElements, intensityFactor) → {object|undefined}

Get the window level presets.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

The data elements.

intensityFactornumber

The intensity factor.

Returns:

The presets.

Type: 
object | undefined

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

hasAnyPixelDataElement(elements) → {boolean}

Check if an input data elements contains a pixel data element.

Parameters:
NameTypeDescription
elementsObject.<string, DataElement>

Data elements.

Returns:

True if the elements contain one of the pixel data tags.

Type: 
boolean

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

hasValue(element) → {boolean}

Check an input data element, returns true if:

  • the element is not undefined,
  • the elements' value is not undefined,
  • the elements' value has content.
Parameters:
NameTypeDescription
elementDataElement

The data element.

Returns:

True if there is a value.

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

initDwv()

Initialise dwv.

initSlider(layerGroupId)

Init individual slider. WARNING: needs to be called with the final geometry.

Parameters:
NameTypeDescription
layerGroupIdstring

The id of the layer group.

initSliderOnEvent(event)

Init individual slider on layer related event. WARNING: needs to be called with the final geometry.

Parameters:
NameTypeDescription
eventobject

The layer event.

initSliders()

Init sliders: show them and set max.

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

isAnyPixelDataTag(tag) → {boolean}

Is the input tag one of the pixel data tag.

Parameters:
NameTypeDescription
tagTag

The tag to test.

Returns:

True if input is a pixel data tag.

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: just checks schemeDesignator and value.

Parameters:
NameTypeDescription
code1DicomCode

The first code.

code2DicomCode

The second code.

Returns:

True if both codes are equal.

Type: 
boolean

isEqualContentItem(item1, item2) → {boolean}

Check if two content item objects are equal.

Parameters:
NameTypeDescription
item1DicomSRContent

The first content item.

item2DicomSRContent

The second content item.

Returns:

True if both content items 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

isMonochrome(photometricInterpretation) → {boolean}

Check if an input photometricInterpretation is monochrome.

Parameters:
NameTypeDescription
photometricInterpretationstring

The photometric interpretation.

Returns:

True if the input string starts with 'MONOCHROME'.

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

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

isPointInLineRange(point, line) → {boolean}

Check if a point is in a line coordinate range.

Parameters:
NameTypeDescription
pointPoint2D

The input point.

lineLine

The input line.

Returns:

True if the input point is in the line coordinate range.

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

isSecondatyCapture(SOPClassUID) → {boolean}

Check if the received string represents a secondary capture.

Parameters:
NameTypeDescription
SOPClassUIDstring

The sop class uid.

Returns:

True if it is secondary capture.

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

isShapeInRange(shape, min, max) → {boolean}

Is an input shape top left position in the input range.

Parameters:
NameTypeDescription
shapeKonva.Shape

The shape to evaluate.

minPoint2D

The minimum top left position.

maxPoint2D

The maximum top left position.

Returns:

True if in range.

Type: 
boolean

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

Check if two numbers are similar.

Parameters:
NameTypeAttributesDescription
anumber

The first number.

bnumber

The second number.

tolnumber<optional>

Optional comparison tolerance, defaults 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

isVersionInBounds(version, min, max) → {boolean}

Check if a version in inside bounds (bounds inclusives). The input version follows a 'm.n.p[-beta.q]' version sheme (related to semantic versioning).

Parameters:
NameTypeDescription
versionstring

The version to check.

minstring

The minimum version.

maxstring

The maximum version.

Returns:

True if the version in inside the bounds.

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

konvaToAnnotation(drawings, drawingsDetails, refImage) → {Array.<Annotation>}

Convert a KonvaLayer object to a list of annotations.

Parameters:
NameTypeDescription
drawingsArray

An array of drawings stored with 'KonvaLayer().toObject()'.

drawingsDetailsArray.<DrawDetails>

An array of drawings details.

refImageImage

The reference image.

Returns:

The associated list of annotations.

Type: 
Array.<Annotation>

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.

logMetaData(dataId, loadType)

Log meta data.

Parameters:
NameTypeDescription
dataIdstring

The data ID.

loadTypestring

The load type.

mergeConfigs(config, configToMerge) → {object}

Merge a data config into the first input one. Copies all but the divId and orientation property.

Parameters:
NameTypeDescription
configobject

The config where to merge.

configToMergeobject

The config to merge.

Returns:

The updated config.

Type: 
object

mergeGeometries(geometry1, geometry2) → {Geometry}

Merge two geometries into one using the merge size and smallest resolution. WARNING: needs to be called with the final geometries.

Parameters:
NameTypeDescription
geometry1Geometry

The first geometry.

geometry2Geometry

The second geometry.

Returns:

The merged geometry.

Type: 
Geometry

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.

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

nextColour() → {object}

Get the next available colour from the colour list.

Returns:

The colour as {r,g,b}.

Type: 
object

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.

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.

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.

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

posGroupIdToArray(id) → {Array.<number>}

Convert a posGroup id (for ex '#2-0') into index values.

Parameters:
NameTypeDescription
idstring

The posGroup id.

Returns:

The index values.

Type: 
Array.<number>

precisionRound(number, precision) → {number}

Round a float number to a given precision.

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

toPrecision uses all non zero digits of the number: (123.009).toPrecision(4) = "123.0"; (0.09).toPrecision(4) = "0.09000".

toFixed does not always behave as expected: (123.009).toFixed(2) = "123.01"; (0.009).toFixed(2) = "0.01"; but (-0.005).toFixed(2) = "-0.01" (expecting 0); (1.005).toFixed(2) = "1" (expecting 1.01).

Parameters:
NameTypeDescription
numbernumber

The number to round.

precisionnumber

The rounding precision, ie the result number of digits after the comma.

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

removePostLoadListeners()

Remove post-load event listeners.

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

safeGet(dataElements, key) → {any|undefined}

Safely get an elements' first value from a list of elements.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

A list of data elements.

keystring

The tag key as for example '00100020'.

Returns:

The elements' value or undefined.

Type: 
any | undefined

safeGetAll(dataElements, key) → {Array.<any>|undefined}

Safely get all of an elements' values from a list of elements.

Parameters:
NameTypeDescription
dataElementsObject.<string, DataElement>

A list of data elements.

keystring

The tag key as for example '00100020'.

Returns:

The elements' values or undefined.

Type: 
Array.<any> | undefined

saveRules()

Save the rules as a JSON file.

setAppTool(toolNameopt)

Set the app tool.

Parameters:
NameTypeAttributesDescription
toolNamestring<optional>

The tool to set.

setup()

Setup.

setup()

Setup.

setup()

Setup.

setup()

Setup.

setup()

Setup.

setup()

Setup.

setup()

Setup.

setup()

Setup.

setup()

Setup.

setup()

Setup.

setupAbout()

Setup about line.

setupBindersCheckboxes()

Setup the binders checkboxes.

setupData()

Setup the data.

setupParsers()

Setup the parsers.

setupRenderTests(app)

Setup test line.

Parameters:
NameTypeDescription
appobject

The associated application.

setupTests()

Setup the tests.

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

splitAnnotationDivId(divId) → {object}

Split a divId to get dataId and annotationId.

Parameters:
NameTypeDescription
divIdstring

The divId.

Returns:

The data and annotation ID.

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

splitSegmentHtmlId(segmentId) → {object}

Get a segment index and number from an HTML id.

Parameters:
NameTypeDescription
segmentIdstring

The segment id.

Returns:

The segment index and number.

Type: 
object

splitSegmentationHtmlId(segmentationName) → {number}

Get a segmentation index from an HTML id.

Parameters:
NameTypeDescription
segmentationNamestring

The segmentation HTML id.

Returns:

The segmentation index.

Type: 
number

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

splitVersion(version) → {Array.<string>}

Split a string version into parts. The input version follows a 'm.n.p[-beta.q]' version sheme (related to semantic versioning).

Parameters:
NameTypeDescription
versionstring

The version.

Returns:

The splited version.

Type: 
Array.<string>

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

toStringId(arr, dimsopt) → {string}

Get a string id from array values in the form of: '#0-1_#1-2'.

Parameters:
NameTypeAttributesDescription
arrArray

The input array.

dimsArray.<number><optional>

Optional list of dimensions to use.

Returns:

The string id.

Type: 
string

toUID(str) → {string}

Convert a string into an UID.

Parameters:
NameTypeDescription
strstring

The input string.

Returns:

The input string converted to numbers using parseInt with a 36 radix (10 digits from 0 to 9 + 26 digits from a to z).

Type: 
string

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

updateDataList(datalist)

Update the data list of the data runner.

Parameters:
NameTypeDescription
datalistArray

The new data list.

updateSliders()

Update sliders: set the slider value to the current scroll index.

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

validateWindowLevel(wl, range, voiLutFunctionNameopt) → {WindowLevel|undefined}

Validate and constrain an input window level.

Parameters:
NameTypeAttributesDescription
wlWindowLevel

The window level to validate.

rangeobject

The image pixel data range.

voiLutFunctionNamestring<optional>

The VOI LUT function name, defaults to 'LINEAR'.

Returns:

A valid window level.

Type: 
WindowLevel | undefined

valueRange(values, end) → {object}

Get a multiple value iterator. The input array defines the values and their start index.

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

Parameters:
NameTypeDescription
valuesArray

An array of {index, value} pairs.

endnumber

The end of the range (excluded).

Returns:

An iterator folowing the iterator and iterable protocol.

Type: 
object

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

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:

PromiseCapability

Promise Capability object.

Type:
  • Object
Properties
NameTypeDescription
promisePromise

A promise object.

resolvefunction

Fullfills the promise.

rejectfunction

Rejects the promise.

TypedArray

List of compatible typed arrays.

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

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
valuenumber | Array.<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.

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