Module: core/utils

General purpose functions.
Source:

Methods

(static) aabb2LPS(xCos, yCos, zCos, origin) → {*}

Compute AABB to LPS transform. AABB: Axe Aligned Bounding Box.
Parameters:
Name Type Description
xCos *
yCos *
zCos *
origin *
Source:
Returns:
Type
*

(static) bbox(center, halfDimensions) → {Object|boolean}

Generate a bouding box object.
Parameters:
Name Type Description
center Vector3 Center of the box.
halfDimensions Vector3 Half Dimensions of the box.
Source:
Returns:
  • The bounding box object. {Object.min} is a {Vector3} containing the min bounds. {Object.max} is a {Vector3} containing the max bounds.
    Type
    Object
  • False input NOT valid.
    Type
    boolean
Example
// Returns
//{ min: { x : 0, y : 0,  z : 0 },
//  max: { x : 2, y : 4,  z : 6 }
//}
VJS.Core.Utils.bbox(
  new Vector3(1, 2, 3), new Vector3(1, 2, 3));

//Returns false
VJS.Core.Utils.bbox(new Vector3(), new Matrix4());

(static) centerOfMass(points) → {Vector3}

Convenience function to extract center of mass from list of points.
Parameters:
Name Type Description
points Array.<Vector3> Set of points from which we want to extract the center of mass.
Source:
Returns:
Center of mass from given points.
Type
Vector3

(static) getGeometryArea(geometry) → {Number}

Calculate shape area (sum of triangle polygons area). May be inaccurate or completely wrong for some shapes.
Parameters:
Name Type Description
geometry THREE.Geometry
Source:
Returns:
Type
Number

(static) getPixelData(stack, coordinate) → {*}

Get voxel value
Parameters:
Name Type Description
stack ModelsStack
coordinate Vector3
Source:
Returns:
Type
*

(static) getRoI(mesh, camera, stack) → {Object|null}

Get min, max, mean and sd of voxel values behind the mesh
Parameters:
Name Type Description
mesh THREE.Mesh Region of Interest
camera * Tested on CamerasOrthographic
stack ModelsStack
Source:
Returns:
Type
Object | null

(static) ijk2LPS(xCos, yCos, zCos, spacing, origin, registrationMatrix) → {*}

Compute IJK to LPS tranform. http://nipy.org/nibabel/dicom/dicom_orientation.html
Parameters:
Name Type Description
xCos *
yCos *
zCos *
spacing *
origin *
registrationMatrix *
Source:
Returns:
Type
*

(static) isElement(obj) → {boolean}

Check HTMLElement
Parameters:
Name Type Description
obj HTMLElement
Source:
Returns:
Type
boolean

(static) isString(str) → {Boolean}

Check string
Parameters:
Name Type Description
str String
Source:
Returns:
Type
Boolean

(static) minMax(data) → {Array}

Find min/max values in an array
Parameters:
Name Type Description
data Array
Source:
Returns:
Type
Array

(private, static) orderIntersections(points, direction) → {Array.<Object>}

Order 3D planar points around a refence point.
Parameters:
Name Type Description
points Array.<Vector3> Set of planar 3D points to be ordered.
direction Vector3 Direction of the plane in which points and reference are sitting.
Source:
Returns:
Set of object representing the ordered points.
Type
Array.<Object>

(static) parseUrl(url) → {Object}

Parse url and find out the extension of the exam file.
Parameters:
Name Type Description
url * The url to be parsed. The query string can contain some "special" parameters that can be used to ease the parsing process when the url doesn't match the exam file name on the filesystem: - filename: the name of the exam file - contentType: the mime type of the exam file. Currently only "application/dicom" is recognized, nifti files don't have a standard mime type. For example: http:///getExam?id=100&filename=myexam%2Enii%2Egz http:///getExam?id=100&contentType=application%2Fdicom
Source:
Returns:
Type
Object

(static) rescaleSlopeIntercept(value, slope, intercept) → {*}

Apply slope/intercept to a value
Parameters:
Name Type Description
value *
slope *
intercept *
Source:
Returns:
Type
*

(static) setPixelData(stack, coordinate, value) → {*}

Set voxel value
Parameters:
Name Type Description
stack ModelsStack
coordinate Vector3
value Number
Source:
Returns:
Type
*

(static) worldToData(lps2IJK, worldCoordinates) → {*}

Transform coordinates from world coordinate to data
Parameters:
Name Type Description
lps2IJK *
worldCoordinates *
Source:
Returns:
Type
*