@niivue/niivue 0.53.1 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +10 -0
- package/build/index.js +42 -9
- package/build/index.js.map +1 -1
- package/build/index.min.js +1 -1
- package/build/metafile-esm.json +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.js +42 -9
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/niivue.umd.js +19 -19
- package/package.json +1 -1
- package/src/niivue/index.ts +44 -8
- package/src/nvdocument.ts +9 -0
package/build/index.d.ts
CHANGED
|
@@ -683,6 +683,8 @@ declare enum COLORMAP_TYPE {
|
|
|
683
683
|
type NVConfigOptions = {
|
|
684
684
|
textHeight: number;
|
|
685
685
|
colorbarHeight: number;
|
|
686
|
+
colorbarWidth: number;
|
|
687
|
+
showColorbarBorder: boolean;
|
|
686
688
|
crosshairWidth: number;
|
|
687
689
|
crosshairWidthUnit: 'voxels' | 'mm' | 'percent';
|
|
688
690
|
crosshairGap: number;
|
|
@@ -721,6 +723,7 @@ type NVConfigOptions = {
|
|
|
721
723
|
yoke3Dto2DZoom: boolean;
|
|
722
724
|
isDepthPickMesh: boolean;
|
|
723
725
|
isCornerOrientationText: boolean;
|
|
726
|
+
isOrientationTextVisible: boolean;
|
|
724
727
|
heroImageFraction: number;
|
|
725
728
|
heroSliceType: SLICE_TYPE;
|
|
726
729
|
sagittalNoseLeft: boolean;
|
|
@@ -772,6 +775,7 @@ type NVConfigOptions = {
|
|
|
772
775
|
isAlphaClipDark: boolean;
|
|
773
776
|
gradientOrder: number;
|
|
774
777
|
gradientOpacity: number;
|
|
778
|
+
gradientAmount: number;
|
|
775
779
|
invertScrollDirection: boolean;
|
|
776
780
|
};
|
|
777
781
|
declare const DEFAULT_OPTIONS: NVConfigOptions;
|
|
@@ -2110,6 +2114,12 @@ declare class Niivue {
|
|
|
2110
2114
|
* @see {@link https://niivue.github.io/niivue/features/worldspace2.html | live demo usage}
|
|
2111
2115
|
*/
|
|
2112
2116
|
setCornerOrientationText(isCornerOrientationText: boolean): void;
|
|
2117
|
+
/**
|
|
2118
|
+
* determine if orientation text appears in 2D slice view.
|
|
2119
|
+
* @param isOrientationTextVisible - controls position of text
|
|
2120
|
+
* @example niivue.setIsOrientationTextVisible(false)
|
|
2121
|
+
*/
|
|
2122
|
+
setIsOrientationTextVisible(isOrientationTextVisible: boolean): void;
|
|
2113
2123
|
/**
|
|
2114
2124
|
* determine proportion of screen real estate devoted to rendering in multiplanar view.
|
|
2115
2125
|
* @param fraction - proportion of screen devoted to primary (hero) image (0 to disable)
|
package/build/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
17
17
|
import { mat4 as mat49, vec2, vec3 as vec314, vec4 as vec49 } from "gl-matrix";
|
|
18
18
|
|
|
19
19
|
// package.json
|
|
20
|
-
var version = "0.
|
|
20
|
+
var version = "0.55.0";
|
|
21
21
|
|
|
22
22
|
// src/logger.ts
|
|
23
23
|
var _Log = class _Log {
|
|
@@ -20386,6 +20386,10 @@ var COLORMAP_TYPE = /* @__PURE__ */ ((COLORMAP_TYPE2) => {
|
|
|
20386
20386
|
var DEFAULT_OPTIONS = {
|
|
20387
20387
|
textHeight: 0.06,
|
|
20388
20388
|
colorbarHeight: 0.05,
|
|
20389
|
+
colorbarWidth: -1,
|
|
20390
|
+
// automatic (full width)
|
|
20391
|
+
showColorbarBorder: true,
|
|
20392
|
+
// show border around the colorbar
|
|
20389
20393
|
crosshairWidth: 1,
|
|
20390
20394
|
crosshairWidthUnit: "voxels",
|
|
20391
20395
|
crosshairGap: 0,
|
|
@@ -20427,6 +20431,7 @@ var DEFAULT_OPTIONS = {
|
|
|
20427
20431
|
yoke3Dto2DZoom: false,
|
|
20428
20432
|
isDepthPickMesh: false,
|
|
20429
20433
|
isCornerOrientationText: false,
|
|
20434
|
+
isOrientationTextVisible: true,
|
|
20430
20435
|
heroImageFraction: 0,
|
|
20431
20436
|
heroSliceType: 4 /* RENDER */,
|
|
20432
20437
|
sagittalNoseLeft: false,
|
|
@@ -20492,6 +20497,7 @@ var DEFAULT_OPTIONS = {
|
|
|
20492
20497
|
isAlphaClipDark: false,
|
|
20493
20498
|
gradientOrder: 1,
|
|
20494
20499
|
gradientOpacity: 0,
|
|
20500
|
+
gradientAmount: 0,
|
|
20495
20501
|
invertScrollDirection: false
|
|
20496
20502
|
};
|
|
20497
20503
|
var INITIAL_SCENE_DATA = {
|
|
@@ -27095,6 +27101,15 @@ var Niivue = class {
|
|
|
27095
27101
|
this.opts.isCornerOrientationText = isCornerOrientationText;
|
|
27096
27102
|
this.updateGLVolume();
|
|
27097
27103
|
}
|
|
27104
|
+
/**
|
|
27105
|
+
* determine if orientation text appears in 2D slice view.
|
|
27106
|
+
* @param isOrientationTextVisible - controls position of text
|
|
27107
|
+
* @example niivue.setIsOrientationTextVisible(false)
|
|
27108
|
+
*/
|
|
27109
|
+
setIsOrientationTextVisible(isOrientationTextVisible) {
|
|
27110
|
+
this.opts.isOrientationTextVisible = isOrientationTextVisible;
|
|
27111
|
+
this.drawScene();
|
|
27112
|
+
}
|
|
27098
27113
|
/**
|
|
27099
27114
|
* determine proportion of screen real estate devoted to rendering in multiplanar view.
|
|
27100
27115
|
* @param fraction - proportion of screen devoted to primary (hero) image (0 to disable)
|
|
@@ -28286,10 +28301,13 @@ var Niivue = class {
|
|
|
28286
28301
|
this.renderShader = this.renderVolumeShader;
|
|
28287
28302
|
if (this.renderGradientValues) {
|
|
28288
28303
|
this.renderShader = this.renderGradientValuesShader;
|
|
28289
|
-
} else
|
|
28290
|
-
this.
|
|
28291
|
-
|
|
28292
|
-
|
|
28304
|
+
} else {
|
|
28305
|
+
this.opts.gradientAmount = gradientAmount;
|
|
28306
|
+
if (gradientAmount > 0 || this.opts.gradientOpacity > 0) {
|
|
28307
|
+
this.renderShader = this.renderGradientShader;
|
|
28308
|
+
} else if (gradientAmount < 0) {
|
|
28309
|
+
this.renderShader = this.renderSliceShader;
|
|
28310
|
+
}
|
|
28293
28311
|
}
|
|
28294
28312
|
this.initRenderShader(this.renderShader, gradientAmount);
|
|
28295
28313
|
this.renderShader.use(this.gl);
|
|
@@ -28323,6 +28341,9 @@ var Niivue = class {
|
|
|
28323
28341
|
}
|
|
28324
28342
|
this.initRenderShader(this.renderShader, this.gradientTextureAmount);
|
|
28325
28343
|
this.renderShader.use(this.gl);
|
|
28344
|
+
if (this.gradientTextureAmount > 0) {
|
|
28345
|
+
this.refreshLayers(this.volumes[0], 0);
|
|
28346
|
+
}
|
|
28326
28347
|
this.drawScene();
|
|
28327
28348
|
}
|
|
28328
28349
|
// not included in public docs.
|
|
@@ -28481,6 +28502,8 @@ var Niivue = class {
|
|
|
28481
28502
|
this.refreshDrawing();
|
|
28482
28503
|
}
|
|
28483
28504
|
}
|
|
28505
|
+
await this.setGradientOpacity(this.opts.gradientOpacity);
|
|
28506
|
+
await this.setVolumeRenderIllumination(this.opts.gradientAmount);
|
|
28484
28507
|
this.updateGLVolume();
|
|
28485
28508
|
this.drawScene();
|
|
28486
28509
|
this.onDocumentLoaded(document2);
|
|
@@ -32771,7 +32794,15 @@ var Niivue = class {
|
|
|
32771
32794
|
let txtHt = Math.max(this.opts.textHeight, 0.01);
|
|
32772
32795
|
txtHt = txtHt * Math.min(this.gl.canvas.height, this.gl.canvas.width);
|
|
32773
32796
|
const fullHt = 3 * txtHt;
|
|
32774
|
-
const
|
|
32797
|
+
const widthPercentage = this.opts.colorbarWidth > 0 && this.opts.colorbarWidth <= 1 ? this.opts.colorbarWidth : 1;
|
|
32798
|
+
const width = widthPercentage * this.gl.canvas.width;
|
|
32799
|
+
const leftTopWidthHeight = [
|
|
32800
|
+
(this.gl.canvas.width - width) / 2,
|
|
32801
|
+
// Center the colorbar horizontally
|
|
32802
|
+
this.gl.canvas.height - fullHt,
|
|
32803
|
+
width,
|
|
32804
|
+
fullHt
|
|
32805
|
+
];
|
|
32775
32806
|
this.colorbarHeight = leftTopWidthHeight[3] + 1;
|
|
32776
32807
|
return leftTopWidthHeight;
|
|
32777
32808
|
}
|
|
@@ -32797,7 +32828,9 @@ var Niivue = class {
|
|
|
32797
32828
|
this.colorbarHeight = leftTopWidthHeight[3] + 1;
|
|
32798
32829
|
const barLTWH = [leftTopWidthHeight[0] + margin, leftTopWidthHeight[1], leftTopWidthHeight[2] - 2 * margin, barHt];
|
|
32799
32830
|
const rimLTWH = [barLTWH[0] - 1, barLTWH[1] - 1, barLTWH[2] + 2, barLTWH[3] + 2];
|
|
32800
|
-
|
|
32831
|
+
if (this.opts.showColorbarBorder) {
|
|
32832
|
+
this.drawRect(rimLTWH, this.opts.crosshairColor);
|
|
32833
|
+
}
|
|
32801
32834
|
if (!this.colorbarShader) {
|
|
32802
32835
|
throw new Error("colorbarShader undefined");
|
|
32803
32836
|
}
|
|
@@ -33458,7 +33491,7 @@ var Niivue = class {
|
|
|
33458
33491
|
if (isNaN(customMM)) {
|
|
33459
33492
|
this.drawCrosshairs3D(false, 0.15, obj.modelViewProjectionMatrix, true, this.opts.isSliceMM);
|
|
33460
33493
|
}
|
|
33461
|
-
if (isStretchToScreen) {
|
|
33494
|
+
if (isStretchToScreen && this.opts.isOrientationTextVisible) {
|
|
33462
33495
|
this.drawSliceOrientationText(leftTopWidthHeight, axCorSag);
|
|
33463
33496
|
}
|
|
33464
33497
|
this.readyForSync = true;
|
|
@@ -33492,7 +33525,7 @@ var Niivue = class {
|
|
|
33492
33525
|
if (customMM === Infinity || customMM === -Infinity || axCorSag === 4 /* RENDER */) {
|
|
33493
33526
|
return;
|
|
33494
33527
|
}
|
|
33495
|
-
if (leftTopWidthHeight[2] !== 0 && leftTopWidthHeight[3] !== 0) {
|
|
33528
|
+
if (leftTopWidthHeight[2] !== 0 && leftTopWidthHeight[3] !== 0 && this.opts.isOrientationTextVisible) {
|
|
33496
33529
|
this.drawSliceOrientationText(leftTopWidthHeight, axCorSag, padLeftTop);
|
|
33497
33530
|
}
|
|
33498
33531
|
}
|