@niivue/niivue 0.49.0 → 0.50.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import { mat4, vec3, vec4, vec2 } from 'gl-matrix';
2
- import * as nifti from 'nifti-reader-js';
2
+ import { NIFTI1, NIFTI2 } from 'nifti-reader-js';
3
3
  import { WebSocketSubject } from 'rxjs/webSocket';
4
4
 
5
5
  type ColorMap = {
@@ -208,7 +208,8 @@ declare enum ImageType {
208
208
  HEAD = 15,
209
209
  DCM_FOLDER = 16,
210
210
  SRC = 17,
211
- FIB = 18
211
+ FIB = 18,
212
+ BMP = 19
212
213
  }
213
214
  type ImageFromUrlOptions = {
214
215
  url: string;
@@ -320,7 +321,7 @@ declare class NVImage {
320
321
  oblique_angle?: number;
321
322
  maxShearDeg?: number;
322
323
  useQFormNotSForm: boolean;
323
- alphaThreshold?: number;
324
+ colormapType?: number;
324
325
  pixDims?: number[];
325
326
  matRAS?: mat4;
326
327
  pixDimsRAS?: number[];
@@ -336,7 +337,7 @@ declare class NVImage {
336
337
  extentsMinOrtho?: number[];
337
338
  extentsMaxOrtho?: number[];
338
339
  mm2ortho?: mat4;
339
- hdr: nifti.NIFTI1 | nifti.NIFTI2 | null;
340
+ hdr: NIFTI1 | NIFTI2 | null;
340
341
  imageType?: ImageType;
341
342
  img?: TypedVoxelArray;
342
343
  imaginary?: Float32Array;
@@ -385,7 +386,9 @@ declare class NVImage {
385
386
  * @param colorbarVisible - TODO
386
387
  * @param colormapLabel - TODO
387
388
  */
388
- constructor(dataBuffer?: ArrayBuffer | ArrayBuffer[] | null, name?: string, colormap?: string, opacity?: number, pairedImgData?: ArrayBuffer | null, cal_min?: number, cal_max?: number, trustCalMinMax?: boolean, percentileFrac?: number, ignoreZeroVoxels?: boolean, useQFormNotSForm?: boolean, colormapNegative?: string, frame4D?: number, imageType?: ImageType, cal_minNeg?: number, cal_maxNeg?: number, colorbarVisible?: boolean, colormapLabel?: LUT | null);
389
+ constructor(dataBuffer?: ArrayBuffer | ArrayBuffer[] | null, name?: string, colormap?: string, opacity?: number, pairedImgData?: ArrayBuffer | null, cal_min?: number, cal_max?: number, trustCalMinMax?: boolean, percentileFrac?: number, ignoreZeroVoxels?: boolean, useQFormNotSForm?: boolean, colormapNegative?: string, frame4D?: number, imageType?: ImageType, cal_minNeg?: number, cal_maxNeg?: number, colorbarVisible?: boolean, colormapLabel?: LUT | null, colormapType?: number);
390
+ init(dataBuffer?: ArrayBuffer | ArrayBuffer[] | null, name?: string, colormap?: string, opacity?: number, _pairedImgData?: ArrayBuffer | null, cal_min?: number, cal_max?: number, trustCalMinMax?: boolean, percentileFrac?: number, ignoreZeroVoxels?: boolean, useQFormNotSForm?: boolean, colormapNegative?: string, frame4D?: number, imageType?: ImageType, cal_minNeg?: number, cal_maxNeg?: number, colorbarVisible?: boolean, colormapLabel?: LUT | null, colormapType?: number, imgRaw?: ArrayBuffer | null): void;
391
+ static new(dataBuffer?: ArrayBuffer | ArrayBuffer[] | null, name?: string, colormap?: string, opacity?: number, pairedImgData?: ArrayBuffer | null, cal_min?: number, cal_max?: number, trustCalMinMax?: boolean, percentileFrac?: number, ignoreZeroVoxels?: boolean, useQFormNotSForm?: boolean, colormapNegative?: string, frame4D?: number, imageType?: ImageType, cal_minNeg?: number, cal_maxNeg?: number, colorbarVisible?: boolean, colormapLabel?: LUT | null, colormapType?: number): Promise<NVImage>;
389
392
  computeObliqueAngle(mtx44: mat4): number;
390
393
  float32V1asRGBA(inImg: Float32Array): Uint8Array;
391
394
  loadImgV1(isFlipX?: boolean, isFlipY?: boolean, isFlipZ?: boolean): boolean;
@@ -394,16 +397,18 @@ declare class NVImage {
394
397
  SetPixDimFromSForm(): void;
395
398
  readECAT(buffer: ArrayBuffer): ArrayBuffer;
396
399
  readV16(buffer: ArrayBuffer): ArrayBuffer;
400
+ imageDataFromArrayBuffer(buffer: ArrayBuffer): Promise<ImageData>;
401
+ readBMP(buffer: ArrayBuffer): Promise<Uint8Array>;
397
402
  readVMR(buffer: ArrayBuffer): ArrayBuffer;
398
- readMGH(buffer: ArrayBuffer): ArrayBuffer;
399
- readFIB(buffer: ArrayBuffer): [ArrayBuffer, Float32Array];
400
- readSRC(buffer: ArrayBuffer): ArrayBuffer;
401
- readHEAD(dataBuffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
402
- readMHA(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
403
- readMIF(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
404
- readNRRD(dataBuffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
403
+ readMGH(buffer: ArrayBuffer): Promise<ArrayBuffer>;
404
+ readFIB(buffer: ArrayBuffer): Promise<[ArrayBuffer, Float32Array]>;
405
+ readSRC(buffer: ArrayBuffer): Promise<ArrayBuffer>;
406
+ readHEAD(dataBuffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): Promise<ArrayBuffer>;
407
+ readMHA(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): Promise<ArrayBuffer>;
408
+ readMIF(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): Promise<ArrayBuffer>;
409
+ readNRRD(dataBuffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): Promise<ArrayBuffer>;
405
410
  calculateRAS(): void;
406
- hdr2RAS(nVolumes?: number): nifti.NIFTI1 | nifti.NIFTI2;
411
+ hdr2RAS(nVolumes?: number): NIFTI1 | NIFTI2;
407
412
  img2RAS(nVolume?: number): TypedVoxelArray;
408
413
  vox2mm(XYZ: number[], mtx: mat4): vec3;
409
414
  mm2vox(mm: number[], frac?: boolean): Float32Array | vec3;
@@ -420,14 +425,15 @@ declare class NVImage {
420
425
  /**
421
426
  * set contrast/brightness to robust range (2%..98%)
422
427
  * @param vol - volume for estimate (use -1 to use estimate on all loaded volumes; use INFINITY for current volume)
428
+ * @param isBorder - if true (default) only center of volume used for estimate
423
429
  * @sets volume brightness and returns array [pct2, pct98, mnScale, mxScale]
424
430
  * @see {@link https://niivue.github.io/niivue/features/timeseries2.html | live demo usage}
425
431
  */
426
- calMinMax(vol?: number): number[];
432
+ calMinMax(vol?: number, isBorder?: boolean): number[];
427
433
  intensityRaw2Scaled(raw: number): number;
428
434
  intensityScaled2Raw(scaled: number): number;
429
- saveToUint8Array(fnm: string, drawing8?: Uint8Array | null): Uint8Array;
430
- saveToDisk(fnm?: string, drawing8?: Uint8Array | null): Uint8Array;
435
+ saveToUint8Array(fnm: string, drawing8?: Uint8Array | null): Promise<Uint8Array>;
436
+ saveToDisk(fnm?: string, drawing8?: Uint8Array | null): Promise<Uint8Array>;
431
437
  static fetchDicomData(url: string, headers?: Record<string, string>): Promise<Array<{
432
438
  name: string;
433
439
  data: ArrayBuffer;
@@ -455,7 +461,7 @@ declare class NVImage {
455
461
  */
456
462
  static createNiftiArray(dims?: number[], pixDims?: number[], affine?: number[], datatypeCode?: number, // DT_UINT8
457
463
  img?: Uint8Array): Uint8Array;
458
- static createNiftiHeader(dims?: number[], pixDims?: number[], affine?: number[], datatypeCode?: number): nifti.NIFTI1;
464
+ static createNiftiHeader(dims?: number[], pixDims?: number[], affine?: number[], datatypeCode?: number): NIFTI1;
459
465
  /**
460
466
  * read a 3D slab of voxels from a volume
461
467
  * @param voxStart - first row, column and slice (RAS order) for selection
@@ -480,7 +486,7 @@ declare class NVImage {
480
486
  * @example
481
487
  * myImage = NVImage.loadFromBase64('SomeBase64String')
482
488
  */
483
- static loadFromBase64({ base64, name, colormap, opacity, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels, useQFormNotSForm, colormapNegative, frame4D, imageType, cal_minNeg, cal_maxNeg, colorbarVisible, colormapLabel }: ImageFromBase64): NVImage;
489
+ static loadFromBase64({ base64, name, colormap, opacity, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels, useQFormNotSForm, colormapNegative, frame4D, imageType, cal_minNeg, cal_maxNeg, colorbarVisible, colormapLabel }: ImageFromBase64): Promise<NVImage>;
484
490
  /**
485
491
  * make a clone of a NVImage instance and return a new NVImage
486
492
  * @returns NVImage instance
@@ -610,6 +616,24 @@ declare enum DRAG_MODE {
610
616
  callbackOnly = 5,
611
617
  roiSelection = 6
612
618
  }
619
+ declare enum DRAG_MODE_SECONDARY {
620
+ none = 0,
621
+ contrast = 1,
622
+ measurement = 2,
623
+ pan = 3,
624
+ slicer3D = 4,
625
+ callbackOnly = 5,
626
+ roiSelection = 6
627
+ }
628
+ declare enum DRAG_MODE_PRIMARY {
629
+ crosshair = 0,
630
+ windowing = 1
631
+ }
632
+ declare enum COLORMAP_TYPE {
633
+ MIN_TO_MAX = 0,
634
+ ZERO_TO_MAX_TRANSPARENT_BELOW_MIN = 1,
635
+ ZERO_TO_MAX_TRANSLUCENT_BELOW_MIN = 2
636
+ }
613
637
  /**
614
638
  * NVConfigOptions
615
639
  */
@@ -649,7 +673,8 @@ type NVConfigOptions = {
649
673
  multiplanarShowRender: SHOW_RENDER;
650
674
  isRadiologicalConvention: boolean;
651
675
  meshThicknessOn2D: number | string;
652
- dragMode: DRAG_MODE;
676
+ dragMode: DRAG_MODE | DRAG_MODE_SECONDARY;
677
+ dragModePrimary: DRAG_MODE_PRIMARY;
653
678
  yoke3Dto2DZoom: boolean;
654
679
  isDepthPickMesh: boolean;
655
680
  isCornerOrientationText: boolean;
@@ -682,6 +707,7 @@ type NVConfigOptions = {
682
707
  renderOverlayBlend: number;
683
708
  sliceMosaicString: string;
684
709
  centerMosaic: boolean;
710
+ interactive: boolean;
685
711
  penSize: number;
686
712
  clickToSegment: boolean;
687
713
  clickToSegmentRadius: number;
@@ -1120,7 +1146,7 @@ type NVMeshLayer = {
1120
1146
  values: AnyNumberArray;
1121
1147
  outlineBorder?: number;
1122
1148
  isTransparentBelowCalMin?: boolean;
1123
- alphaThreshold?: boolean;
1149
+ colormapType?: number;
1124
1150
  base64?: string;
1125
1151
  colorbarVisible?: boolean;
1126
1152
  };
@@ -1134,6 +1160,7 @@ declare const NVMeshLayerDefaults: {
1134
1160
  cal_max: number;
1135
1161
  cal_minNeg: number;
1136
1162
  cal_maxNeg: number;
1163
+ colormapType: COLORMAP_TYPE;
1137
1164
  values: number[];
1138
1165
  };
1139
1166
  declare class NVMeshFromUrlOptions {
@@ -1248,6 +1275,7 @@ declare class NVMesh {
1248
1275
  updateFibers(gl: WebGL2RenderingContext): void;
1249
1276
  indexNearestXYZmm(Xmm: number, Ymm: number, Zmm: number): number[];
1250
1277
  unloadMesh(gl: WebGL2RenderingContext): void;
1278
+ blendColormap(u8: Uint8Array, additiveRGBA: Uint8Array, layer: NVMeshLayer, mn: number, mx: number, lut: Uint8ClampedArray, invert?: boolean): void;
1251
1279
  updateMesh(gl: WebGL2RenderingContext): void;
1252
1280
  reverseFaces(gl: WebGL2RenderingContext): void;
1253
1281
  hierarchicalOrder(): number;
@@ -1256,7 +1284,7 @@ declare class NVMesh {
1256
1284
  setLayerProperty(id: number, key: keyof NVMeshLayer, val: number | string | boolean, gl: WebGL2RenderingContext): Promise<void>;
1257
1285
  setProperty(key: keyof this, val: unknown, gl: WebGL2RenderingContext): void;
1258
1286
  generatePosNormClr(pts: Float32Array, tris: Uint32Array, rgba255: Uint8Array): Float32Array;
1259
- static readMesh(buffer: ArrayBuffer, name: string, gl: WebGL2RenderingContext, opacity?: number, rgba255?: Uint8Array, visible?: boolean): NVMesh;
1287
+ static readMesh(buffer: ArrayBuffer, name: string, gl: WebGL2RenderingContext, opacity?: number, rgba255?: Uint8Array, visible?: boolean): Promise<NVMesh>;
1260
1288
  static loadLayer(layer: NVMeshLayer, nvmesh: NVMesh): Promise<void>;
1261
1289
  /**
1262
1290
  * factory function to load and return a new NVMesh instance from a given URL
@@ -1273,35 +1301,6 @@ declare class NVMesh {
1273
1301
  * load and return a new NVMesh instance from a base64 encoded string
1274
1302
  */
1275
1303
  loadFromBase64({ base64, gl, name, opacity, rgba255, visible, layers }?: Partial<LoadFromBase64Params>): Promise<NVMesh>;
1276
- static readGII(buffer: ArrayBuffer): GII;
1277
- static readX3D(buffer: ArrayBuffer): X3D;
1278
- static readNII(buffer: ArrayBuffer, n_vert?: number): Uint8Array | Float32Array | Int32Array | Int16Array;
1279
- static readNII2(buffer: ArrayBuffer, n_vert?: number): Uint8Array | Float32Array | Int32Array | Int16Array;
1280
- static readMGH(buffer: ArrayBuffer): MGH;
1281
- static readSTL(buffer: ArrayBuffer): DefaultMeshType;
1282
- static readTxtSTL(buffer: ArrayBuffer): DefaultMeshType;
1283
- static readSRF(buffer: ArrayBuffer): DefaultMeshType;
1284
- static readFreeSurfer(buffer: ArrayBuffer): DefaultMeshType;
1285
- static readOBJ(buffer: ArrayBuffer): DefaultMeshType;
1286
- static readOFF(buffer: ArrayBuffer): DefaultMeshType;
1287
- static readGEO(buffer: ArrayBuffer, isFlipWinding?: boolean): DefaultMeshType;
1288
- static readICO(buffer: ArrayBuffer): DefaultMeshType;
1289
- static readPLY(buffer: ArrayBuffer): DefaultMeshType;
1290
- static readMZ3(buffer: ArrayBuffer, n_vert?: number): MZ3;
1291
- static readVTK(buffer: ArrayBuffer): VTK;
1292
- static readASC(buffer: ArrayBuffer): DefaultMeshType;
1293
- static readNV(buffer: ArrayBuffer): DefaultMeshType;
1294
- static readANNOT(buffer: ArrayBuffer, n_vert: number, isReadColortables?: boolean): ANNOT;
1295
- static readCURV(buffer: ArrayBuffer, n_vert: number): Float32Array;
1296
- static readSTC(buffer: ArrayBuffer, n_vert: number): Float32Array;
1297
- static readSMP(buffer: ArrayBuffer, n_vert: number): Float32Array;
1298
- static readTxtVTK(buffer: ArrayBuffer): VTK;
1299
- static readTRK(buffer: ArrayBuffer): TRK;
1300
- static readTCK(buffer: ArrayBuffer): TCK;
1301
- static readTSF(buffer: ArrayBuffer): Float32Array;
1302
- static readTT(buffer: ArrayBuffer): TT;
1303
- static readTRX(buffer: ArrayBuffer): TRX;
1304
- static readTRACT(buffer: ArrayBuffer): TRACT;
1305
1304
  }
1306
1305
 
1307
1306
  /**
@@ -1512,13 +1511,11 @@ declare class NVController {
1512
1511
  }
1513
1512
 
1514
1513
  type TypedNumberArray = Float64Array | Float32Array | Uint32Array | Uint16Array | Uint8Array | Int32Array | Int16Array | Int8Array;
1515
- /**
1516
- * Namespace for utility functions
1517
- * @ignore
1518
- */
1519
1514
  declare class NVUtilities {
1520
1515
  static arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
1521
- static readMatV4(buffer: ArrayBuffer): Record<string, TypedNumberArray>;
1516
+ static decompress(data: Uint8Array): Promise<Uint8Array>;
1517
+ static decompressToBuffer(data: Uint8Array): Promise<ArrayBuffer>;
1518
+ static readMatV4(buffer: ArrayBuffer): Promise<Record<string, TypedNumberArray>>;
1522
1519
  static b64toUint8(base64: string): Uint8Array;
1523
1520
  static uint8tob64(bytes: Uint8Array): string;
1524
1521
  static download(content: string | ArrayBuffer, fileName: string, contentType: string): void;
@@ -1526,8 +1523,25 @@ declare class NVUtilities {
1526
1523
  static blobToBase64(blob: Blob): Promise<string>;
1527
1524
  static decompressBase64String(base64: string): Promise<string>;
1528
1525
  static compressToBase64String(string: string): Promise<string>;
1526
+ /**
1527
+ * Converts a string into a Uint8Array for use with compression/decompression methods (101arrowz/fflate: MIT License)
1528
+ * @param str The string to encode
1529
+ * @param latin1 Whether or not to interpret the data as Latin-1. This should
1530
+ * not need to be true unless decoding a binary string.
1531
+ * @returns The string encoded in UTF-8/Latin-1 binary
1532
+ */
1533
+ static strToU8(str: string, latin1?: boolean): Uint8Array;
1534
+ static compress(data: Uint8Array, format?: CompressionFormat): Promise<ArrayBuffer>;
1529
1535
  static compressStringToArrayBuffer(input: string): Promise<ArrayBuffer>;
1530
1536
  static isArrayBufferCompressed(buffer: ArrayBuffer): boolean;
1537
+ /**
1538
+ * Converts a Uint8Array to a string (101arrowz/fflate: MIT License)
1539
+ * @param dat The data to decode to string
1540
+ * @param latin1 Whether or not to interpret the data as Latin-1. This should
1541
+ * not need to be true unless encoding to binary string.
1542
+ * @returns The original UTF-8/Latin-1 string
1543
+ */
1544
+ static strFromU8(dat: Uint8Array, latin1?: boolean): string;
1531
1545
  static decompressArrayBuffer(buffer: ArrayBuffer): Promise<string>;
1532
1546
  static arraysAreEqual(a: unknown[], b: unknown[]): boolean;
1533
1547
  /**
@@ -1557,14 +1571,14 @@ declare class NVUtilities {
1557
1571
  */
1558
1572
  declare class NVMeshLoaders {
1559
1573
  static readTRACT(buffer: ArrayBuffer): TRACT;
1560
- static readTT(buffer: ArrayBuffer): TT;
1561
- static readTRX(buffer: ArrayBuffer): TRX;
1574
+ static readTT(buffer: ArrayBuffer): Promise<TT>;
1575
+ static readTRX(buffer: ArrayBuffer): Promise<TRX>;
1562
1576
  static readTSF(buffer: ArrayBuffer, n_vert?: number): Float32Array;
1563
1577
  static readTCK(buffer: ArrayBuffer): TCK;
1564
- static readTRK(buffer: ArrayBuffer): TRK;
1578
+ static readTRK(buffer: ArrayBuffer): Promise<TRK>;
1565
1579
  static readTxtVTK(buffer: ArrayBuffer): VTK;
1566
- static readLayer(name: string, buffer: ArrayBuffer, nvmesh: NVMesh, opacity?: number, colormap?: string, colormapNegative?: string, useNegativeCmap?: boolean, cal_min?: number | null, cal_max?: number | null, outlineBorder?: number): NVMeshLayer | undefined;
1567
- static readSMP(buffer: ArrayBuffer, n_vert: number): Float32Array;
1580
+ static readLayer(name: string, buffer: ArrayBuffer, nvmesh: NVMesh, opacity?: number, colormap?: string, colormapNegative?: string, useNegativeCmap?: boolean, cal_min?: number | null, cal_max?: number | null, outlineBorder?: number): Promise<NVMeshLayer | undefined>;
1581
+ static readSMP(buffer: ArrayBuffer, n_vert: number): Promise<Float32Array>;
1568
1582
  static readSTC(buffer: ArrayBuffer, n_vert: number): Float32Array;
1569
1583
  static isCurv(buffer: ArrayBuffer): boolean;
1570
1584
  static readCURV(buffer: ArrayBuffer, n_vert: number): Float32Array;
@@ -1572,24 +1586,25 @@ declare class NVMeshLoaders {
1572
1586
  static readNV(buffer: ArrayBuffer): DefaultMeshType;
1573
1587
  static readASC(buffer: ArrayBuffer): DefaultMeshType;
1574
1588
  static readVTK(buffer: ArrayBuffer): VTK;
1589
+ static readWRL(buffer: ArrayBuffer): DefaultMeshType;
1575
1590
  static readDFS(buffer: ArrayBuffer): DefaultMeshType;
1576
- static readMZ3(buffer: ArrayBuffer, n_vert?: number): MZ3;
1591
+ static readMZ3(buffer: ArrayBuffer, n_vert?: number): Promise<MZ3>;
1577
1592
  static readPLY(buffer: ArrayBuffer): DefaultMeshType;
1578
1593
  static readICO(buffer: ArrayBuffer): DefaultMeshType;
1579
1594
  static readGEO(buffer: ArrayBuffer, isFlipWinding?: boolean): DefaultMeshType;
1580
1595
  static readOFF(buffer: ArrayBuffer): DefaultMeshType;
1581
1596
  static readOBJMNI(buffer: ArrayBuffer): DefaultMeshType;
1582
- static readOBJ(buffer: ArrayBuffer): DefaultMeshType;
1597
+ static readOBJ(buffer: ArrayBuffer): Promise<DefaultMeshType>;
1583
1598
  static readFreeSurfer(buffer: ArrayBuffer): DefaultMeshType;
1584
- static readSRF(buffer: ArrayBuffer): DefaultMeshType;
1599
+ static readSRF(buffer: ArrayBuffer): Promise<DefaultMeshType>;
1585
1600
  static readTxtSTL(buffer: ArrayBuffer): DefaultMeshType;
1586
1601
  static readSTL(buffer: ArrayBuffer): DefaultMeshType;
1587
1602
  static decimateLayerVertices(nVertLayer: number, nVertMesh: number): number;
1588
- static readNII2(buffer: ArrayBuffer, n_vert?: number, anatomicalStructurePrimary?: string): Int32Array | Float32Array | Int16Array | Uint8Array;
1589
- static readNII(buffer: ArrayBuffer, n_vert?: number, anatomicalStructurePrimary?: string): Float32Array | Uint8Array | Int32Array | Int16Array;
1590
- static readMGH(buffer: ArrayBuffer, n_vert?: number, isReadColortables?: boolean): MGH;
1603
+ static readNII2(buffer: ArrayBuffer, n_vert?: number, anatomicalStructurePrimary?: string): Promise<Int32Array | Float32Array | Int16Array | Uint8Array>;
1604
+ static readNII(buffer: ArrayBuffer, n_vert?: number, anatomicalStructurePrimary?: string): Promise<Float32Array | Uint8Array | Int32Array | Int16Array>;
1605
+ static readMGH(buffer: ArrayBuffer, n_vert?: number, isReadColortables?: boolean): Promise<MGH>;
1591
1606
  static readX3D(buffer: ArrayBuffer): X3D;
1592
- static readGII(buffer: ArrayBuffer, n_vert?: number): GII;
1607
+ static readGII(buffer: ArrayBuffer, n_vert?: number): Promise<GII>;
1593
1608
  }
1594
1609
 
1595
1610
  type Extents = {
@@ -1602,11 +1617,13 @@ type Extents = {
1602
1617
  */
1603
1618
  declare class NVMeshUtilities {
1604
1619
  static getClusterBoundaryU8(u8: Uint8Array, faces: number[] | Uint32Array): boolean[];
1605
- static createMZ3(vertices: Float32Array, indices: Uint32Array, compress?: boolean): ArrayBuffer;
1620
+ static gzip(data: Uint8Array): Promise<Uint8Array>;
1621
+ static createMZ3(vertices: Float32Array, indices: Uint32Array, compress?: boolean, colors?: Uint8Array | null): ArrayBuffer;
1622
+ static createMZ3Async(vertices: Float32Array, indices: Uint32Array, compress?: boolean, colors?: Uint8Array | null): Promise<ArrayBuffer>;
1606
1623
  static createOBJ(vertices: Float32Array, indices: Uint32Array): ArrayBuffer;
1607
1624
  static createSTL(vertices: Float32Array, indices: Uint32Array): ArrayBuffer;
1608
1625
  static downloadArrayBuffer(buffer: ArrayBuffer, filename: string): void;
1609
- static saveMesh(vertices: Float32Array, indices: Uint32Array, filename?: string, compress?: boolean): ArrayBuffer;
1626
+ static saveMesh(vertices: Float32Array, indices: Uint32Array, filename?: string, compress?: boolean): Promise<ArrayBuffer>;
1610
1627
  static getClusterBoundary(rgba8: Uint8Array, faces: number[] | Uint32Array): boolean[];
1611
1628
  static getExtents(pts: number[] | Float32Array): Extents;
1612
1629
  static generateNormals(pts: number[] | Float32Array, tris: number[] | Uint32Array): Float32Array;
@@ -1616,7 +1633,7 @@ type ColormapListEntry = {
1616
1633
  name: string;
1617
1634
  min: number;
1618
1635
  max: number;
1619
- alphaThreshold: boolean;
1636
+ isColorbarFromZero: boolean;
1620
1637
  negative: boolean;
1621
1638
  visible: boolean;
1622
1639
  invert: boolean;
@@ -1700,6 +1717,8 @@ type UIData = {
1700
1717
  lastTwoTouchDistance: number;
1701
1718
  multiTouchGesture: boolean;
1702
1719
  dpr?: number;
1720
+ windowX: number;
1721
+ windowY: number;
1703
1722
  };
1704
1723
  type SaveImageOptions = {
1705
1724
  filename: string;
@@ -2160,6 +2179,7 @@ declare class Niivue {
2160
2179
  checkMultitouch(e: TouchEvent): void;
2161
2180
  touchStartListener(e: TouchEvent): void;
2162
2181
  touchEndListener(e: TouchEvent): void;
2182
+ windowingHandler(x: number, y: number, volIdx?: number): void;
2163
2183
  mouseMoveListener(e: MouseEvent): void;
2164
2184
  resetBriCon(msg?: TouchEvent | MouseEvent | null): void;
2165
2185
  setDragStart(x: number, y: number): void;
@@ -2211,7 +2231,7 @@ declare class Niivue {
2211
2231
  useLoader(loader: unknown, fileExt: string, toExt: string): void;
2212
2232
  useDicomLoader(loader: DicomLoader): void;
2213
2233
  getDicomLoader(): DicomLoader;
2214
- dropListener(e: DragEvent): void;
2234
+ dropListener(e: DragEvent): Promise<void>;
2215
2235
  /**
2216
2236
  * insert a gap between slices of a mutliplanar view.
2217
2237
  * @param pixels - spacing between tiles of multiplanar view
@@ -2365,7 +2385,7 @@ declare class Niivue {
2365
2385
  * @example niivue.saveImage({ filename: "myimage.nii.gz", isSaveDrawing: true });
2366
2386
  * @see {@link https://niivue.github.io/niivue/features/draw.ui.html | live demo usage}
2367
2387
  */
2368
- saveImage(options?: SaveImageOptions): Uint8Array | boolean;
2388
+ saveImage(options?: SaveImageOptions): Promise<boolean | Uint8Array>;
2369
2389
  getMeshIndexByID(id: string | number): number;
2370
2390
  /**
2371
2391
  * change property of mesh, tractogram or connectome
@@ -2655,7 +2675,7 @@ declare class Niivue {
2655
2675
  * @returns Niivue instance
2656
2676
  * @see {@link https://niivue.github.io/niivue/features/document.load.html | live demo usage}
2657
2677
  */
2658
- loadDocument(document: NVDocument): this;
2678
+ loadDocument(document: NVDocument): Promise<this>;
2659
2679
  /**
2660
2680
  * generates JavaScript to load the current scene as a document
2661
2681
  * @param canvasId - id of canvas NiiVue will be attached to
@@ -3176,4 +3196,4 @@ declare class Niivue {
3176
3196
  set gl(gl: WebGL2RenderingContext | null);
3177
3197
  }
3178
3198
 
3179
- export { type Connectome, type ConnectomeOptions, DEFAULT_OPTIONS, DRAG_MODE, type DicomLoader, type DicomLoaderInput, type DocumentData, type DragReleaseParams, type ExportDocumentData, INITIAL_SCENE_DATA, LabelAnchorPoint, LabelLineTerminator, LabelTextAlignment, type LegacyConnectome, type LegacyNodes, MULTIPLANAR_TYPE, type NVConfigOptions, type NVConnectomeEdge, type NVConnectomeNode, NVController, NVDocument, NVImage, NVImageFromUrlOptions, NVLabel3D, NVLabel3DStyle, NVMesh, NVMeshFromUrlOptions, NVMeshLayerDefaults, NVMeshLoaders, NVMeshUtilities, NVUtilities, type NiftiHeader, type NiiVueLocation, type NiiVueLocationValue, Niivue, type Point, SHOW_RENDER, SLICE_TYPE, type Scene, type SyncOpts, type Volume, cmapper, ColorTables as colortables };
3199
+ export { COLORMAP_TYPE, type Connectome, type ConnectomeOptions, DEFAULT_OPTIONS, DRAG_MODE, DRAG_MODE_PRIMARY, DRAG_MODE_SECONDARY, type DicomLoader, type DicomLoaderInput, type DocumentData, type DragReleaseParams, type ExportDocumentData, INITIAL_SCENE_DATA, LabelAnchorPoint, LabelLineTerminator, LabelTextAlignment, type LegacyConnectome, type LegacyNodes, MULTIPLANAR_TYPE, type NVConfigOptions, type NVConnectomeEdge, type NVConnectomeNode, NVController, NVDocument, NVImage, NVImageFromUrlOptions, NVLabel3D, NVLabel3DStyle, NVMesh, NVMeshFromUrlOptions, NVMeshLayerDefaults, NVMeshLoaders, NVMeshUtilities, NVUtilities, type NiftiHeader, type NiiVueLocation, type NiiVueLocationValue, Niivue, type Point, SHOW_RENDER, SLICE_TYPE, type Scene, type SyncOpts, type Volume, cmapper, ColorTables as colortables };