@niivue/niivue 0.43.3 → 0.43.5

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/README.md CHANGED
@@ -2,7 +2,13 @@
2
2
 
3
3
  NiiVue is web-based visualization tool for neuroimaging that can run on any operating system and any web device (phone, tablet, computer). This repository contains only the **core NiiVue package** that can be embedded into other projects. We have additional [repositories](https://github.com/niivue) that wrap NiiVue for use in jupyter notebooks, vscode, and electron applications.
4
4
 
5
- [Click here to see NiiVue live demos](https://niivue.github.io/niivue/)
5
+ # News
6
+
7
+ The NiiVue iOS app is now available on iPhone and iPad.
8
+
9
+ [![Apple App Store](./docs/appstore.svg)](https://apps.apple.com/gb/app/niivue/id6497066801)
10
+
11
+ ### [Click here to see NiiVue live demos](https://niivue.github.io/niivue/)
6
12
 
7
13
  What makes NiiVue unique is its ability to simultaneously display all the datatypes popular with neuroimaging: voxels, meshes, tractography streamlines, statistical maps and connectomes. Alternative voxel-based web tools include [ami](https://fnndsc.github.io/ami/), [BioImage Suite Web](https://bioimagesuiteweb.github.io/webapp/viewer.html), [BrainBrowser](https://brainbrowser.cbrain.mcgill.ca/volume-viewer), [nifti-drop](http://vsoch.github.io/nifti-drop), [OHIF DICOM Viewer](https://viewer.ohif.org/), [Papaya](https://www.fmrib.ox.ac.uk/ukbiobank/group_means/index.html), [VTK.js](https://kitware.github.io/paraview-glance/app/), and [slicedrop](https://slicedrop.com/).
8
14
 
@@ -26,18 +32,20 @@ The command `npm run demo` will minify the project and locally host all of the [
26
32
  # Projects and People using NiiVue
27
33
 
28
34
  - Analysis of Functional NeuroImages (AFNI) [Scientific and Statistical Computing Core](https://afni.nimh.nih.gov/) (National Institutes of Health)
29
- - [ChRIS Research Integration System (ChRIS) from Boston Children's Hospital](https://chrisproject.org/) uses [NiiVue](https://app.chrisproject.org/niivue).
30
- - [Center for the Study of Aphasia Recovery](https://cstar.sc.edu/) (University of South Carolina)
35
+ - [BOOSTLET.js](https://boostlet.org/) image processing plugins work with NiiVue.
36
+ - [brainchop](https://github.com/neuroneural/brainchop) uses NiiVue for their [drag-and-drop segmentation, brain extraction and parcellation tool](https://neuroneural.github.io/brainchop/)
37
+ - [BrainLife.io](https://brainlife.io/about/) integrates NiiVue into [ezbids](https://brainlife.io/ezbids/)
38
+ - [CACTAS](https://github.com/mpsych/CACTAS) from [Daniel Haehn's team](https://danielhaehn.com/) is extending NiiVue drawing and segmentation capabilities
39
+ - [ChRIS Research Integration System (ChRIS) from Boston Children's Hospital](https://chrisproject.org/) uses [NiiVue](https://app.chrisproject.org/niivue)
40
+ - [Center for the Study of Aphasia Recovery (C-STAR)](https://cstar.sc.edu/) (University of South Carolina)
41
+ - [Digital Brain Bank](https://elifesciences.org/articles/73153) for navigating MRI datasets
31
42
  - FMRIB's Software Library (FSL) [Wellcome Centre for Integrative Neuroimaging](https://www.win.ox.ac.uk/) (University of Oxford)
32
43
  - FreeSurfer [Laboratories for Computational Neuroimaging](https://lcn.martinos.org/) (Massachusetts General Hospital) uses NiiVue for [FreeBrowse](https://github.com/freesurfer/freebrowse)
33
44
  - [OpenNeuro.org](https://openneuro.org) uses NiiVue to visualize datasets
34
- - [BrainLife.io](https://brainlife.io/about/) integrates NiiVue into [ezbids](https://brainlife.io/ezbids/)
35
- - [nilearn](https://nilearn.github.io/stable/index.html) is extending [ipyniivue](https://github.com/niivue/ipyniivue)
36
45
  - [neurodesk](https://www.neurodesk.org/) uses NiiVue for their [QSMxT Quantitative Susceptibility Mapping toolbox](https://github.com/QSMxT/QSMxT-UI)
37
- - [niivue-vscode](https://github.com/niivue/niivue-vscode) is a VSCode extension for displaying images
38
46
  - [Neuroinformatics Research and Development Group](http://neuroinformatics.uw.edu/) embeds NiiVue in [tractoscope](https://github.com/nrdg/tractoscope)
39
- - [CACTAS](https://github.com/mpsych/CACTAS) from [Daniel Haehn's team](https://danielhaehn.com/) is extending NiiVue drawing and segmentation capabilities
40
- - [Digital Brain Bank](https://elifesciences.org/articles/73153) for navigating MRI datasets
47
+ - [nilearn](https://nilearn.github.io/stable/index.html) is extending [ipyniivue](https://github.com/niivue/ipyniivue)
48
+ - [niivue-vscode](https://github.com/niivue/niivue-vscode) is a VSCode extension for displaying images
41
49
 
42
50
  # Funding
43
51
 
@@ -48,7 +56,7 @@ The command `npm run demo` will minify the project and locally host all of the [
48
56
 
49
57
  NiiVue supports many popular brain imaging formats:
50
58
 
51
- - Voxel-based formats: [NIfTI](https://brainder.org/2012/09/23/the-nifti-file-format/), [NRRD](http://teem.sourceforge.net/nrrd/format.html), [MRtrix MIF](https://mrtrix.readthedocs.io/en/latest/getting_started/image_data.html#mrtrix-image-formats), [AFNI HEAD/BRIK](https://afni.nimh.nih.gov/pub/dist/doc/program_help/README.attributes.html), [MGH/MGZ](https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/MghFormat), [ITK MHD](https://itk.org/Wiki/ITK/MetaIO/Documentation#Reading_a_Brick-of-Bytes_.28an_N-Dimensional_volume_in_a_single_file.29), [ECAT7](https://github.com/openneuropet/PET2BIDS/tree/28aae3fab22309047d36d867c624cd629c921ca6/ecat_validation/ecat_info).
59
+ - Voxel-based formats: [NIfTI](https://brainder.org/2012/09/23/the-nifti-file-format/), [NRRD](http://teem.sourceforge.net/nrrd/format.html), [MRtrix MIF](https://mrtrix.readthedocs.io/en/latest/getting_started/image_data.html#mrtrix-image-formats), [AFNI HEAD/BRIK](https://afni.nimh.nih.gov/pub/dist/doc/program_help/README.attributes.html), [MGH/MGZ](https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/MghFormat), [ITK MHD](https://itk.org/Wiki/ITK/MetaIO/Documentation#Reading_a_Brick-of-Bytes_.28an_N-Dimensional_volume_in_a_single_file.29), [ECAT7](https://github.com/openneuropet/PET2BIDS/tree/28aae3fab22309047d36d867c624cd629c921ca6/ecat_validation/ecat_info), [DSI-Studio SRC](https://dsi-studio.labsolver.org/doc/cli_data.html).
52
60
  - Mesh-based formats: [GIfTI](https://www.nitrc.org/projects/gifti/), [ASC](http://www.grahamwideman.com/gw/brain/fs/surfacefileformats.htm), [BYU/GEO/G](http://www.grahamwideman.com/gw/brain/fs/surfacefileformats.htm), [BrainSuite DFS](http://brainsuite.org/formats/dfs/), [ICO/TRI](http://www.grahamwideman.com/gw/brain/fs/surfacefileformats.htm), [PLY](<https://en.wikipedia.org/wiki/PLY_(file_format)>), [BrainNet NV](https://www.nitrc.org/projects/bnv/), [BrainVoyager SRF](https://support.brainvoyager.com/brainvoyager/automation-development/84-file-formats/344-users-guide-2-3-the-format-of-srf-files), [FreeSurfer](http://www.grahamwideman.com/gw/brain/fs/surfacefileformats.htm), [MZ3](https://github.com/neurolabusc/surf-ice/tree/master/mz3), [OFF](<https://en.wikipedia.org/wiki/OFF_(file_format)>), [Wavefront OBJ](https://brainder.org/tag/obj/), [STL](https://medium.com/3d-printing-stories/why-stl-format-is-bad-fea9ecf5e45), [Legacy VTK](https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf), [X3D](https://3dprint.nih.gov/).
53
61
  - Mesh overlay formats: [GIfTI](https://www.nitrc.org/projects/gifti/), [CIfTI-2](https://balsa.wustl.edu/about/fileTypes), [MZ3](https://github.com/neurolabusc/surf-ice/tree/master/mz3), [SMP](https://support.brainvoyager.com/brainvoyager/automation-development/84-file-formats/40-the-format-of-smp-files), STC, FreeSurfer (CURV/ANNOT)
54
62
  - Tractography formats: [TCK](https://mrtrix.readthedocs.io/en/latest/getting_started/image_data.html#tracks-file-format-tck), [TRK](http://trackvis.org/docs/?subsect=fileformat), [TRX](https://github.com/frheault/tractography_file_format), [TSF](https://mrtrix.readthedocs.io/en/dev/getting_started/image_data.html#track-scalar-file-format-tsf), [TT](https://dsi-studio.labsolver.org/doc/cli_data.html), VTK, AFNI .niml.tract
package/build/index.d.ts CHANGED
@@ -192,7 +192,9 @@ declare enum ImageType {
192
192
  V16 = 13,
193
193
  VMR = 14,
194
194
  HEAD = 15,
195
- DCM_FOLDER = 16
195
+ DCM_FOLDER = 16,
196
+ SRC = 17,
197
+ FIB = 18
196
198
  }
197
199
  type ImageFromUrlOptions = {
198
200
  url: string;
@@ -227,7 +229,7 @@ type ImageFromFileOptions = {
227
229
  name?: string;
228
230
  colormap?: string;
229
231
  opacity?: number;
230
- urlImgData?: File | null;
232
+ urlImgData?: File | null | FileSystemEntry;
231
233
  cal_min?: number;
232
234
  cal_max?: number;
233
235
  trustCalMinMax?: boolean;
@@ -271,7 +273,7 @@ type ImageMetadata = {
271
273
  dt: number;
272
274
  bpv: number;
273
275
  };
274
- declare const NVImageFromUrlOptions: (url: string, urlImageData?: string, name?: string, colormap?: string, opacity?: number, 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, alphaThreshold?: boolean, colormapLabel?: null) => ImageFromUrlOptions;
276
+ declare const NVImageFromUrlOptions: (url: string, urlImageData?: string, name?: string, colormap?: string, opacity?: number, 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, alphaThreshold?: boolean, colormapLabel?: any) => ImageFromUrlOptions;
275
277
 
276
278
  type TypedVoxelArray = Float32Array | Uint8Array | Int16Array | Float64Array | Uint16Array;
277
279
  /**
@@ -323,6 +325,7 @@ declare class NVImage {
323
325
  imageType?: ImageType;
324
326
  img?: TypedVoxelArray;
325
327
  imaginary?: Float32Array;
328
+ v1?: Float32Array;
326
329
  fileObject?: File | File[];
327
330
  dims?: number[];
328
331
  onColormapChange: (img: NVImage) => void;
@@ -369,6 +372,8 @@ declare class NVImage {
369
372
  */
370
373
  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);
371
374
  computeObliqueAngle(mtx44: mat4): number;
375
+ float32V1asRGBA(inImg: Float32Array): Uint8Array;
376
+ loadImgV1(isFlipX?: boolean, isFlipY?: boolean, isFlipZ?: boolean): boolean;
372
377
  calculateOblique(): void;
373
378
  THD_daxes_to_NIFTI(xyzDelta: number[], xyzOrigin: number[], orientSpecific: number[]): void;
374
379
  SetPixDimFromSForm(): void;
@@ -377,6 +382,8 @@ declare class NVImage {
377
382
  readV16(buffer: ArrayBuffer): ArrayBuffer;
378
383
  readVMR(buffer: ArrayBuffer): ArrayBuffer;
379
384
  readMGH(buffer: ArrayBuffer): ArrayBuffer;
385
+ readFIB(buffer: ArrayBuffer): [ArrayBuffer, Float32Array];
386
+ readSRC(buffer: ArrayBuffer): ArrayBuffer;
380
387
  readHEAD(dataBuffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
381
388
  readMHA(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
382
389
  readMIF(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
@@ -588,6 +595,9 @@ type NVConfigOptions = {
588
595
  fontColor: Float32List;
589
596
  selectionBoxColor: number[];
590
597
  clipPlaneColor: number[];
598
+ clipThick: number;
599
+ clipVolumeLow: number[];
600
+ clipVolumeHigh: number[];
591
601
  rulerColor: number[];
592
602
  colorbarMargin: number;
593
603
  trustCalMinMax: boolean;
@@ -645,6 +655,9 @@ type SceneData = {
645
655
  clipPlaneDepthAziElev: number[];
646
656
  volScaleMultiplier: number;
647
657
  pan2Dxyzmm: vec4;
658
+ clipThick: number;
659
+ clipVolumeLow: number[];
660
+ clipVolumeHigh: number[];
648
661
  };
649
662
  declare const INITIAL_SCENE_DATA: {
650
663
  azimuth: number;
@@ -654,6 +667,9 @@ declare const INITIAL_SCENE_DATA: {
654
667
  clipPlaneDepthAziElev: number[];
655
668
  volScaleMultiplier: number;
656
669
  pan2Dxyzmm: vec4;
670
+ clipThick: number;
671
+ clipVolumeLow: number[];
672
+ clipVolumeHigh: number[];
657
673
  };
658
674
  type Scene = {
659
675
  onAzimuthElevationChange: (azimuth: number, elevation: number) => void;
@@ -783,7 +799,7 @@ declare class NVDocument {
783
799
  /**
784
800
  * Downloads a JSON file with options, scene, images, meshes and drawing of {@link Niivue} instance
785
801
  */
786
- download(fileName: string): void;
802
+ download(fileName: string, compress: boolean): Promise<void>;
787
803
  /**
788
804
  * Deserialize mesh data objects
789
805
  */
@@ -914,6 +930,22 @@ type DragReleaseParams = {
914
930
  tileIdx: number;
915
931
  axCorSag: SLICE_TYPE;
916
932
  };
933
+ type NiiVueLocationValue = {
934
+ id: string;
935
+ mm: vec4;
936
+ name: string;
937
+ value: number;
938
+ vox: vec3;
939
+ };
940
+ type NiiVueLocation = {
941
+ axCorSag: number;
942
+ frac: vec3;
943
+ mm: vec4;
944
+ string: string;
945
+ values: NiiVueLocationValue[];
946
+ vox: vec3;
947
+ xy: [number, number];
948
+ };
917
949
 
918
950
  type ValuesArray = Array<{
919
951
  id: string;
@@ -923,8 +955,7 @@ type ValuesArray = Array<{
923
955
  cal_min?: number;
924
956
  cal_max?: number;
925
957
  }>;
926
- type TypedNumberArray = Float64Array | Float32Array | Uint32Array | Uint16Array | Uint8Array | Int32Array | Int16Array | Int8Array;
927
- type AnyNumberArray = number[] | TypedNumberArray;
958
+ type AnyNumberArray = number[] | Float64Array | Float32Array | Uint32Array | Uint16Array | Uint8Array | Int32Array | Int16Array | Int8Array;
928
959
  type DefaultMeshType = {
929
960
  positions: Float32Array;
930
961
  indices: Uint32Array;
@@ -1043,7 +1074,7 @@ declare class NVMeshFromUrlOptions {
1043
1074
  visible: boolean;
1044
1075
  layers: NVMeshLayer[];
1045
1076
  colorbarVisible: boolean;
1046
- constructor(url?: string, gl?: null, name?: string, opacity?: number, rgba255?: Uint8Array, visible?: boolean, layers?: never[], colorbarVisible?: boolean);
1077
+ constructor(url?: string, gl?: any, name?: string, opacity?: number, rgba255?: Uint8Array, visible?: boolean, layers?: any[], colorbarVisible?: boolean);
1047
1078
  }
1048
1079
  type BaseLoadParams = {
1049
1080
  gl: WebGL2RenderingContext;
@@ -1093,11 +1124,13 @@ declare class NVMesh {
1093
1124
  rgba255: Uint8Array;
1094
1125
  fiberLength?: number;
1095
1126
  fiberLengths?: Uint32Array;
1127
+ fiberDensity?: Float32Array;
1096
1128
  fiberDither: number;
1097
1129
  fiberColor: string;
1098
1130
  fiberDecimationStride: number;
1099
1131
  fiberSides: number;
1100
1132
  fiberRadius: number;
1133
+ fiberOcclusion: number;
1101
1134
  f32PerVertex: number;
1102
1135
  fiberMask?: unknown[];
1103
1136
  colormap?: ColorMap | LegacyConnectome | string | null;
@@ -1137,11 +1170,13 @@ declare class NVMesh {
1137
1170
  * @param colorbarVisible - does this mesh display a colorbar
1138
1171
  * @param anatomicalStructurePrimary - region for mesh. Default is an empty string
1139
1172
  */
1140
- constructor(pts: Float32Array, tris: Uint32Array, name: string | undefined, rgba255: Uint8Array | undefined, opacity: number | undefined, visible: boolean | undefined, gl: WebGL2RenderingContext, connectome?: LegacyConnectome | string | null, dpg?: ValuesArray | null, dps?: ValuesArray | null, dpv?: ValuesArray | null, colorbarVisible?: boolean, anatomicalStructurePrimary?: string);
1173
+ constructor(pts: Float32Array, tris: Uint32Array, name: string, rgba255: Uint8Array, opacity: number, visible: boolean, gl: WebGL2RenderingContext, connectome?: LegacyConnectome | string | null, dpg?: ValuesArray | null, dps?: ValuesArray | null, dpv?: ValuesArray | null, colorbarVisible?: boolean, anatomicalStructurePrimary?: string);
1141
1174
  initValuesArray(va: ValuesArray): ValuesArray;
1142
1175
  linesToCylinders(gl: WebGL2RenderingContext, posClrF32: Float32Array, indices: number[]): void;
1176
+ createFiberDensityMap(): void;
1143
1177
  updateFibers(gl: WebGL2RenderingContext): void;
1144
1178
  indexNearestXYZmm(Xmm: number, Ymm: number, Zmm: number): number[];
1179
+ unloadMesh(gl: WebGL2RenderingContext): void;
1145
1180
  updateMesh(gl: WebGL2RenderingContext): void;
1146
1181
  reverseFaces(gl: WebGL2RenderingContext): void;
1147
1182
  setLayerProperty(id: number, key: keyof NVMeshLayer, val: number | string | boolean, gl: WebGL2RenderingContext): void;
@@ -1402,18 +1437,23 @@ declare class NVController {
1402
1437
  onMeshPropertyChanged(meshIndex: number, key: string, val: unknown): void;
1403
1438
  }
1404
1439
 
1440
+ type TypedNumberArray = Float64Array | Float32Array | Uint32Array | Uint16Array | Uint8Array | Int32Array | Int16Array | Int8Array;
1405
1441
  /**
1406
1442
  * Namespace for utility functions
1407
1443
  * @ignore
1408
1444
  */
1409
1445
  declare class NVUtilities {
1410
1446
  static arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
1447
+ static readMatV4(buffer: ArrayBuffer): Record<string, TypedNumberArray>;
1411
1448
  static uint8tob64(bytes: Uint8Array): string;
1412
- static download(content: string, fileName: string, contentType: string): void;
1449
+ static download(content: string | ArrayBuffer, fileName: string, contentType: string): void;
1413
1450
  static readFileAsync(file: Blob): Promise<ArrayBuffer>;
1414
1451
  static blobToBase64(blob: Blob): Promise<string>;
1415
- static decompressBase64String(base64: string): string;
1416
- static compressToBase64String(string: string): string;
1452
+ static decompressBase64String(base64: string): Promise<string>;
1453
+ static compressToBase64String(string: string): Promise<string>;
1454
+ static compressStringToArrayBuffer(input: string): Promise<ArrayBuffer>;
1455
+ static isArrayBufferCompressed(buffer: ArrayBuffer): boolean;
1456
+ static decompressArrayBuffer(buffer: ArrayBuffer): Promise<string>;
1417
1457
  static arraysAreEqual(a: unknown[], b: unknown[]): boolean;
1418
1458
  /**
1419
1459
  * Generate a pre-filled number array.
@@ -1448,7 +1488,7 @@ declare class NVMeshLoaders {
1448
1488
  static readTCK(buffer: ArrayBuffer): TCK;
1449
1489
  static readTRK(buffer: ArrayBuffer): TRK;
1450
1490
  static readTxtVTK(buffer: ArrayBuffer): VTK;
1451
- static readLayer(name: string | undefined, buffer: ArrayBuffer, nvmesh: NVMesh, opacity?: number, colormap?: string, colormapNegative?: string, useNegativeCmap?: boolean, cal_min?: number | null, cal_max?: number | null, outlineBorder?: number): NVMeshLayer | undefined;
1491
+ 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;
1452
1492
  static readSMP(buffer: ArrayBuffer, n_vert: number): Float32Array;
1453
1493
  static readSTC(buffer: ArrayBuffer, n_vert: number): Float32Array;
1454
1494
  static readCURV(buffer: ArrayBuffer, n_vert: number): Float32Array;
@@ -1631,7 +1671,7 @@ declare class Niivue {
1631
1671
  blurShader: Shader | null;
1632
1672
  sobelShader: Shader | null;
1633
1673
  genericVAO: WebGLVertexArrayObject | null;
1634
- unusedVAO: null;
1674
+ unusedVAO: any;
1635
1675
  crosshairs3D: NiivueObject3D | null;
1636
1676
  private DEFAULT_FONT_GLYPH_SHEET;
1637
1677
  private DEFAULT_FONT_METRICS;
@@ -1647,6 +1687,7 @@ declare class Niivue {
1647
1687
  private resizeObserver;
1648
1688
  syncOpts: Record<string, unknown>;
1649
1689
  readyForSync: boolean;
1690
+ centerMosaic: boolean;
1650
1691
  uiData: UIData;
1651
1692
  back: NVImage | null;
1652
1693
  overlays: NVImage[];
@@ -1889,7 +1930,7 @@ declare class Niivue {
1889
1930
  * @example niivue.attachTo('gl')
1890
1931
  * @see {@link https://niivue.github.io/niivue/features/basic.multiplanar.html | live demo usage}
1891
1932
  */
1892
- attachTo(id: string, isAntiAlias?: null): Promise<this>;
1933
+ attachTo(id: string, isAntiAlias?: any): Promise<this>;
1893
1934
  /**
1894
1935
  * attach the Niivue instance to a canvas element directly
1895
1936
  * @param canvas - the canvas element reference
@@ -1976,7 +2017,7 @@ declare class Niivue {
1976
2017
  */
1977
2018
  calculateMinMaxVoxIdx(array: number[]): number[];
1978
2019
  calculateNewRange({ volIdx }?: {
1979
- volIdx?: number | undefined;
2020
+ volIdx?: number;
1980
2021
  }): void;
1981
2022
  generateMouseUpCallback(fracStart: vec3, fracEnd: vec3): void;
1982
2023
  mouseUpListener(): void;
@@ -2412,6 +2453,22 @@ declare class Niivue {
2412
2453
  * @see {@link https://niivue.github.io/niivue/features/clipplanes.html | live demo usage}
2413
2454
  */
2414
2455
  setClipPlaneColor(color: number[]): void;
2456
+ /**
2457
+ * adjust thickness of the 3D clip plane
2458
+ * @param thick - thickness of slab. Value 0..1.73 (cube opposite corner length is sqrt(3)).
2459
+ * @example
2460
+ * niivue.setClipPlaneThick(0.3) // thin slab
2461
+ * @see {@link https://niivue.github.io/niivue/features/clipplanes.html | live demo usage}
2462
+ */
2463
+ setClipPlaneThick(thick: number): void;
2464
+ /**
2465
+ * set the clipping region for volume rendering
2466
+ * @param color - the new color. expects an array of RGBA values. values can range from 0 to 1
2467
+ * @example
2468
+ * niivue.setClipPlaneColor([0.0, 0.0, 0.2], [1.0, 1.0, 0.7]) // remove inferior 20% and superior 30%
2469
+ * @see {@link https://niivue.github.io/niivue/features/clipplanes.html | live demo usage}
2470
+ */
2471
+ setClipVolume(low: number[], high: number[]): void;
2415
2472
  /**
2416
2473
  * set proportion of volume rendering influenced by selected matcap.
2417
2474
  * @param gradientAmount - amount of matcap (0..1), default 0 (matte, surface normal does not influence color)
@@ -2451,7 +2508,7 @@ declare class Niivue {
2451
2508
  * const html = `<html><body><canvas id="gl1"></canvas><script type="module" async>
2452
2509
  ${javascript}</script></body></html>`;
2453
2510
  */
2454
- generateLoadDocumentJavaScript(canvasId: string, esm: string): string;
2511
+ generateLoadDocumentJavaScript(canvasId: string, esm: string): Promise<string>;
2455
2512
  /**
2456
2513
  * generates HTML of current scene
2457
2514
  * @param canvasId - id of canvas NiiVue will be attached to
@@ -2462,14 +2519,14 @@ declare class Niivue {
2462
2519
  * %%javascript%%</script></body></html>`;
2463
2520
  * nv1.generateHTML("page.html", esm);
2464
2521
  */
2465
- generateHTML(canvasId: string | undefined, esm: string): string;
2522
+ generateHTML(canvasId: string, esm: string): Promise<string>;
2466
2523
  /**
2467
2524
  * save current scene as HTML
2468
2525
  * @param fileName - the name of the HTML file
2469
2526
  * @param canvasId - id of canvas NiiVue will be attached to
2470
2527
  * @param esm - bundled version of NiiVue
2471
2528
  */
2472
- saveHTML(fileName: string | undefined, canvasId: string | undefined, esm: string): void;
2529
+ saveHTML(fileName: string, canvasId: string, esm: string): Promise<void>;
2473
2530
  /**
2474
2531
  * Converts NiiVue scene to JSON
2475
2532
  */
@@ -2477,11 +2534,12 @@ declare class Niivue {
2477
2534
  /**
2478
2535
  * save the entire scene (objects and settings) as a document
2479
2536
  * @param fileName - the name of the document storing the scene
2537
+ * @param compress - whether the file should be compressed
2480
2538
  * @example
2481
2539
  * niivue.saveDocument("niivue.basic.nvd")
2482
2540
  * @see {@link https://niivue.github.io/niivue/features/document.3d.html | live demo usage}
2483
2541
  */
2484
- saveDocument(fileName?: string): Promise<void>;
2542
+ saveDocument(fileName?: string, compress?: boolean): Promise<void>;
2485
2543
  /**
2486
2544
  * load an array of volume objects
2487
2545
  * @param volumeList - the array of objects to load. each object must have a resolvable "url" property at a minimum
@@ -2632,7 +2690,7 @@ declare class Niivue {
2632
2690
  top: number;
2633
2691
  };
2634
2692
  })[];
2635
- kerning: never[];
2693
+ kerning: any[];
2636
2694
  }): Promise<void>;
2637
2695
  loadDefaultMatCap(): Promise<WebGLTexture | null>;
2638
2696
  loadDefaultFont(): Promise<void>;
@@ -2692,7 +2750,7 @@ declare class Niivue {
2692
2750
  * @example niivue.getDescriptives(0);
2693
2751
  * @see {@link https://niivue.github.io/niivue/features/draw2.html | live demo usage}
2694
2752
  */
2695
- getDescriptives(layer?: number, masks?: never[], drawingIsMask?: boolean): Descriptive;
2753
+ getDescriptives(layer?: number, masks?: any[], drawingIsMask?: boolean): Descriptive;
2696
2754
  refreshLayers(overlayItem: NVImage, layer: number): void;
2697
2755
  /**
2698
2756
  * query all available color maps that can be applied to volumes
@@ -2728,8 +2786,8 @@ declare class Niivue {
2728
2786
  largest_original_cluster_labels(bw: Uint32Array, cl: number, ls: Uint32Array): [number, Uint32Array];
2729
2787
  bwlabel(img: Uint32Array, dim: Uint32Array, conn?: number, binarize?: boolean, onlyLargestClusterPerClass?: boolean): [number, Uint32Array];
2730
2788
  createConnectedLabelImage(id: string, conn?: number, binarize?: boolean, onlyLargestClusterPerClass?: boolean): Promise<NVImage>;
2731
- scalecropUint8(img32: Float32Array, dst_min: number | undefined, dst_max: number | undefined, src_min: number, scale: number): Promise<Uint8Array>;
2732
- scalecropFloat32(img32: Float32Array, dst_min: number | undefined, dst_max: number | undefined, src_min: number, scale: number): Promise<Float32Array>;
2789
+ scalecropUint8(img32: Float32Array, dst_min: number, dst_max: number, src_min: number, scale: number): Promise<Uint8Array>;
2790
+ scalecropFloat32(img32: Float32Array, dst_min: number, dst_max: number, src_min: number, scale: number): Promise<Float32Array>;
2733
2791
  getScale(volume: NVImage, dst_min?: number, dst_max?: number, f_low?: number, f_high?: number): [number, number];
2734
2792
  conformVox2Vox(inDims: number[], inAffine: number[], outDim?: number, outMM?: number, toRAS?: boolean): [mat4, mat4, mat4];
2735
2793
  createNiftiArray(dims?: number[], pixDims?: number[], affine?: number[], datatypeCode?: NiiDataType, img?: Uint8Array): Promise<Uint8Array>;
@@ -2828,7 +2886,7 @@ declare class Niivue {
2828
2886
  getLegendPanelWidth(): number;
2829
2887
  getLegendPanelHeight(): number;
2830
2888
  reserveColorbarPanel(): number[];
2831
- drawColorbarCore(layer: number | undefined, leftTopWidthHeight: number[] | undefined, isNegativeColor: boolean | undefined, min: number | undefined, max: number | undefined, isAlphaThreshold: boolean): void;
2889
+ drawColorbarCore(layer: number, leftTopWidthHeight: number[], isNegativeColor: boolean, min: number, max: number, isAlphaThreshold: boolean): void;
2832
2890
  drawColorbar(): void;
2833
2891
  textWidth(scale: number, str: string): number;
2834
2892
  textHeight(scale: number, str: string): number;
@@ -2849,7 +2907,7 @@ declare class Niivue {
2849
2907
  * @see {@link https://niivue.github.io/niivue/features/draw2.html | live demo usage}
2850
2908
  */
2851
2909
  setInterpolation(isNearest: boolean): void;
2852
- calculateMvpMatrix2D(leftTopWidthHeight: number[], mn: vec3, mx: vec3, clipTolerance: number | undefined, clipDepth: number | undefined, azimuth: number | undefined, elevation: number | undefined, isRadiolgical: boolean): MvpMatrix2D;
2910
+ calculateMvpMatrix2D(leftTopWidthHeight: number[], mn: vec3, mx: vec3, clipTolerance: number, clipDepth: number, azimuth: number, elevation: number, isRadiolgical: boolean): MvpMatrix2D;
2853
2911
  swizzleVec3MM(v3: vec3, axCorSag: SLICE_TYPE): vec3;
2854
2912
  screenFieldOfViewVox(axCorSag?: number): vec3;
2855
2913
  screenFieldOfViewMM(axCorSag?: number, forceSliceMM?: boolean): vec3;
@@ -2858,7 +2916,7 @@ declare class Niivue {
2858
2916
  drawSliceOrientationText(leftTopWidthHeight: number[], axCorSag: SLICE_TYPE): void;
2859
2917
  xyMM2xyzMM(axCorSag: SLICE_TYPE, sliceFrac: number): number[];
2860
2918
  draw2D(leftTopWidthHeight: number[], axCorSag: SLICE_TYPE, customMM?: number): void;
2861
- calculateMvpMatrix(_unused: unknown, leftTopWidthHeight: number[] | undefined, azimuth: number, elevation: number): mat4[];
2919
+ calculateMvpMatrix(_unused: unknown, leftTopWidthHeight: number[], azimuth: number, elevation: number): mat4[];
2862
2920
  calculateModelMatrix(azimuth: number, elevation: number): mat4;
2863
2921
  calculateRayDirection(azimuth: number, elevation: number): vec3;
2864
2922
  sceneExtentsMinMax(isSliceMM?: boolean): vec3[];
@@ -2880,7 +2938,7 @@ declare class Niivue {
2880
2938
  calculateScreenPoint(point: [number, number, number], mvpMatrix: mat4, leftTopWidthHeight: number[]): vec4;
2881
2939
  getLabelAtPoint(screenPoint: [number, number]): NVLabel3D | null;
2882
2940
  drawLabelLine(label: NVLabel3D, pos: vec2, mvpMatrix: mat4, leftTopWidthHeight: number[], secondPass?: boolean): void;
2883
- draw3DLabel(label: NVLabel3D, pos: vec2, mvpMatrix: mat4, leftTopWidthHeight: number[], bulletMargin: number | undefined, legendWidth: number, secondPass?: boolean): void;
2941
+ draw3DLabel(label: NVLabel3D, pos: vec2, mvpMatrix: mat4, leftTopWidthHeight: number[], bulletMargin: number, legendWidth: number, secondPass?: boolean): void;
2884
2942
  draw3DLabels(mvpMatrix: mat4, leftTopWidthHeight: number[], secondPass?: boolean): void;
2885
2943
  draw3D(leftTopWidthHeight?: number[], mvpMatrix?: mat4 | null, modelMatrix?: mat4 | null, normalMatrix?: mat4 | null, azimuth?: number | null, elevation?: number): string | undefined;
2886
2944
  drawMesh3D(isDepthTest?: boolean, alpha?: number, m?: mat4, modelMtx?: mat4, normMtx?: mat4): void;
@@ -2921,4 +2979,4 @@ declare class Niivue {
2921
2979
  set gl(gl: WebGL2RenderingContext | null);
2922
2980
  }
2923
2981
 
2924
- export { type Connectome, type ConnectomeOptions, DEFAULT_OPTIONS, DRAG_MODE, type DocumentData, type DragReleaseParams, type ExportDocumentData, INITIAL_SCENE_DATA, LabelLineTerminator, LabelTextAlignment, type LegacyConnectome, type LegacyNodes, MULTIPLANAR_TYPE, type NVConfigOptions, type NVConnectomeEdge, type NVConnectomeNode, NVController, NVDocument, NVImage, NVImageFromUrlOptions, NVLabel3D, NVLabel3DStyle, NVMesh, NVMeshFromUrlOptions, NVMeshLayerDefaults, NVMeshLoaders, NVUtilities, type NiftiHeader, Niivue, type Point, SLICE_TYPE, type Scene, type Volume, cmapper, ColorTables as colortables };
2982
+ export { type Connectome, type ConnectomeOptions, DEFAULT_OPTIONS, DRAG_MODE, type DocumentData, type DragReleaseParams, type ExportDocumentData, INITIAL_SCENE_DATA, LabelLineTerminator, LabelTextAlignment, type LegacyConnectome, type LegacyNodes, MULTIPLANAR_TYPE, type NVConfigOptions, type NVConnectomeEdge, type NVConnectomeNode, NVController, NVDocument, NVImage, NVImageFromUrlOptions, NVLabel3D, NVLabel3DStyle, NVMesh, NVMeshFromUrlOptions, NVMeshLayerDefaults, NVMeshLoaders, NVUtilities, type NiftiHeader, type NiiVueLocation, type NiiVueLocationValue, Niivue, type Point, SLICE_TYPE, type Scene, type Volume, cmapper, ColorTables as colortables };