|
@@ -157,7 +157,7 @@
|
|
|
* If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume
|
|
|
*/
|
|
|
|
|
|
- var lowerThreshold = - Infinity;
|
|
|
+ let lowerThreshold = - Infinity;
|
|
|
Object.defineProperty( this, 'lowerThreshold', {
|
|
|
get: function () {
|
|
|
|
|
@@ -180,7 +180,7 @@
|
|
|
* If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume
|
|
|
*/
|
|
|
|
|
|
- var upperThreshold = Infinity;
|
|
|
+ let upperThreshold = Infinity;
|
|
|
Object.defineProperty( this, 'upperThreshold', {
|
|
|
get: function () {
|
|
|
|
|
@@ -248,9 +248,9 @@
|
|
|
*/
|
|
|
reverseAccess: function ( index ) {
|
|
|
|
|
|
- var z = Math.floor( index / ( this.yLength * this.xLength ) );
|
|
|
- var y = Math.floor( ( index - z * this.yLength * this.xLength ) / this.xLength );
|
|
|
- var x = index - z * this.yLength * this.xLength - y * this.xLength;
|
|
|
+ const z = Math.floor( index / ( this.yLength * this.xLength ) );
|
|
|
+ const y = Math.floor( ( index - z * this.yLength * this.xLength ) / this.xLength );
|
|
|
+ const x = index - z * this.yLength * this.xLength - y * this.xLength;
|
|
|
return [ x, y, z ];
|
|
|
|
|
|
},
|
|
@@ -267,10 +267,10 @@
|
|
|
*/
|
|
|
map: function ( functionToMap, context ) {
|
|
|
|
|
|
- var length = this.data.length;
|
|
|
+ const length = this.data.length;
|
|
|
context = context || this;
|
|
|
|
|
|
- for ( var i = 0; i < length; i ++ ) {
|
|
|
+ for ( let i = 0; i < length; i ++ ) {
|
|
|
|
|
|
this.data[ i ] = functionToMap.call( context, this.data[ i ], i, this.data );
|
|
|
|
|
@@ -289,21 +289,13 @@
|
|
|
*/
|
|
|
extractPerpendicularPlane: function ( axis, RASIndex ) {
|
|
|
|
|
|
- var iLength,
|
|
|
- jLength,
|
|
|
- sliceAccess,
|
|
|
- planeMatrix = new THREE.Matrix4().identity(),
|
|
|
- volume = this,
|
|
|
- planeWidth,
|
|
|
- planeHeight,
|
|
|
- firstSpacing,
|
|
|
- secondSpacing,
|
|
|
- positionOffset,
|
|
|
- IJKIndex;
|
|
|
- var axisInIJK = new THREE.Vector3(),
|
|
|
+ let firstSpacing, secondSpacing, positionOffset, IJKIndex;
|
|
|
+ const axisInIJK = new THREE.Vector3(),
|
|
|
firstDirection = new THREE.Vector3(),
|
|
|
- secondDirection = new THREE.Vector3();
|
|
|
- var dimensions = new THREE.Vector3( this.xLength, this.yLength, this.zLength );
|
|
|
+ secondDirection = new THREE.Vector3(),
|
|
|
+ planeMatrix = new THREE.Matrix4().identity(),
|
|
|
+ volume = this;
|
|
|
+ const dimensions = new THREE.Vector3( this.xLength, this.yLength, this.zLength );
|
|
|
|
|
|
switch ( axis ) {
|
|
|
|
|
@@ -346,45 +338,44 @@
|
|
|
}
|
|
|
|
|
|
firstDirection.applyMatrix4( volume.inverseMatrix ).normalize();
|
|
|
- firstDirection.argVar = 'i';
|
|
|
+ firstDirection.arglet = 'i';
|
|
|
secondDirection.applyMatrix4( volume.inverseMatrix ).normalize();
|
|
|
- secondDirection.argVar = 'j';
|
|
|
+ secondDirection.arglet = 'j';
|
|
|
axisInIJK.applyMatrix4( volume.inverseMatrix ).normalize();
|
|
|
- iLength = Math.floor( Math.abs( firstDirection.dot( dimensions ) ) );
|
|
|
- jLength = Math.floor( Math.abs( secondDirection.dot( dimensions ) ) );
|
|
|
- planeWidth = Math.abs( iLength * firstSpacing );
|
|
|
- planeHeight = Math.abs( jLength * secondSpacing );
|
|
|
+ const iLength = Math.floor( Math.abs( firstDirection.dot( dimensions ) ) );
|
|
|
+ const jLength = Math.floor( Math.abs( secondDirection.dot( dimensions ) ) );
|
|
|
+ const planeWidth = Math.abs( iLength * firstSpacing );
|
|
|
+ const planeHeight = Math.abs( jLength * secondSpacing );
|
|
|
IJKIndex = Math.abs( Math.round( IJKIndex.applyMatrix4( volume.inverseMatrix ).dot( axisInIJK ) ) );
|
|
|
- var base = [ new THREE.Vector3( 1, 0, 0 ), new THREE.Vector3( 0, 1, 0 ), new THREE.Vector3( 0, 0, 1 ) ];
|
|
|
- var iDirection = [ firstDirection, secondDirection, axisInIJK ].find( function ( x ) {
|
|
|
+ const base = [ new THREE.Vector3( 1, 0, 0 ), new THREE.Vector3( 0, 1, 0 ), new THREE.Vector3( 0, 0, 1 ) ];
|
|
|
+ const iDirection = [ firstDirection, secondDirection, axisInIJK ].find( function ( x ) {
|
|
|
|
|
|
return Math.abs( x.dot( base[ 0 ] ) ) > 0.9;
|
|
|
|
|
|
} );
|
|
|
- var jDirection = [ firstDirection, secondDirection, axisInIJK ].find( function ( x ) {
|
|
|
+ const jDirection = [ firstDirection, secondDirection, axisInIJK ].find( function ( x ) {
|
|
|
|
|
|
return Math.abs( x.dot( base[ 1 ] ) ) > 0.9;
|
|
|
|
|
|
} );
|
|
|
- var kDirection = [ firstDirection, secondDirection, axisInIJK ].find( function ( x ) {
|
|
|
+ const kDirection = [ firstDirection, secondDirection, axisInIJK ].find( function ( x ) {
|
|
|
|
|
|
return Math.abs( x.dot( base[ 2 ] ) ) > 0.9;
|
|
|
|
|
|
} );
|
|
|
|
|
|
- sliceAccess = function ( i, j ) {
|
|
|
+ function sliceAccess( i, j ) {
|
|
|
|
|
|
- var accessI, accessJ, accessK;
|
|
|
- var si = iDirection === axisInIJK ? IJKIndex : iDirection.argVar === 'i' ? i : j;
|
|
|
- var sj = jDirection === axisInIJK ? IJKIndex : jDirection.argVar === 'i' ? i : j;
|
|
|
- var sk = kDirection === axisInIJK ? IJKIndex : kDirection.argVar === 'i' ? i : j; // invert indices if necessary
|
|
|
+ const si = iDirection === axisInIJK ? IJKIndex : iDirection.arglet === 'i' ? i : j;
|
|
|
+ const sj = jDirection === axisInIJK ? IJKIndex : jDirection.arglet === 'i' ? i : j;
|
|
|
+ const sk = kDirection === axisInIJK ? IJKIndex : kDirection.arglet === 'i' ? i : j; // invert indices if necessary
|
|
|
|
|
|
- var accessI = iDirection.dot( base[ 0 ] ) > 0 ? si : volume.xLength - 1 - si;
|
|
|
- var accessJ = jDirection.dot( base[ 1 ] ) > 0 ? sj : volume.yLength - 1 - sj;
|
|
|
- var accessK = kDirection.dot( base[ 2 ] ) > 0 ? sk : volume.zLength - 1 - sk;
|
|
|
+ const accessI = iDirection.dot( base[ 0 ] ) > 0 ? si : volume.xLength - 1 - si;
|
|
|
+ const accessJ = jDirection.dot( base[ 1 ] ) > 0 ? sj : volume.yLength - 1 - sj;
|
|
|
+ const accessK = kDirection.dot( base[ 2 ] ) > 0 ? sk : volume.zLength - 1 - sk;
|
|
|
return volume.access( accessI, accessJ, accessK );
|
|
|
|
|
|
- };
|
|
|
+ }
|
|
|
|
|
|
return {
|
|
|
iLength: iLength,
|
|
@@ -407,7 +398,7 @@
|
|
|
*/
|
|
|
extractSlice: function ( axis, index ) {
|
|
|
|
|
|
- var slice = new THREE.VolumeSlice( this, index, axis );
|
|
|
+ const slice = new THREE.VolumeSlice( this, index, axis );
|
|
|
this.sliceList.push( slice );
|
|
|
return slice;
|
|
|
|
|
@@ -437,17 +428,17 @@
|
|
|
*/
|
|
|
computeMinMax: function () {
|
|
|
|
|
|
- var min = Infinity;
|
|
|
- var max = - Infinity; // buffer the length
|
|
|
+ let min = Infinity;
|
|
|
+ let max = - Infinity; // buffer the length
|
|
|
|
|
|
- var datasize = this.data.length;
|
|
|
- var i = 0;
|
|
|
+ const datasize = this.data.length;
|
|
|
+ let i = 0;
|
|
|
|
|
|
for ( i = 0; i < datasize; i ++ ) {
|
|
|
|
|
|
if ( ! isNaN( this.data[ i ] ) ) {
|
|
|
|
|
|
- var value = this.data[ i ];
|
|
|
+ const value = this.data[ i ];
|
|
|
min = Math.min( min, value );
|
|
|
max = Math.max( max, value );
|
|
|
|