The X Toolkit API

X.parserTRK

/**
* Create a parser for the binary .TRK format.
*
* @constructor
* @extends X.parser
*/
var p = new X.parserTRK();
/**
* The className of this class.
*
* @type {string}
* @protected
*/
p._classname = $_CLASSNAME;
/**
* The data.
*
* @type {?ArrayBuffer}
* @protected
*/
p._data = $_DATA;
/**
* The pointer to the current byte.
*
* @type {!number}
* @protected
*/
p._dataPointer = $_DATAPOINTER;
/**
* The 'dirty' flag of this object.
*
* @type {boolean}
* @protected
*/
p._dirty = $_DIRTY;
/**
* The uniqueId of this instance. Each class instance in XTK has a uniqueId.
*
* @type {number}
* @protected
*/
p._id = $_ID;
/**
* The max value of the last parsing attempt.
*
* @type {!number}
* @protected
*/
p._lastMax = $_LASTMAX;
/**
* The min value of the last parsing attempt.
*
* @type {!number}
* @protected
*/
p._lastMin = $_LASTMIN;
/**
* The data-specific endianness flag.
*
* @type {!boolean}
* @protected
*/
p._littleEndian = $_LITTLEENDIAN;
/**
* The native endianness flag. Based on
* https://github.com/kig/DataStream.js/blob/master/DataStream.js
*
* @type {!boolean}
* @protected
*/
p._nativeLittleEndian = $_NATIVELITTLEENDIAN;
/**
* Get the className of this object.
*
* @return {string} The className of this object.
* @public
*/
var _classname = p.classname;
/**
* Get the id of this instance.
*
* @return {string} The className of this object.
* @public
*/
var _id = p.id;
/**
* Get the min and max values of an array.
*
* @param {!Array} data The data array to analyze.
* @return {!Array} An array with length 2 containing the [min, max] values.
*/
var arrayMinMax = p.arrayMinMax($DATA);
/**
* Flips typed array endianness in-place. Based on
* https://github.com/kig/DataStream.js/blob/master/DataStream.js.
*
* @param {!Object} array Typed array to flip.
* @param {!number} chunkSize The size of each element.
* @return {!Object} The converted typed array.
*/
var flipEndianness = p.flipEndianness($ARRAY, $CHUNKSIZE);
/**
* Jump to a position in the byte stream.
*
* @param {!number} position The new offset.
*/
p.jumpTo($POSITION);
/**
* Parse data and configure the given object. When complete, a
* X.parser.ModifiedEvent is fired.
*
* @param {!X.base} container A container which holds the loaded data. This can
*          be an X.object as well.
* @param {!X.object} object The object to configure.
* @param {!ArrayBuffer} data The data to parse.
* @param {*} flag An additional flag.
* @throws {Error} An exception if something goes wrong.
*/
p.parse($CONTAINER, $OBJECT, $DATA, $FLAG);
/**
* Create a string from a bunch of UChars. This replaces a
* String.fromCharCode.apply call and therefor supports more platforms (like the
* Android stock browser).
*
* @param {!Array|Uint8Array} array The Uint8Array.
* @param {?number=} start The start position. If undefined, use the whole
*          array.
* @param {?number=} end The end position. If undefined, use the whole array.
* @return {string} The created string.
*/
var parseChars = p.parseChars($ARRAY, $START, $END);
/**
* Reslice a data stream to fill the slices of an X.volume in X,Y and Z
* directions. The given volume (object) has to be created at this point
* according to the proper dimensions. This also takes care of a possible
* associated label map which has to be loaded before.
*
* @param {!X.object} object The X.volume to fill.
* @param {!Object} MRI The MRI object which contains the min, max, data and
*          type.
* @return {!Array} The volume data as a 3D Array.
*/
var reslice = p.reslice($OBJECT, $MRI);
/**
* Create Slice for a given colortable in one direction
*
* @param {!number} sizeX The volume size in X direction.
* @param {!number} sizeY The volume size in Y direction.
* @param {!number} sizeZ The volume size in Z direction.
* @param {!Array} image The array containing the image.
* @param {!number} max The object's max intensity.
* @param {!X.colortable} colorTable The colortable.
* @param {!X.object} targetSlice The object containing the slices to be
*          computed.
* @param {?X.volume} targetLabelMap The object containing the labelmap if any.
* @param {!boolean} invert invert rows and columns when accessing pixel value
* @protected
*/
p.reslice1DColorTable_($SIZEX, $SIZEY, $SIZEZ, $IMAGE, $MAX, $COLORTABLE, $TARGETSLICE, $TARGETLABELMAP, $INVERT);
/**
* Create Slice for a given volume in one direction
*
* @param {!number} sizeX The volume size in X direction.
* @param {!number} sizeY The volume size in Y direction.
* @param {!number} sizeZ The volume size in Z direction.
* @param {!Array} image The array containing the image.
* @param {!number} max The object's max intensity.
* @param {!X.object} targetSlice The object containing the slices to be
*          computed.
* @param {?X.volume} targetLabelMap The object containing the labelmap if any.
* @param {!boolean} invert invert rows and columns when accessing pixel value
* @protected
*/
p.reslice1D_($SIZEX, $SIZEY, $SIZEZ, $IMAGE, $MAX, $TARGETSLICE, $TARGETLABELMAP, $INVERT);
/**
* Create Slices for a colortable in two direction
*
* @param {!number} sizeX The volume size in X direction.
* @param {!number} sizeY The volume size in Y direction.
* @param {!number} sizeZ The volume size in Z direction.
* @param {!Array} image The array containing the image.
* @param {!number} max The object's max intensity.
* @param {!X.colortable} colorTable The colortable.
* @param {!X.object} targetSlice1 The object containing the slices to be
*          computed.
* @param {?X.volume} targetLabelMap1 The object containing the labelmap if any.
* @param {!X.object} targetSlice2 The object containing the slices to be
*          computed.
* @param {?X.volume} targetLabelMap2 The object containing the labelmap if any.
* @protected
*/
p.reslice2DColorTable_($SIZEX, $SIZEY, $SIZEZ, $IMAGE, $MAX, $COLORTABLE, $TARGETSLICE1, $TARGETLABELMAP1, $TARGETSLICE2, $TARGETLABELMAP2);
/**
* Create Slices for a given volume in two direction
*
* @param {!number} sizeX The volume size in X direction.
* @param {!number} sizeY The volume size in Y direction.
* @param {!number} sizeZ The volume size in Z direction.
* @param {!Array} image The array containing the image.
* @param {!number} max The object's max intensity.
* @param {!X.object} targetSlice1 The object containing the slices to be
*          computed.
* @param {?X.volume} targetLabelMap1 The object containing the labelmap if any.
* @param {!X.object} targetSlice2 The object containing the slices to be
*          computed.
* @param {?X.volume} targetLabelMap2 The object containing the labelmap if any.
* @protected
*/
p.reslice2D_($SIZEX, $SIZEY, $SIZEZ, $IMAGE, $MAX, $TARGETSLICE1, $TARGETLABELMAP1, $TARGETSLICE2, $TARGETLABELMAP2);
/**
* Scan binary data relative to the internal position in the byte stream.
*
* @param {!string} type The data type to scan, f.e.
*          'uchar','schar','ushort','sshort','uint','sint','float'
* @param {!number=} chunks The number of chunks to scan. By default, 1.
*/
p.scan($TYPE, $CHUNKS);


CONSTRUCTORS
X.parserTRK

PROPERTIES
_classname
_data
_dataPointer
_dirty
_id
_lastMax
_lastMin
_littleEndian
_nativeLittleEndian

GETTERS/SETTERS
classname
id

FUNCTIONS
arrayMinMax
flipEndianness
jumpTo
parse
parseChars
reslice
reslice1DColorTable_
reslice1D_
reslice2DColorTable_
reslice2D_
scan

STATIC



SOURCECODE