dwv. math

Classes

BucketQueue
Circle
Ellipse
Index
Line
Matrix33
Path
Point
Point2D
Point3D
ROI
Rectangle
Scissors
SimpleStats
Vector3D

Methods

(static) computeGradient(greyscale) → {object}

Parameters:
NameTypeDescription
greyscaleobject

The input greyscale-

Returns:

A gradient object

Type: 
object

(static) computeGreyscale(data, width, height) → {Array}

Parameters:
NameTypeDescription
dataArray

The input data.

widthnumber

The width of the output.

heightnumber

The height of the output.

Returns:

A greyscale object

Type: 
Array

(static) computeLaplace(greyscale) → {object}

Parameters:
NameTypeDescription
greyscaleobject

The input greyscale.

Returns:

A laplace object.

Type: 
object

(static) getAngle(line0, line1) → {number}

Get the angle between two lines in degree.

Parameters:
NameTypeDescription
line0dwv.math.Line

The first line.

line1dwv.math.Line

The second line.

Returns:

The angle.

Type: 
number

(static) getCoronalMat33() → {dwv.math.Matrix33}

Create a 3x3 coronal (xzy) matrix.

Returns:

The coronal matrix.

Type: 
dwv.math.Matrix33

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

Get the indices that form a ellpise.

Parameters:
NameTypeDescription
centerdwv.math.Index

The ellipse center.

radiusArray

The 2 ellipse radiuses.

dirArray

The 2 ellipse directions.

Returns:

The indices of the ellipse.

Type: 
Array

(static) getEqualPoint3DFunction(point) → {function}

Get an array find callback for an equal input point.

Parameters:
NameTypeDescription
pointdwv.math.Point3D

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

(static) getFullStats(array) → {dwv.math.FullStats}

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

Parameters:
NameTypeDescription
arrayArray

The array of values to extract stats from.

Returns:

A full stats object.

Type: 
dwv.math.FullStats

(static) getIdentityMat33() → {dwv.math.Matrix33}

Create a 3x3 identity matrix.

Returns:

The identity matrix.

Type: 
dwv.math.Matrix33

(static) getIndexCompareFunction(direction) → {function}

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

Parameters:
NameTypeDescription
directionnumber

The direction to use to compare indices.

Returns:

A function that compares two dwv.math.Index.

Type: 
function

(static) getIndexFromStringId(inputStr) → {dwv.math.Index}

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

Parameters:
NameTypeDescription
inputStrstring

The input string.

Returns:

The corresponding index.

Type: 
dwv.math.Index

(static) getMatrixFromName(name) → {dwv.math.Matrix33}

Get an orientation matrix from a name.

Parameters:
NameTypeDescription
namestring

The orientation name.

Returns:

The orientation matrix.

Type: 
dwv.math.Matrix33

(static) getMatrixInverse(m) → {dwv.math.Matrix33|undefined}

Get the inverse of an input 3*3 matrix.

Parameters:
NameTypeDescription
mdwv.math.Matrix33

The input matrix.

Returns:

The inverse matrix or undefined if the determinant is zero.

Type: 
dwv.math.Matrix33 | undefined

(static) getPercentile(array, ratio) → {number}

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

Parameters:
NameTypeDescription
arrayArray

The sorted array of values.

rationumber

The percentile ratio [0-1].

Returns:

The percentile,

Type: 
number

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

Get a perpendicular line to an input one.

Parameters:
NameTypeDescription
linedwv.math.Line

The line to be perpendicular to.

pointdwv.math.Point2D

The middle point of the perpendicular line.

lengthnumber

The length of the perpendicular line.

Returns:

A perpendicular line.

Type: 
object

(static) getSagittalMat33() → {dwv.math.Matrix33}

Create a 3x3 sagittal (yzx) matrix.

Returns:

The sagittal matrix.

Type: 
dwv.math.Matrix33

(static) getSimilarPoint3DFunction(point, tol) → {function}

Get an array find callback for a similar input point.

Parameters:
NameTypeDescription
pointdwv.math.Point3D

The point to compare to.

tolnumber

The comparison tolerance default to Number.EPSILON.

Returns:

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

Type: 
function

(static) getSimpleStats(array) → {dwv.math.SimpleStats}

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

Parameters:
NameTypeDescription
arrayArray

The array of values to extract stats from.

Returns:

A simple stats object.

Type: 
dwv.math.SimpleStats

(static) getStats(array, flags) → {dwv.math.Stats}

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

Parameters:
NameTypeDescription
arrayArray

The array of values to extract stats from.

flagsArray

A list of stat values to calculate.

Returns:

A stats object.

Type: 
dwv.math.Stats

(static) getZeroIndex(size) → {dwv.math.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: 
dwv.math.Index

(static) guid() → {string}

Returns:

A unique ID.

Type: 
string

(static) includesFullStatsFlags(flags) → {boolean}

Does the input flag list contain a full stat element?

Parameters:
NameTypeDescription
flagsArray

A list of stat values to calculate.

Returns:

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

Type: 
boolean

(static) isIdentityMat33(mat33) → {boolean}

Check if a matrix is a 3x3 identity matrix.

Parameters:
NameTypeDescription
mat33dwv.math.Matrix33

The matrix to test.

Returns:

True if identity.

Type: 
boolean

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

Check if two numbers are similar.

Parameters:
NameTypeDescription
anumber

The first number.

bnumber

The second number.

tolnumber

The comparison tolerance default to Number.EPSILON.

Returns:

True if similar.

Type: 
boolean

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

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

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