The X Toolkit API

X.labelmap

/**
* Pseudo-class for a X.labelmap which derives from X.volume and is used to
* distinguish between a volume and a label map. An X.labelmap will never be
* rendered separately - but an X.volume object can be used to display solely a
* label map.
*
* @constructor
* @extends X.volume
*/
var l = new X.labelmap();
/**
* Flag to show borders or not.
*
* @type {boolean}
* @protected
*/
l._borders = $_BORDERS;
/**
* The caption of this object.
*
* @type {?string}
* @protected
*/
l._caption = $_CAPTION;
/**
* The center of this volume.
*
* @type {!Array}
* @protected
*/
l._center = $_CENTER;
/**
* The children of this object.
*
* @type {!Array}
* @protected
*/
l._children = $_CHILDREN;
/**
* The className of this class.
*
* @type {string}
* @protected
*/
l._classname = $_CLASSNAME;
/**
* The object color. By default, this is white.
*
* @type {!Array}
* @public
*/
l._color = $_COLOR;
/**
* The point colors of this object.
*
* @type {?X.triplets}
* @protected
*/
l._colors = $_COLORS;
/**
* The color table of this object.
*
* @type {?X.colortable}
* @protected
*/
l._colortable = $_COLORTABLE;
/**
* The dimensions of this volume.
*
* @type {!Array}
* @protected
*/
l._dimensions = $_DIMENSIONS;
/**
* The 'dirty' flag of this object.
*
* @type {boolean}
* @protected
*/
l._dirty = $_DIRTY;
/**
* This distance of this object to the viewer's eye.
*
* @type {number}
* @protected
*/
l._distance = $_DISTANCE;
/**
* The file of this loadable object.
*
* @type {?X.file}
* @protected
*/
l._file = $_FILE;
/**
* The file data.
*
* @type {?ArrayBuffer}
* @protected
*/
l._filedata = $_FILEDATA;
/**
* The uniqueId of this instance. Each class instance in XTK has a uniqueId.
*
* @type {number}
* @protected
*/
l._id = $_ID;
/**
* The image data as a 3D array.
*
* @type {!Array}
* @protected
*/
l._image = $_IMAGE;
/**
* The index of the currently shown slice in X-direction.
*
* @type {!number}
* @public
*/
l._indexX = $_INDEXX;
/**
* The index of the formerly shown slice in X-direction.
*
* @type {!number}
* @protected
*/
l._indexXold = $_INDEXXOLD;
/**
* The index of the currently shown slice in Y-direction.
*
* @type {!number}
* @public
*/
l._indexY = $_INDEXY;
/**
* The index of the formerly shown slice in Y-direction.
*
* @type {!number}
* @protected
*/
l._indexYold = $_INDEXYOLD;
/**
* The index of the currently shown slice in Z-direction.
*
* @type {!number}
* @public
*/
l._indexZ = $_INDEXZ;
/**
* The index of the formerly shown slice in Z-direction.
*
* @type {!number}
* @protected
*/
l._indexZold = $_INDEXZOLD;
/**
* The label map of this volume.
*
* @type {?X.volume}
* @private
*/
l._labelmap = $_LABELMAP;
/**
* The line width, only used in X.displayable.types.LINES mode.
*
* @type {number}
* @protected
*/
l._linewidth = $_LINEWIDTH;
/**
* The lower threshold.
*
* @type {number}
* @protected
*/
l._lowerThreshold = $_LOWERTHRESHOLD;
/**
* The flag for the magic mode.
*
* @type {!boolean}
* @protected
*/
l._magicmode = $_MAGICMODE;
/**
* The upper threshold border.
*
* @type {number}
* @protected
*/
l._max = $_MAX;
/**
* The color to map the max. scalar.
*
* @type {!Array}
* @protected
*/
l._maxColor = $_MAXCOLOR;
/**
* The lower threshold border.
*
* @type {number}
* @protected
*/
l._min = $_MIN;
/**
* The color to map the min. scalar.
*
* @type {!Array}
* @protected
*/
l._minColor = $_MINCOLOR;
/**
* The normals of this object.
*
* @type {?X.triplets}
* @protected
*/
l._normals = $_NORMALS;
/**
* The opacity of this object.
*
* @type {number}
* @protected
*/
l._opacity = $_OPACITY;
/**
* An array reflecting the point or vertex indices.
*
* @type {!Array}
* @protected
*/
l._pointIndices = $_POINTINDICES;
/**
* The points of this object.
*
* @type {?X.triplets}
* @protected
*/
l._points = $_POINTS;
/**
* The point size, only used in X.displayable.types.POINTS mode.
*
* @type {number}
* @protected
*/
l._pointsize = $_POINTSIZE;
/**
* The reslicing flag.
*
* @type {!boolean}
* @protected
*/
l._reslicing = $_RESLICING;
/**
* The scalars of this object.
*
* @type {?X.scalars}
* @protected
*/
l._scalars = $_SCALARS;
/**
* The X.object holding the slices in X-direction.
*
* @type {!X.object}
* @protected
*/
l._slicesX = $_SLICESX;
/**
* The X.object holding the slices in Y-direction.
*
* @type {!X.object}
* @protected
*/
l._slicesY = $_SLICESY;
/**
* The X.object holding the slices in Z-direction.
*
* @type {!X.object}
* @protected
*/
l._slicesZ = $_SLICESZ;
/**
* The spacing of this volume.
*
* @type {!Array}
* @protected
*/
l._spacing = $_SPACING;
/**
* The texture of this object.
*
* @type {?X.texture}
* @protected
*/
l._texture = $_TEXTURE;
/**
* The mapping between object and texture coordinates.
*
* @type {?Array}
* @protected
*/
l._textureCoordinateMap = $_TEXTURECOORDINATEMAP;
/**
* The transform of this object.
*
* @type {!X.transform}
* @protected
*/
l._transform = $_TRANSFORM;
/**
* The rendering type of this object, default is
* {X.displayable.types.TRIANGLES}.
*
* @type {X.displayable.types}
* @protected
*/
l._type = $_TYPE;
/**
* The upper threshold.
*
* @type {number}
* @protected
*/
l._upperThreshold = $_UPPERTHRESHOLD;
/**
* The visibility of this object.
*
* @type {boolean}
* @public
*/
l._visible = $_VISIBLE;
/**
* The toggle for volume rendering or cross-sectional slicing.
*
* @type {boolean}
* @public
*/
l._volumeRendering = $_VOLUMERENDERING;
/**
* The direction for the volume rendering. This is used for caching.
*
* @type {!number}
* @private
*/
l._volumeRenderingDirection = $_VOLUMERENDERINGDIRECTION;
/**
* The cached toggle for volume rendering or cross-sectional slicing.
*
* @type {boolean}
* @public
*/
l._volumeRenderingOld = $_VOLUMERENDERINGOLD;
/**
* The upper window border.
*
* @type {!number}
* @private
*/
l._windowHigh = $_WINDOWHIGH;
/**
* The lower window border.
*
* @type {!number}
* @private
*/
l._windowLow = $_WINDOWLOW;
/**
* Return the borders flag.
*
* @return {boolean} TRUE if borders are enabled, FALSE otherwise.
* @public
*/
var _borders = l.borders;
/**
* Set the borders flag. Must be called before the volume gets created
* internally. After that, the borders can be modified using the children of
* each slice.
*
* @param {boolean} borders TRUE to enable borders, FALSE to disable them.
* @public
*/
l.borders = $BORDERS;
/**
* Get the caption of this object.
*
* @return {?string} The caption of this object.
* @public
*/
var _caption = l.caption;
/**
* Set the caption for this object.
*
* @param {?string} caption The caption for this object.
* @public
*/
l.caption = $CAPTION;
/**
* Get the center of this X.volume.
*
* @return {!Array} The center.
* @public
*/
var _center = l.center;
/**
* Set the center of this X.volume. This has to be called (for now) before a
* volume data gets loaded aka. before the first X.renderer.render() call.
*
* @param {!Array} center The new center.
* @throws {Error} If the center is invalid.
* @public
*/
l.center = $CENTER;
/**
* Get the children of this object. Each object can have N children which get
* automatically rendered when the top level object gets rendered.
*
* @return {!Array} The children of this object which are again objects.
*/
var _children = l.children;
/**
* Get the className of this object.
*
* @return {string} The className of this object.
* @public
*/
var _classname = l.classname;
/**
* Get the object color.
*
* @return {!Array} The object color.
*/
var _color = l.color;
/**
* Set the object color. This overrides any point colors.
*
* @param {!Array} color The object color as an array with length 3 and values
*          between 0..1.
* @throws {Error} An exception if the given color is invalid.
*/
l.color = $COLOR;
/**
* Get the point colors of this object.
*
* @return {!X.triplets} The point colors.
*/
var _colors = l.colors;
/**
* Set the colors of this object.
*
* @param {!X.triplets} colors The colors.
*/
l.colors = $COLORS;
/**
* The color table associated with this object.
*
* @return {?X.colortable} The color table.
*/
var _colortable = l.colortable;
/**
* Get the dimensions of this volume.
*
* @return {!Array} The dimensions of this volume.
* @public
*/
var _dimensions = l.dimensions;
/**
* Get the associated X.file for this object.
*
* @return {string} The associated file path or null if no file is associated.
*/
var _file = l.file;
/**
* Load this object from a file path or reset the associated file path.
*
* @param {?string|Array} filepath The file path/URL to load. If null, reset the
*          associated file. If an array is given, load multiple files (this
*          only works for DICOM so far).
*/
l.file = $FILEPATH;
/**
* Get the possibly attached file data for this object.
*
* @return {?string} The associated file data or null if none is attached.
*/
var _filedata = l.filedata;
/**
* Set raw file data for this object. Doing so, skips any additional loading and
* just parses this raw data.
*
* @param {?string|Array} filedata The raw file data to parse.
*/
l.filedata = $FILEDATA;
/**
* Get the id of this instance.
*
* @return {string} The className of this object.
* @public
*/
var _id = l.id;
/**
* Get the original image data of this volume.
*
* @return {!Array} A 3D array containing the pixel (image) data.
* @public
*/
var _image = l.image;
/**
* Get the slice index in X-direction.
*
* @return {!number} The slice index in X-direction.
* @public
*/
var _indexX = l.indexX;
/**
* Set the slice index in X-direction.
*
* @param {!number} indexX The slice index in X-direction.
* @public
*/
l.indexX = $INDEXX;
/**
* Get the slice index in Y-direction.
*
* @return {!number} The slice index in Y-direction.
* @public
*/
var _indexY = l.indexY;
/**
* Set the slice index in Y-direction.
*
* @param {!number} indexY The slice index in Y-direction.
* @public
*/
l.indexY = $INDEXY;
/**
* Get the slice index in Z-direction.
*
* @return {!number} The slice index in Z-direction.
* @public
*/
var _indexZ = l.indexZ;
/**
* Set the slice index in Z-direction.
*
* @param {!number} indexZ The slice index in Z-direction.
* @public
*/
l.indexZ = $INDEXZ;
/**
* Get the label map of this volume. A new label map gets created if required
* (Singleton).
*
* @return {!X.volume}
* @public
*/
var _labelmap = l.labelmap;
/**
* Get the line width of this object. The line width is only used in
* X.displayable.types.LINES rendering mode.
*
* @return {!number} The line width.
*/
var _linewidth = l.linewidth;
/**
* Set the line width for this object. The line width is only used in
* X.displayable.types.LINES rendering mode.
*
* @param {!number} width The line width.
* @throws {Error} An exception if the given width is invalid.
*/
l.linewidth = $WIDTH;
/**
* Get the lower threshold.
*
* @return {number} The lower threshold.
* @public
*/
var _lowerThreshold = l.lowerThreshold;
/**
* Set the lower threshold if it is inside the min-max range.
*
* @param {number} lowerThreshold
* @public
*/
l.lowerThreshold = $LOWERTHRESHOLD;
/**
* Get the magic mode flag.
*
* @return {!boolean} The magic mode flag.
*/
var _magicmode = l.magicmode;
/**
* Set the magic mode flag.
*
* @param {!boolean} magicmode The magic mode flag.
*/
l.magicmode = $MAGICMODE;
/**
* Get the max color which is used to map the scalars to colors in a linear
* fashion.
*
* @return {!Array} An array holding the r,g,b components of the color.
* @public
*/
var _maxColor = l.maxColor;
/**
* Set the max color to linear map the scalars to colors.
*
* @param {!Array} maxColor The color corresponding to the min. scalar value.
* @public
*/
l.maxColor = $MAXCOLOR;
/**
* Get the upper threshold border.
*
* @return {number} The upper threshold border.
* @public
*/
var _max = l.max;
/**
* Get the min color which is used to map the scalars to colors in a linear
* fashion.
*
* @return {!Array} An array holding the r,g,b components of the color.
* @public
*/
var _minColor = l.minColor;
/**
* Set the min color to linear map the scalars to colors.
*
* @param {!Array} minColor The color corresponding to the min. scalar value.
* @public
*/
l.minColor = $MINCOLOR;
/**
* Get the lower threshold border.
*
* @return {number} The lower threshold border.
* @public
*/
var _min = l.min;
/**
* Get the normals of this object.
*
* @return {!X.triplets} The normals.
*/
var _normals = l.normals;
/**
* Set the normals of this object.
*
* @param {!X.triplets} normals The normals.
*/
l.normals = $NORMALS;
/**
* Get the opacity of this object. If the object is fully opaque, this returns
* 1.
*
* @return {number} The opacity in the range 0..1.
*/
var _opacity = l.opacity;
/**
* Set the opacity of this object.
*
* @param {number} opacity The opacity value in the range 0..1.
*/
l.opacity = $OPACITY;
/**
* Get the points of this object.
*
* @return {!X.triplets} The points.
*/
var _points = l.points;
/**
* Set the points of this object.
*
* @param {!X.triplets} points The points.
*/
l.points = $POINTS;
/**
* Get the point size of this object. The point size is only used in
* X.displayable.types.POINTS rendering mode.
*
* @return {!number} The point size.
*/
var _pointsize = l.pointsize;
/**
* Set the point size for this object. The point size is only used in
* X.displayable.types.POINTS rendering mode.
*
* @param {!number} size The point size.
* @throws {Error} An exception if the given size is invalid.
*/
l.pointsize = $SIZE;
/**
* Return the reslicing flag.
*
* @return {boolean} TRUE if reslicing is enabled, FALSE otherwise.
* @public
*/
var _reslicing = l.reslicing;
/**
* Set the borders flag. Must be called before the volume gets created
* internally. After that, the borders can be modified using the children of
* each slice.
*
* @param {boolean} reslicing TRUE to enable reslicing, FALSE to disable it.
* @public
*/
l.reslicing = $RESLICING;
/**
* The scalars associated with this object.
*
* @return {?X.scalars} The scalars.
*/
var _scalars = l.scalars;
/**
* Get the texture of this object.
*
* @return {!X.texture} The texture.
*/
var _texture = l.texture;
/**
* Get the transform of this object.
*
* @return {!X.transform} The transform.
*/
var _transform = l.transform;
/**
* Get the render type of this object.
*
* @return {!string} The render type.
*/
var _type = l.type;
/**
* Set the render type of this object. Valid types are: TRIANGLES,
* TRIANGLE_STRIPS, LINES, POINTS, POLYGONS
*
* @param {!string} type The render type.
*/
l.type = $TYPE;
/**
* Get the upper threshold.
*
* @return {number} The upper threshold.
* @public
*/
var _upperThreshold = l.upperThreshold;
/**
* Set the upper threshold if it is inside the min-max range.
*
* @param {number} upperThreshold
* @public
*/
l.upperThreshold = $UPPERTHRESHOLD;
/**
* Get the visibility of this object.
*
* @return {boolean} TRUE if the object is visible, FALSE otherwise.
* @public
*/
var _visible = l.visible;
/**
* Set the visibility of this object.
*
* @param {boolean} visible The object's new visibility.
* @public
*/
l.visible = $VISIBLE;
/**
* Get the volume rendering setting of this X.volume.
*
* @public
*/
var _volumeRendering = l.volumeRendering;
/**
* Toggle volume rendering or cross-sectional slicing of this X.volume.
*
* @param {boolean} volumeRendering If TRUE, display volume rendering, if FALSE
*          display cross-sectional slices.
* @public
*/
l.volumeRendering = $VOLUMERENDERING;
/**
* Return the upper window border for window/level adjustment.
*
* @return {!number} The upper window border.
* @public
*/
var _windowHigh = l.windowHigh;
/**
* Set the upper window border for window/level adjustment.
*
* @param {!number} windowHigh The new upper window border.
* @public
*/
l.windowHigh = $WINDOWHIGH;
/**
* Return the lower window border for window/level adjustment.
*
* @return {!number} The lower window border.
* @public
*/
var _windowLow = l.windowLow;
/**
* Set the lower window border for window/level adjustment.
*
* @param {!number} windowLow The new lower window border.
* @public
*/
l.windowLow = $WINDOWLOW;
/**
* Copies the properties from a given volume to this volume.
*
* @param {*} volume The given volume.
* @protected
*/
l.copy_($VOLUME);
/**
* Create the volume.
*
* @private
*/
l.create_();
/**
* Fire a modified event for this object.
*
* @param {?boolean=} propagateEvent An optional flag to stop propagating down to child classes.
*/
l.modified($PROPAGATEEVENT);
/**
* Show the current slices which are set by this._indexX, this._indexY and
* this._indexZ and hide all others.
*/
l.slicing_();
/**
* Perform volume rendering of this volume along a specific direction. The
* direction is important since we show tiled 2d textures along the direction
* for a clean rendering experience.
*
* @param {number} direction The direction of the volume rendering
*          (0==x,1==y,2==z).
* @protected
*/
l.volumeRendering_($DIRECTION);
/**
* Compare two X.objects by their opacity values and their distance to the
* viewer's eye. Fully opaque objects should be always ordered before
* transparent ones, and the transparent ones should be ordered back-to-front in
* terms of the distance to the viewer's eye.
*
* @param {X.object} object1 Object1 to compare against Object2.
* @param {X.object} object2 Object2 to compare against Object1.
* @return {!number} 1, if Object1 should be ordered after Object2. -1, if
*         Object1 should be ordered before Object2
*/
var OPACITY_COMPARATOR = X.labelmap.OPACITY_COMPARATOR($OBJECT1, $OBJECT2);
/**
* Different render types for any displayable objects.
*
* @enum {string}
*/
X.labelmap.types();


