@niivue/niivue 0.64.0 → 0.65.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/drawing/index.d.ts +1 -1
- package/build/drawing/index.js +20 -12
- package/build/drawing/index.js.map +1 -1
- package/build/index.min.js +1 -1
- package/build/metafile-esm.json +1 -1
- package/build/niivue/index.d.ts +70 -33
- package/build/niivue/index.js +835 -367
- package/build/niivue/index.js.map +1 -1
- package/build/{nvdocument-CxO85hZK.d.ts → nvdocument-Bma8slLJ.d.ts} +15 -18
- package/build/utils/index.d.ts +1 -1
- package/dist/index.d.ts +82 -48
- package/dist/index.js +814 -346
- 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 +331 -255
- package/package.json +2 -3
- package/src/colortables.ts +15 -3
- package/src/index.html +77 -59
- package/src/niivue/index.ts +263 -161
- package/src/nvdocument.ts +55 -33
- package/src/nvimage/ImageReaders/nii.ts +0 -4
- package/src/nvmesh-loaders.ts +290 -27
- package/src/nvmesh-types.ts +1 -0
- package/src/nvmesh-utilities.ts +2 -1
- package/src/nvmesh.ts +62 -36
- package/src/shader-srcs.ts +213 -137
package/build/drawing/index.d.ts
CHANGED
package/build/drawing/index.js
CHANGED
|
@@ -8089,12 +8089,22 @@ var ColorTables = class {
|
|
|
8089
8089
|
const cmap = this.colormapFromKey(key);
|
|
8090
8090
|
return this.makeLut(cmap.R, cmap.G, cmap.B, cmap.A, cmap.I, isInvert);
|
|
8091
8091
|
}
|
|
8092
|
-
makeLabelLut(cm, alphaFill = 255) {
|
|
8092
|
+
makeLabelLut(cm, alphaFill = 255, maxIdx = Infinity) {
|
|
8093
8093
|
if (cm.R === void 0 || cm.G === void 0 || cm.B === void 0) {
|
|
8094
8094
|
throw new Error(`Invalid colormap table: ${cm}`);
|
|
8095
8095
|
}
|
|
8096
8096
|
const nLabels = cm.R.length;
|
|
8097
8097
|
const idxs = cm.I ?? [...Array(nLabels).keys()];
|
|
8098
|
+
let hasInvalid = false;
|
|
8099
|
+
for (let i = 0; i < idxs.length; i++) {
|
|
8100
|
+
if (idxs[i] > maxIdx) {
|
|
8101
|
+
hasInvalid = true;
|
|
8102
|
+
idxs[i] = maxIdx;
|
|
8103
|
+
}
|
|
8104
|
+
}
|
|
8105
|
+
if (hasInvalid) {
|
|
8106
|
+
log.warn(`Some colormap indices clamped to match label range.`);
|
|
8107
|
+
}
|
|
8098
8108
|
if (nLabels !== cm.G.length || nLabels !== cm.B.length || nLabels !== idxs.length) {
|
|
8099
8109
|
throw new Error(
|
|
8100
8110
|
`colormap does not make sense: ${cm} Rs ${cm.R.length} Gs ${cm.G.length} Bs ${cm.B.length} Is ${idxs.length}`
|
|
@@ -8135,10 +8145,10 @@ var ColorTables = class {
|
|
|
8135
8145
|
}
|
|
8136
8146
|
return cmap;
|
|
8137
8147
|
}
|
|
8138
|
-
async makeLabelLutFromUrl(name) {
|
|
8148
|
+
async makeLabelLutFromUrl(name, alphaFill = 255, maxIdx = Infinity) {
|
|
8139
8149
|
const response = await fetch(name);
|
|
8140
8150
|
const cm = await response.json();
|
|
8141
|
-
return this.makeLabelLut(cm);
|
|
8151
|
+
return this.makeLabelLut(cm, alphaFill, maxIdx);
|
|
8142
8152
|
}
|
|
8143
8153
|
// not included in public docs
|
|
8144
8154
|
// The drawing colormap is a variant of the label colormap with precisely 256 colors
|
|
@@ -8428,15 +8438,14 @@ var DEFAULT_OPTIONS = {
|
|
|
8428
8438
|
fontColor: [0.5, 0.5, 0.5, 1],
|
|
8429
8439
|
selectionBoxColor: [1, 1, 1, 0.5],
|
|
8430
8440
|
clipPlaneColor: [0.7, 0, 0.7, 0.5],
|
|
8441
|
+
isClipPlanesCutaway: false,
|
|
8431
8442
|
paqdUniforms: [0.3, 0.5, 0.5, 1],
|
|
8432
8443
|
// paqdUniforms: [0.3, 0.9, 1.0, 0.5],
|
|
8433
|
-
clipThick: 2,
|
|
8434
|
-
clipVolumeLow: [0, 0, 0],
|
|
8435
|
-
clipVolumeHigh: [1, 1, 1],
|
|
8436
8444
|
rulerColor: [1, 0, 0, 0.8],
|
|
8437
8445
|
colorbarMargin: 0.05,
|
|
8438
8446
|
trustCalMinMax: true,
|
|
8439
8447
|
clipPlaneHotKey: "KeyC",
|
|
8448
|
+
cycleClipPlaneHotKey: "KeyP",
|
|
8440
8449
|
viewModeHotKey: "KeyV",
|
|
8441
8450
|
doubleTouchTimeout: 500,
|
|
8442
8451
|
longTouchTimeout: 1e3,
|
|
@@ -8546,13 +8555,12 @@ var INITIAL_SCENE_DATA = {
|
|
|
8546
8555
|
azimuth: 110,
|
|
8547
8556
|
elevation: 10,
|
|
8548
8557
|
crosshairPos: vec39.fromValues(0.5, 0.5, 0.5),
|
|
8549
|
-
|
|
8550
|
-
|
|
8558
|
+
clipPlanes: [[0, 0, 0, 0]],
|
|
8559
|
+
// start with no planes
|
|
8560
|
+
clipPlaneDepthAziElevs: [[2, 0, 0]],
|
|
8561
|
+
// empty by default
|
|
8551
8562
|
volScaleMultiplier: 1,
|
|
8552
|
-
pan2Dxyzmm: vec47.fromValues(0, 0, 0, 1)
|
|
8553
|
-
clipThick: 2,
|
|
8554
|
-
clipVolumeLow: [0, 0, 0],
|
|
8555
|
-
clipVolumeHigh: [1, 1, 1]
|
|
8563
|
+
pan2Dxyzmm: vec47.fromValues(0, 0, 0, 1)
|
|
8556
8564
|
};
|
|
8557
8565
|
|
|
8558
8566
|
// src/drawing/masks.ts
|