@niivue/niivue 0.43.2 → 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 +17 -9
- package/build/index.d.ts +88 -28
- package/build/index.js +1008 -565
- package/build/index.js.map +1 -1
- package/build/index.min.js +1 -1
- package/dist/index.d.ts +88 -28
- package/dist/index.js +1219 -620
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/niivue.umd.js +130 -45
- package/package.json +1 -7
- package/src/niivue/index.ts +113 -25
- package/src/nvdocument.ts +72 -11
- package/src/nvimage/index.ts +340 -61
- package/src/nvimage/utils.ts +10 -2
- package/src/nvmesh-loaders.ts +3 -91
- package/src/nvmesh-types.ts +4 -3
- package/src/nvmesh.ts +161 -2
- package/src/nvutilities.ts +148 -15
- package/src/shader-srcs.ts +95 -152
- package/src/types.ts +18 -0
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
|
-
|
|
5
|
+
# News
|
|
6
|
+
|
|
7
|
+
The NiiVue iOS app is now available on iPhone and iPad.
|
|
8
|
+
|
|
9
|
+
[](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
|
-
- [
|
|
30
|
-
- [
|
|
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
|
-
- [
|
|
40
|
-
- [
|
|
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?:
|
|
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;
|
|
@@ -681,6 +697,7 @@ type DocumentData = {
|
|
|
681
697
|
meshesString?: string;
|
|
682
698
|
sceneData?: SceneData;
|
|
683
699
|
connectomes?: string[];
|
|
700
|
+
customData?: string;
|
|
684
701
|
};
|
|
685
702
|
type ExportDocumentData = {
|
|
686
703
|
encodedImageBlobs: string[];
|
|
@@ -693,6 +710,7 @@ type ExportDocumentData = {
|
|
|
693
710
|
meshesString: string;
|
|
694
711
|
labels: NVLabel3D[];
|
|
695
712
|
connectomes: string[];
|
|
713
|
+
customData: string;
|
|
696
714
|
};
|
|
697
715
|
/**
|
|
698
716
|
* Creates and instance of NVDocument
|
|
@@ -752,6 +770,8 @@ declare class NVDocument {
|
|
|
752
770
|
* Sets the 3D labels of the {@link Niivue} instance
|
|
753
771
|
*/
|
|
754
772
|
set labels(labels: NVLabel3D[]);
|
|
773
|
+
get customData(): string | undefined;
|
|
774
|
+
set customData(data: string);
|
|
755
775
|
/**
|
|
756
776
|
* Checks if document has an image by id
|
|
757
777
|
*/
|
|
@@ -779,7 +799,7 @@ declare class NVDocument {
|
|
|
779
799
|
/**
|
|
780
800
|
* Downloads a JSON file with options, scene, images, meshes and drawing of {@link Niivue} instance
|
|
781
801
|
*/
|
|
782
|
-
download(fileName: string): void
|
|
802
|
+
download(fileName: string, compress: boolean): Promise<void>;
|
|
783
803
|
/**
|
|
784
804
|
* Deserialize mesh data objects
|
|
785
805
|
*/
|
|
@@ -910,6 +930,22 @@ type DragReleaseParams = {
|
|
|
910
930
|
tileIdx: number;
|
|
911
931
|
axCorSag: SLICE_TYPE;
|
|
912
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
|
+
};
|
|
913
949
|
|
|
914
950
|
type ValuesArray = Array<{
|
|
915
951
|
id: string;
|
|
@@ -919,8 +955,7 @@ type ValuesArray = Array<{
|
|
|
919
955
|
cal_min?: number;
|
|
920
956
|
cal_max?: number;
|
|
921
957
|
}>;
|
|
922
|
-
type
|
|
923
|
-
type AnyNumberArray = number[] | TypedNumberArray;
|
|
958
|
+
type AnyNumberArray = number[] | Float64Array | Float32Array | Uint32Array | Uint16Array | Uint8Array | Int32Array | Int16Array | Int8Array;
|
|
924
959
|
type DefaultMeshType = {
|
|
925
960
|
positions: Float32Array;
|
|
926
961
|
indices: Uint32Array;
|
|
@@ -1039,7 +1074,7 @@ declare class NVMeshFromUrlOptions {
|
|
|
1039
1074
|
visible: boolean;
|
|
1040
1075
|
layers: NVMeshLayer[];
|
|
1041
1076
|
colorbarVisible: boolean;
|
|
1042
|
-
constructor(url?: string, gl?:
|
|
1077
|
+
constructor(url?: string, gl?: any, name?: string, opacity?: number, rgba255?: Uint8Array, visible?: boolean, layers?: any[], colorbarVisible?: boolean);
|
|
1043
1078
|
}
|
|
1044
1079
|
type BaseLoadParams = {
|
|
1045
1080
|
gl: WebGL2RenderingContext;
|
|
@@ -1089,11 +1124,13 @@ declare class NVMesh {
|
|
|
1089
1124
|
rgba255: Uint8Array;
|
|
1090
1125
|
fiberLength?: number;
|
|
1091
1126
|
fiberLengths?: Uint32Array;
|
|
1127
|
+
fiberDensity?: Float32Array;
|
|
1092
1128
|
fiberDither: number;
|
|
1093
1129
|
fiberColor: string;
|
|
1094
1130
|
fiberDecimationStride: number;
|
|
1095
1131
|
fiberSides: number;
|
|
1096
1132
|
fiberRadius: number;
|
|
1133
|
+
fiberOcclusion: number;
|
|
1097
1134
|
f32PerVertex: number;
|
|
1098
1135
|
fiberMask?: unknown[];
|
|
1099
1136
|
colormap?: ColorMap | LegacyConnectome | string | null;
|
|
@@ -1133,9 +1170,10 @@ declare class NVMesh {
|
|
|
1133
1170
|
* @param colorbarVisible - does this mesh display a colorbar
|
|
1134
1171
|
* @param anatomicalStructurePrimary - region for mesh. Default is an empty string
|
|
1135
1172
|
*/
|
|
1136
|
-
constructor(pts: Float32Array, tris: Uint32Array, name: 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);
|
|
1137
1174
|
initValuesArray(va: ValuesArray): ValuesArray;
|
|
1138
1175
|
linesToCylinders(gl: WebGL2RenderingContext, posClrF32: Float32Array, indices: number[]): void;
|
|
1176
|
+
createFiberDensityMap(): void;
|
|
1139
1177
|
updateFibers(gl: WebGL2RenderingContext): void;
|
|
1140
1178
|
indexNearestXYZmm(Xmm: number, Ymm: number, Zmm: number): number[];
|
|
1141
1179
|
updateMesh(gl: WebGL2RenderingContext): void;
|
|
@@ -1398,18 +1436,23 @@ declare class NVController {
|
|
|
1398
1436
|
onMeshPropertyChanged(meshIndex: number, key: string, val: unknown): void;
|
|
1399
1437
|
}
|
|
1400
1438
|
|
|
1439
|
+
type TypedNumberArray = Float64Array | Float32Array | Uint32Array | Uint16Array | Uint8Array | Int32Array | Int16Array | Int8Array;
|
|
1401
1440
|
/**
|
|
1402
1441
|
* Namespace for utility functions
|
|
1403
1442
|
* @ignore
|
|
1404
1443
|
*/
|
|
1405
1444
|
declare class NVUtilities {
|
|
1406
1445
|
static arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
|
|
1446
|
+
static readMatV4(buffer: ArrayBuffer): Record<string, TypedNumberArray>;
|
|
1407
1447
|
static uint8tob64(bytes: Uint8Array): string;
|
|
1408
|
-
static download(content: string, fileName: string, contentType: string): void;
|
|
1448
|
+
static download(content: string | ArrayBuffer, fileName: string, contentType: string): void;
|
|
1409
1449
|
static readFileAsync(file: Blob): Promise<ArrayBuffer>;
|
|
1410
1450
|
static blobToBase64(blob: Blob): Promise<string>;
|
|
1411
|
-
static decompressBase64String(base64: string): string
|
|
1412
|
-
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>;
|
|
1413
1456
|
static arraysAreEqual(a: unknown[], b: unknown[]): boolean;
|
|
1414
1457
|
/**
|
|
1415
1458
|
* Generate a pre-filled number array.
|
|
@@ -1444,7 +1487,7 @@ declare class NVMeshLoaders {
|
|
|
1444
1487
|
static readTCK(buffer: ArrayBuffer): TCK;
|
|
1445
1488
|
static readTRK(buffer: ArrayBuffer): TRK;
|
|
1446
1489
|
static readTxtVTK(buffer: ArrayBuffer): VTK;
|
|
1447
|
-
static readLayer(name: string
|
|
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;
|
|
1448
1491
|
static readSMP(buffer: ArrayBuffer, n_vert: number): Float32Array;
|
|
1449
1492
|
static readSTC(buffer: ArrayBuffer, n_vert: number): Float32Array;
|
|
1450
1493
|
static readCURV(buffer: ArrayBuffer, n_vert: number): Float32Array;
|
|
@@ -1627,7 +1670,7 @@ declare class Niivue {
|
|
|
1627
1670
|
blurShader: Shader | null;
|
|
1628
1671
|
sobelShader: Shader | null;
|
|
1629
1672
|
genericVAO: WebGLVertexArrayObject | null;
|
|
1630
|
-
unusedVAO:
|
|
1673
|
+
unusedVAO: any;
|
|
1631
1674
|
crosshairs3D: NiivueObject3D | null;
|
|
1632
1675
|
private DEFAULT_FONT_GLYPH_SHEET;
|
|
1633
1676
|
private DEFAULT_FONT_METRICS;
|
|
@@ -1885,7 +1928,7 @@ declare class Niivue {
|
|
|
1885
1928
|
* @example niivue.attachTo('gl')
|
|
1886
1929
|
* @see {@link https://niivue.github.io/niivue/features/basic.multiplanar.html | live demo usage}
|
|
1887
1930
|
*/
|
|
1888
|
-
attachTo(id: string, isAntiAlias?:
|
|
1931
|
+
attachTo(id: string, isAntiAlias?: any): Promise<this>;
|
|
1889
1932
|
/**
|
|
1890
1933
|
* attach the Niivue instance to a canvas element directly
|
|
1891
1934
|
* @param canvas - the canvas element reference
|
|
@@ -1972,7 +2015,7 @@ declare class Niivue {
|
|
|
1972
2015
|
*/
|
|
1973
2016
|
calculateMinMaxVoxIdx(array: number[]): number[];
|
|
1974
2017
|
calculateNewRange({ volIdx }?: {
|
|
1975
|
-
volIdx?: number
|
|
2018
|
+
volIdx?: number;
|
|
1976
2019
|
}): void;
|
|
1977
2020
|
generateMouseUpCallback(fracStart: vec3, fracEnd: vec3): void;
|
|
1978
2021
|
mouseUpListener(): void;
|
|
@@ -2408,6 +2451,22 @@ declare class Niivue {
|
|
|
2408
2451
|
* @see {@link https://niivue.github.io/niivue/features/clipplanes.html | live demo usage}
|
|
2409
2452
|
*/
|
|
2410
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;
|
|
2411
2470
|
/**
|
|
2412
2471
|
* set proportion of volume rendering influenced by selected matcap.
|
|
2413
2472
|
* @param gradientAmount - amount of matcap (0..1), default 0 (matte, surface normal does not influence color)
|
|
@@ -2447,7 +2506,7 @@ declare class Niivue {
|
|
|
2447
2506
|
* const html = `<html><body><canvas id="gl1"></canvas><script type="module" async>
|
|
2448
2507
|
${javascript}</script></body></html>`;
|
|
2449
2508
|
*/
|
|
2450
|
-
generateLoadDocumentJavaScript(canvasId: string, esm: string): string
|
|
2509
|
+
generateLoadDocumentJavaScript(canvasId: string, esm: string): Promise<string>;
|
|
2451
2510
|
/**
|
|
2452
2511
|
* generates HTML of current scene
|
|
2453
2512
|
* @param canvasId - id of canvas NiiVue will be attached to
|
|
@@ -2458,14 +2517,14 @@ declare class Niivue {
|
|
|
2458
2517
|
* %%javascript%%</script></body></html>`;
|
|
2459
2518
|
* nv1.generateHTML("page.html", esm);
|
|
2460
2519
|
*/
|
|
2461
|
-
generateHTML(canvasId: string
|
|
2520
|
+
generateHTML(canvasId: string, esm: string): Promise<string>;
|
|
2462
2521
|
/**
|
|
2463
2522
|
* save current scene as HTML
|
|
2464
2523
|
* @param fileName - the name of the HTML file
|
|
2465
2524
|
* @param canvasId - id of canvas NiiVue will be attached to
|
|
2466
2525
|
* @param esm - bundled version of NiiVue
|
|
2467
2526
|
*/
|
|
2468
|
-
saveHTML(fileName: string
|
|
2527
|
+
saveHTML(fileName: string, canvasId: string, esm: string): Promise<void>;
|
|
2469
2528
|
/**
|
|
2470
2529
|
* Converts NiiVue scene to JSON
|
|
2471
2530
|
*/
|
|
@@ -2473,11 +2532,12 @@ declare class Niivue {
|
|
|
2473
2532
|
/**
|
|
2474
2533
|
* save the entire scene (objects and settings) as a document
|
|
2475
2534
|
* @param fileName - the name of the document storing the scene
|
|
2535
|
+
* @param compress - whether the file should be compressed
|
|
2476
2536
|
* @example
|
|
2477
2537
|
* niivue.saveDocument("niivue.basic.nvd")
|
|
2478
2538
|
* @see {@link https://niivue.github.io/niivue/features/document.3d.html | live demo usage}
|
|
2479
2539
|
*/
|
|
2480
|
-
saveDocument(fileName?: string): Promise<void>;
|
|
2540
|
+
saveDocument(fileName?: string, compress?: boolean): Promise<void>;
|
|
2481
2541
|
/**
|
|
2482
2542
|
* load an array of volume objects
|
|
2483
2543
|
* @param volumeList - the array of objects to load. each object must have a resolvable "url" property at a minimum
|
|
@@ -2628,7 +2688,7 @@ declare class Niivue {
|
|
|
2628
2688
|
top: number;
|
|
2629
2689
|
};
|
|
2630
2690
|
})[];
|
|
2631
|
-
kerning:
|
|
2691
|
+
kerning: any[];
|
|
2632
2692
|
}): Promise<void>;
|
|
2633
2693
|
loadDefaultMatCap(): Promise<WebGLTexture | null>;
|
|
2634
2694
|
loadDefaultFont(): Promise<void>;
|
|
@@ -2688,7 +2748,7 @@ declare class Niivue {
|
|
|
2688
2748
|
* @example niivue.getDescriptives(0);
|
|
2689
2749
|
* @see {@link https://niivue.github.io/niivue/features/draw2.html | live demo usage}
|
|
2690
2750
|
*/
|
|
2691
|
-
getDescriptives(layer?: number, masks?:
|
|
2751
|
+
getDescriptives(layer?: number, masks?: any[], drawingIsMask?: boolean): Descriptive;
|
|
2692
2752
|
refreshLayers(overlayItem: NVImage, layer: number): void;
|
|
2693
2753
|
/**
|
|
2694
2754
|
* query all available color maps that can be applied to volumes
|
|
@@ -2724,8 +2784,8 @@ declare class Niivue {
|
|
|
2724
2784
|
largest_original_cluster_labels(bw: Uint32Array, cl: number, ls: Uint32Array): [number, Uint32Array];
|
|
2725
2785
|
bwlabel(img: Uint32Array, dim: Uint32Array, conn?: number, binarize?: boolean, onlyLargestClusterPerClass?: boolean): [number, Uint32Array];
|
|
2726
2786
|
createConnectedLabelImage(id: string, conn?: number, binarize?: boolean, onlyLargestClusterPerClass?: boolean): Promise<NVImage>;
|
|
2727
|
-
scalecropUint8(img32: Float32Array, dst_min: number
|
|
2728
|
-
scalecropFloat32(img32: Float32Array, dst_min: number
|
|
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>;
|
|
2729
2789
|
getScale(volume: NVImage, dst_min?: number, dst_max?: number, f_low?: number, f_high?: number): [number, number];
|
|
2730
2790
|
conformVox2Vox(inDims: number[], inAffine: number[], outDim?: number, outMM?: number, toRAS?: boolean): [mat4, mat4, mat4];
|
|
2731
2791
|
createNiftiArray(dims?: number[], pixDims?: number[], affine?: number[], datatypeCode?: NiiDataType, img?: Uint8Array): Promise<Uint8Array>;
|
|
@@ -2824,7 +2884,7 @@ declare class Niivue {
|
|
|
2824
2884
|
getLegendPanelWidth(): number;
|
|
2825
2885
|
getLegendPanelHeight(): number;
|
|
2826
2886
|
reserveColorbarPanel(): number[];
|
|
2827
|
-
drawColorbarCore(layer: number
|
|
2887
|
+
drawColorbarCore(layer: number, leftTopWidthHeight: number[], isNegativeColor: boolean, min: number, max: number, isAlphaThreshold: boolean): void;
|
|
2828
2888
|
drawColorbar(): void;
|
|
2829
2889
|
textWidth(scale: number, str: string): number;
|
|
2830
2890
|
textHeight(scale: number, str: string): number;
|
|
@@ -2845,7 +2905,7 @@ declare class Niivue {
|
|
|
2845
2905
|
* @see {@link https://niivue.github.io/niivue/features/draw2.html | live demo usage}
|
|
2846
2906
|
*/
|
|
2847
2907
|
setInterpolation(isNearest: boolean): void;
|
|
2848
|
-
calculateMvpMatrix2D(leftTopWidthHeight: number[], mn: vec3, mx: vec3, clipTolerance: number
|
|
2908
|
+
calculateMvpMatrix2D(leftTopWidthHeight: number[], mn: vec3, mx: vec3, clipTolerance: number, clipDepth: number, azimuth: number, elevation: number, isRadiolgical: boolean): MvpMatrix2D;
|
|
2849
2909
|
swizzleVec3MM(v3: vec3, axCorSag: SLICE_TYPE): vec3;
|
|
2850
2910
|
screenFieldOfViewVox(axCorSag?: number): vec3;
|
|
2851
2911
|
screenFieldOfViewMM(axCorSag?: number, forceSliceMM?: boolean): vec3;
|
|
@@ -2854,7 +2914,7 @@ declare class Niivue {
|
|
|
2854
2914
|
drawSliceOrientationText(leftTopWidthHeight: number[], axCorSag: SLICE_TYPE): void;
|
|
2855
2915
|
xyMM2xyzMM(axCorSag: SLICE_TYPE, sliceFrac: number): number[];
|
|
2856
2916
|
draw2D(leftTopWidthHeight: number[], axCorSag: SLICE_TYPE, customMM?: number): void;
|
|
2857
|
-
calculateMvpMatrix(_unused: unknown, leftTopWidthHeight: number[]
|
|
2917
|
+
calculateMvpMatrix(_unused: unknown, leftTopWidthHeight: number[], azimuth: number, elevation: number): mat4[];
|
|
2858
2918
|
calculateModelMatrix(azimuth: number, elevation: number): mat4;
|
|
2859
2919
|
calculateRayDirection(azimuth: number, elevation: number): vec3;
|
|
2860
2920
|
sceneExtentsMinMax(isSliceMM?: boolean): vec3[];
|
|
@@ -2876,7 +2936,7 @@ declare class Niivue {
|
|
|
2876
2936
|
calculateScreenPoint(point: [number, number, number], mvpMatrix: mat4, leftTopWidthHeight: number[]): vec4;
|
|
2877
2937
|
getLabelAtPoint(screenPoint: [number, number]): NVLabel3D | null;
|
|
2878
2938
|
drawLabelLine(label: NVLabel3D, pos: vec2, mvpMatrix: mat4, leftTopWidthHeight: number[], secondPass?: boolean): void;
|
|
2879
|
-
draw3DLabel(label: NVLabel3D, pos: vec2, mvpMatrix: mat4, leftTopWidthHeight: number[], bulletMargin: number
|
|
2939
|
+
draw3DLabel(label: NVLabel3D, pos: vec2, mvpMatrix: mat4, leftTopWidthHeight: number[], bulletMargin: number, legendWidth: number, secondPass?: boolean): void;
|
|
2880
2940
|
draw3DLabels(mvpMatrix: mat4, leftTopWidthHeight: number[], secondPass?: boolean): void;
|
|
2881
2941
|
draw3D(leftTopWidthHeight?: number[], mvpMatrix?: mat4 | null, modelMatrix?: mat4 | null, normalMatrix?: mat4 | null, azimuth?: number | null, elevation?: number): string | undefined;
|
|
2882
2942
|
drawMesh3D(isDepthTest?: boolean, alpha?: number, m?: mat4, modelMtx?: mat4, normMtx?: mat4): void;
|
|
@@ -2917,4 +2977,4 @@ declare class Niivue {
|
|
|
2917
2977
|
set gl(gl: WebGL2RenderingContext | null);
|
|
2918
2978
|
}
|
|
2919
2979
|
|
|
2920
|
-
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 };
|