CONSTRUCTORS
X.labelmap

PROPERTIES
_borders
_caption
_center
_children
_classname
_color
_colors
_colortable
_dimensions
_dirty
_distance
_file
_filedata
_id
_image
_indexX
_indexXold
_indexY
_indexYold
_indexZ
_indexZold
_labelmap
_linewidth
_lowerThreshold
_magicmode
_max
_maxColor
_min
_minColor
_normals
_opacity
_pointIndices
_points
_pointsize
_reslicing
_scalars
_slicesX
_slicesY
_slicesZ
_spacing
_texture
_textureCoordinateMap
_transform
_type
_upperThreshold
_visible
_volumeRendering
_volumeRenderingDirection
_volumeRenderingOld
_windowHigh
_windowLow

GETTERS/SETTERS
borders
caption
center
children
classname
color
colors
colortable
dimensions
file
filedata
id
image
indexX
indexY
indexZ
labelmap
linewidth
lowerThreshold
magicmode
maxColor
max
minColor
min
normals
opacity
points
pointsize
reslicing
scalars
texture
transform
type
upperThreshold
visible
volumeRendering
windowHigh
windowLow

FUNCTIONS
copy_
create_
modified
slicing_
volumeRendering_

STATIC
OPACITY_COMPARATOR
types



SOURCECODE