@niivue/niivue 0.43.3 → 0.43.4

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,9 +1170,10 @@ 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[];
1145
1179
  updateMesh(gl: WebGL2RenderingContext): void;
@@ -1402,18 +1436,23 @@ declare class NVController {
1402
1436
  onMeshPropertyChanged(meshIndex: number, key: string, val: unknown): void;
1403
1437
  }
1404
1438
 
1439
+ type TypedNumberArray = Float64Array | Float32Array | Uint32Array | Uint16Array | Uint8Array | Int32Array | Int16Array | Int8Array;
1405
1440
  /**
1406
1441
  * Namespace for utility functions
1407
1442
  * @ignore
1408
1443
  */
1409
1444
  declare class NVUtilities {
1410
1445
  static arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
1446
+ static readMatV4(buffer: ArrayBuffer): Record<string, TypedNumberArray>;
1411
1447
  static uint8tob64(bytes: Uint8Array): string;
1412
- static download(content: string, fileName: string, contentType: string): void;
1448
+ static download(content: string | ArrayBuffer, fileName: string, contentType: string): void;
1413
1449
  static readFileAsync(file: Blob): Promise<ArrayBuffer>;
1414
1450
  static blobToBase64(blob: Blob): Promise<string>;
1415
- static decompressBase64String(base64: string): string;
1416
- static compressToBase64String(string: string): string;
1451
+ static decompressBase64String(base64: string): Promise<string>;
1452
+ static compressToBase64String(string: string): Promise<string>;
1453
+ static compressStringToArrayBuffer(input: string): Promise<ArrayBuffer>;
1454
+ static isArrayBufferCompressed(buffer: ArrayBuffer): boolean;
1455
+ static decompressArrayBuffer(buffer: ArrayBuffer): Promise<string>;
1417
1456
  static arraysAreEqual(a: unknown[], b: unknown[]): boolean;
1418
1457
  /**
1419
1458
  * Generate a pre-filled number array.
@@ -1448,7 +1487,7 @@ declare class NVMeshLoaders {
1448
1487
  static readTCK(buffer: ArrayBuffer): TCK;
1449
1488
  static readTRK(buffer: ArrayBuffer): TRK;
1450
1489
  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;
1490
+ 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
1491
  static readSMP(buffer: ArrayBuffer, n_vert: number): Float32Array;
1453
1492
  static readSTC(buffer: ArrayBuffer, n_vert: number): Float32Array;
1454
1493
  static readCURV(buffer: ArrayBuffer, n_vert: number): Float32Array;
@@ -1631,7 +1670,7 @@ declare class Niivue {
1631
1670
  blurShader: Shader | null;
1632
1671
  sobelShader: Shader | null;
1633
1672
  genericVAO: WebGLVertexArrayObject | null;
1634
- unusedVAO: null;
1673
+ unusedVAO: any;
1635
1674
  crosshairs3D: NiivueObject3D | null;
1636
1675
  private DEFAULT_FONT_GLYPH_SHEET;
1637
1676
  private DEFAULT_FONT_METRICS;
@@ -1889,7 +1928,7 @@ declare class Niivue {
1889
1928
  * @example niivue.attachTo('gl')
1890
1929
  * @see {@link https://niivue.github.io/niivue/features/basic.multiplanar.html | live demo usage}
1891
1930
  */
1892
- attachTo(id: string, isAntiAlias?: null): Promise<this>;
1931
+ attachTo(id: string, isAntiAlias?: any): Promise<this>;
1893
1932
  /**
1894
1933
  * attach the Niivue instance to a canvas element directly
1895
1934
  * @param canvas - the canvas element reference
@@ -1976,7 +2015,7 @@ declare class Niivue {
1976
2015
  */
1977
2016
  calculateMinMaxVoxIdx(array: number[]): number[];
1978
2017
  calculateNewRange({ volIdx }?: {
1979
- volIdx?: number | undefined;
2018
+ volIdx?: number;
1980
2019
  }): void;
1981
2020
  generateMouseUpCallback(fracStart: vec3, fracEnd: vec3): void;
1982
2021
  mouseUpListener(): void;
@@ -2412,6 +2451,22 @@ declare class Niivue {
2412
2451
  * @see {@link https://niivue.github.io/niivue/features/clipplanes.html | live demo usage}
2413
2452
  */
2414
2453
  setClipPlaneColor(color: number[]): void;
2454
+ /**
2455
+ * adjust thickness of the 3D clip plane
2456
+ * @param thick - thickness of slab. Value 0..1.73 (cube opposite corner length is sqrt(3)).
2457
+ * @example
2458
+ * niivue.setClipPlaneThick(0.3) // thin slab
2459
+ * @see {@link https://niivue.github.io/niivue/features/clipplanes.html | live demo usage}
2460
+ */
2461
+ setClipPlaneThick(thick: number): void;
2462
+ /**
2463
+ * set the clipping region for volume rendering
2464
+ * @param color - the new color. expects an array of RGBA values. values can range from 0 to 1
2465
+ * @example
2466
+ * niivue.setClipPlaneColor([0.0, 0.0, 0.2], [1.0, 1.0, 0.7]) // remove inferior 20% and superior 30%
2467
+ * @see {@link https://niivue.github.io/niivue/features/clipplanes.html | live demo usage}
2468
+ */
2469
+ setClipVolume(low: number[], high: number[]): void;
2415
2470
  /**
2416
2471
  * set proportion of volume rendering influenced by selected matcap.
2417
2472
  * @param gradientAmount - amount of matcap (0..1), default 0 (matte, surface normal does not influence color)
@@ -2451,7 +2506,7 @@ declare class Niivue {
2451
2506
  * const html = `<html><body><canvas id="gl1"></canvas><script type="module" async>
2452
2507
  ${javascript}</script></body></html>`;
2453
2508
  */
2454
- generateLoadDocumentJavaScript(canvasId: string, esm: string): string;
2509
+ generateLoadDocumentJavaScript(canvasId: string, esm: string): Promise<string>;
2455
2510
  /**
2456
2511
  * generates HTML of current scene
2457
2512
  * @param canvasId - id of canvas NiiVue will be attached to
@@ -2462,14 +2517,14 @@ declare class Niivue {
2462
2517
  * %%javascript%%</script></body></html>`;
2463
2518
  * nv1.generateHTML("page.html", esm);
2464
2519
  */
2465
- generateHTML(canvasId: string | undefined, esm: string): string;
2520
+ generateHTML(canvasId: string, esm: string): Promise<string>;
2466
2521
  /**
2467
2522
  * save current scene as HTML
2468
2523
  * @param fileName - the name of the HTML file
2469
2524
  * @param canvasId - id of canvas NiiVue will be attached to
2470
2525
  * @param esm - bundled version of NiiVue
2471
2526
  */
2472
- saveHTML(fileName: string | undefined, canvasId: string | undefined, esm: string): void;
2527
+ saveHTML(fileName: string, canvasId: string, esm: string): Promise<void>;
2473
2528
  /**
2474
2529
  * Converts NiiVue scene to JSON
2475
2530
  */
@@ -2477,11 +2532,12 @@ declare class Niivue {
2477
2532
  /**
2478
2533
  * save the entire scene (objects and settings) as a document
2479
2534
  * @param fileName - the name of the document storing the scene
2535
+ * @param compress - whether the file should be compressed
2480
2536
  * @example
2481
2537
  * niivue.saveDocument("niivue.basic.nvd")
2482
2538
  * @see {@link https://niivue.github.io/niivue/features/document.3d.html | live demo usage}
2483
2539
  */
2484
- saveDocument(fileName?: string): Promise<void>;
2540
+ saveDocument(fileName?: string, compress?: boolean): Promise<void>;
2485
2541
  /**
2486
2542
  * load an array of volume objects
2487
2543
  * @param volumeList - the array of objects to load. each object must have a resolvable "url" property at a minimum
@@ -2632,7 +2688,7 @@ declare class Niivue {
2632
2688
  top: number;
2633
2689
  };
2634
2690
  })[];
2635
- kerning: never[];
2691
+ kerning: any[];
2636
2692
  }): Promise<void>;
2637
2693
  loadDefaultMatCap(): Promise<WebGLTexture | null>;
2638
2694
  loadDefaultFont(): Promise<void>;
@@ -2692,7 +2748,7 @@ declare class Niivue {
2692
2748
  * @example niivue.getDescriptives(0);
2693
2749
  * @see {@link https://niivue.github.io/niivue/features/draw2.html | live demo usage}
2694
2750
  */
2695
- getDescriptives(layer?: number, masks?: never[], drawingIsMask?: boolean): Descriptive;
2751
+ getDescriptives(layer?: number, masks?: any[], drawingIsMask?: boolean): Descriptive;
2696
2752
  refreshLayers(overlayItem: NVImage, layer: number): void;
2697
2753
  /**
2698
2754
  * query all available color maps that can be applied to volumes
@@ -2728,8 +2784,8 @@ declare class Niivue {
2728
2784
  largest_original_cluster_labels(bw: Uint32Array, cl: number, ls: Uint32Array): [number, Uint32Array];
2729
2785
  bwlabel(img: Uint32Array, dim: Uint32Array, conn?: number, binarize?: boolean, onlyLargestClusterPerClass?: boolean): [number, Uint32Array];
2730
2786
  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>;
2787
+ scalecropUint8(img32: Float32Array, dst_min: number, dst_max: number, src_min: number, scale: number): Promise<Uint8Array>;
2788
+ scalecropFloat32(img32: Float32Array, dst_min: number, dst_max: number, src_min: number, scale: number): Promise<Float32Array>;
2733
2789
  getScale(volume: NVImage, dst_min?: number, dst_max?: number, f_low?: number, f_high?: number): [number, number];
2734
2790
  conformVox2Vox(inDims: number[], inAffine: number[], outDim?: number, outMM?: number, toRAS?: boolean): [mat4, mat4, mat4];
2735
2791
  createNiftiArray(dims?: number[], pixDims?: number[], affine?: number[], datatypeCode?: NiiDataType, img?: Uint8Array): Promise<Uint8Array>;
@@ -2828,7 +2884,7 @@ declare class Niivue {
2828
2884
  getLegendPanelWidth(): number;
2829
2885
  getLegendPanelHeight(): number;
2830
2886
  reserveColorbarPanel(): number[];
2831
- drawColorbarCore(layer: number | undefined, leftTopWidthHeight: number[] | undefined, isNegativeColor: boolean | undefined, min: number | undefined, max: number | undefined, isAlphaThreshold: boolean): void;
2887
+ drawColorbarCore(layer: number, leftTopWidthHeight: number[], isNegativeColor: boolean, min: number, max: number, isAlphaThreshold: boolean): void;
2832
2888
  drawColorbar(): void;
2833
2889
  textWidth(scale: number, str: string): number;
2834
2890
  textHeight(scale: number, str: string): number;
@@ -2849,7 +2905,7 @@ declare class Niivue {
2849
2905
  * @see {@link https://niivue.github.io/niivue/features/draw2.html | live demo usage}
2850
2906
  */
2851
2907
  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;
2908
+ calculateMvpMatrix2D(leftTopWidthHeight: number[], mn: vec3, mx: vec3, clipTolerance: number, clipDepth: number, azimuth: number, elevation: number, isRadiolgical: boolean): MvpMatrix2D;
2853
2909
  swizzleVec3MM(v3: vec3, axCorSag: SLICE_TYPE): vec3;
2854
2910
  screenFieldOfViewVox(axCorSag?: number): vec3;
2855
2911
  screenFieldOfViewMM(axCorSag?: number, forceSliceMM?: boolean): vec3;
@@ -2858,7 +2914,7 @@ declare class Niivue {
2858
2914
  drawSliceOrientationText(leftTopWidthHeight: number[], axCorSag: SLICE_TYPE): void;
2859
2915
  xyMM2xyzMM(axCorSag: SLICE_TYPE, sliceFrac: number): number[];
2860
2916
  draw2D(leftTopWidthHeight: number[], axCorSag: SLICE_TYPE, customMM?: number): void;
2861
- calculateMvpMatrix(_unused: unknown, leftTopWidthHeight: number[] | undefined, azimuth: number, elevation: number): mat4[];
2917
+ calculateMvpMatrix(_unused: unknown, leftTopWidthHeight: number[], azimuth: number, elevation: number): mat4[];
2862
2918
  calculateModelMatrix(azimuth: number, elevation: number): mat4;
2863
2919
  calculateRayDirection(azimuth: number, elevation: number): vec3;
2864
2920
  sceneExtentsMinMax(isSliceMM?: boolean): vec3[];
@@ -2880,7 +2936,7 @@ declare class Niivue {
2880
2936
  calculateScreenPoint(point: [number, number, number], mvpMatrix: mat4, leftTopWidthHeight: number[]): vec4;
2881
2937
  getLabelAtPoint(screenPoint: [number, number]): NVLabel3D | null;
2882
2938
  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;
2939
+ draw3DLabel(label: NVLabel3D, pos: vec2, mvpMatrix: mat4, leftTopWidthHeight: number[], bulletMargin: number, legendWidth: number, secondPass?: boolean): void;
2884
2940
  draw3DLabels(mvpMatrix: mat4, leftTopWidthHeight: number[], secondPass?: boolean): void;
2885
2941
  draw3D(leftTopWidthHeight?: number[], mvpMatrix?: mat4 | null, modelMatrix?: mat4 | null, normalMatrix?: mat4 | null, azimuth?: number | null, elevation?: number): string | undefined;
2886
2942
  drawMesh3D(isDepthTest?: boolean, alpha?: number, m?: mat4, modelMtx?: mat4, normMtx?: mat4): void;
@@ -2921,4 +2977,4 @@ declare class Niivue {
2921
2977
  set gl(gl: WebGL2RenderingContext | null);
2922
2978
  }
2923
2979
 
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 };
2980
+ 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 };