@niivue/niivue 0.57.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -60
- package/build/index.d.ts +104 -56
- package/build/index.js +342 -111
- package/build/index.js.map +1 -1
- package/build/index.min.js +1 -1
- package/build/metafile-esm.json +1 -1
- package/dist/index.d.ts +104 -56
- package/dist/index.js +342 -111
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/niivue.umd.js +121 -121
- package/package.json +3 -3
- package/src/index_histo.html +13 -7
- package/src/niivue/index.ts +112 -65
- package/src/nvconnectome.ts +6 -4
- package/src/nvdocument.ts +158 -33
- package/src/nvimage/ImageReaders/mgh.ts +43 -0
- package/src/nvimage/index.ts +32 -9
- package/src/nvmesh-loaders.ts +62 -17
- package/src/nvmesh.ts +5 -1
- package/src/shader-srcs.ts +3 -1
- package/src/types.ts +1 -0
package/README.md
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
# NiiVue
|
|
2
2
|
|
|
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.
|
|
4
|
-
|
|
5
|
-
### [Click here to see NiiVue live demos](https://niivue.github.io/niivue/)
|
|
6
|
-
|
|
7
|
-
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), and [VTK.js](https://kitware.github.io/paraview-glance/app/).
|
|
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. See [niivue.com](https://niivue.com/) for examples and documentation.
|
|
8
4
|
|
|
9
5
|
## Local Development
|
|
10
6
|
|
|
@@ -16,58 +12,3 @@ cd niivue
|
|
|
16
12
|
npm install
|
|
17
13
|
npm run dev
|
|
18
14
|
```
|
|
19
|
-
|
|
20
|
-
The command `npm run demo` will minify the project and locally host all of the [live demos](https://niivue.github.io/niivue/). The [DEVELOP.md file provides more details for developers](./packages/niivue/DEVELOP.md).
|
|
21
|
-
|
|
22
|
-
# Developer Documentation
|
|
23
|
-
|
|
24
|
-
[Click here for the docs web page](https://niivue.github.io/niivue/devdocs/)
|
|
25
|
-
|
|
26
|
-
# NiiVue Users
|
|
27
|
-
|
|
28
|
-
- Analysis of Functional NeuroImages (AFNI) [Scientific and Statistical Computing Core](https://afni.nimh.nih.gov/) (National Institutes of Health)
|
|
29
|
-
- [BOOSTLET.js](https://boostlet.org/) image processing plugins work with NiiVue.
|
|
30
|
-
- [brainchop](https://github.com/neuroneural/brainchop) uses NiiVue for their [drag-and-drop segmentation, brain extraction and parcellation tool](https://neuroneural.github.io/brainchop/)
|
|
31
|
-
- [BrainLife.io](https://brainlife.io/about/) integrates NiiVue into [ezbids](https://brainlife.io/ezbids/)
|
|
32
|
-
- [CACTAS](https://github.com/mpsych/CACTAS) from [Daniel Haehn's team](https://danielhaehn.com/) is extending NiiVue drawing and segmentation capabilities
|
|
33
|
-
- [ChRIS Research Integration System (ChRIS) from Boston Children's Hospital](https://chrisproject.org/) uses [NiiVue](https://app.chrisproject.org/niivue)
|
|
34
|
-
- [Center for the Study of Aphasia Recovery (C-STAR)](https://cstar.sc.edu/) (University of South Carolina)
|
|
35
|
-
- [Digital Brain Bank](https://elifesciences.org/articles/73153) for navigating MRI datasets
|
|
36
|
-
- FMRIB's Software Library (FSL) [Wellcome Centre for Integrative Neuroimaging](https://www.win.ox.ac.uk/) (University of Oxford)
|
|
37
|
-
- FreeSurfer [Laboratories for Computational Neuroimaging](https://lcn.martinos.org/) (Massachusetts General Hospital) uses NiiVue for [FreeBrowse](https://github.com/freesurfer/freebrowse)
|
|
38
|
-
- [lazybids-ui](https://github.com/lazybids/lazybids-ui) is a web-based user interface for interacting with BIDS datasets.
|
|
39
|
-
- [OpenNeuro.org](https://openneuro.org) uses NiiVue to visualize datasets
|
|
40
|
-
- [neurodesk](https://www.neurodesk.org/) uses NiiVue for their [QSMxT Quantitative Susceptibility Mapping toolbox](https://github.com/QSMxT/QSMxT-UI)
|
|
41
|
-
- [neurosift](https://github.com/flatironinstitute/neurosift) provides NWB visualization and DANDI exploration
|
|
42
|
-
- [Neuroinformatics Research and Development Group](http://neuroinformatics.uw.edu/) embeds NiiVue in [tractoscope](https://github.com/nrdg/tractoscope)
|
|
43
|
-
- [NiiVueReader](https://github.com/BrunoDG/NiiVueReader) by Bruno Dias demonstrates a full stack deployment.
|
|
44
|
-
- [niivue-vscode](https://github.com/niivue/niivue-vscode) is a VSCode extension for displaying images
|
|
45
|
-
- [nilearn](https://nilearn.github.io/stable/index.html) is extending [ipyniivue](https://github.com/niivue/ipyniivue)
|
|
46
|
-
- [QuantCo](https://www.quantco.com/) is using NiiVue in medical imaging workflows
|
|
47
|
-
- [FSL Clinical](https://fslclinical.com/) is using NiiVue in brain imaging reports
|
|
48
|
-
- [brain2print](https://brain2print.org/) (from the NiiVue team) uses NiiVue for showing both volume data and converted meshes
|
|
49
|
-
- [ct2print](https://ct2print.org/) (from the NiiVue team) uses NiiVue for showing volume and mesh data
|
|
50
|
-
- [ipyniivue](https://github.com/niivue/ipyniivue) allows NiiVue to be used in Jupyter Notebooks
|
|
51
|
-
- [T2Lesion](https://niivue.github.io/T2lesion/) (from the NiiVue team) uses NiiVue to show input data and segmented lesion masks
|
|
52
|
-
- [NiiVue Desktop](https://github.com/niivue/desktop) (from the NiiVue team) uses NiiVue in a crossplatform Electron app
|
|
53
|
-
- [NiiVue iOS](https://github.com/niivue/ios) (from the NiiVue team) uses NiiVue in a hybrid Swift + webView mobile app
|
|
54
|
-
- [NiiVue Neglect](https://niivue.github.io/niivue-neglect/) uses NiiVue to visualise stroke lesion data in the spatial neglect severity prediction tool
|
|
55
|
-
- [Plurimedia](https://www.plurimedia.it/) uses NiiVue in client work for medical image visualization
|
|
56
|
-
- [Slice:Drop Reloaded](https://gaiborjosue.github.io/slicedrop.github.com/reload/) uses WebGL2-based NiiVue to extend the pioneering WebGL1-based [slicedrop](https://slicedrop.com/) that used the seminal XTK library.
|
|
57
|
-
- [VoxLogicA-UI](https://voxlogica-project.github.io/VoxLogicA-UI/) makes advanced medical
|
|
58
|
-
imaging analysis intuitive
|
|
59
|
-
|
|
60
|
-
# Funding
|
|
61
|
-
|
|
62
|
-
- 2021-2022 [P50 DC014664](https://reporter.nih.gov/search/D3sOjJtXwkSRKLpYf1ctBg/project-details/10094384) NIH NIDCD [NOT-OD-21-091](https://grants.nih.gov/grants/guide/notice-files/NOT-OD-21-091.html#:~:text=NOT%2DOD%2D21%2D091,Software%20Tools%20for%20Open%20Science)
|
|
63
|
-
- 2023-2026 [RF1 MH133701](https://reporter.nih.gov/search/D3sOjJtXwkSRKLpYf1ctBg/project-details/10724895) NIH NIMH
|
|
64
|
-
|
|
65
|
-
# Supported Formats
|
|
66
|
-
|
|
67
|
-
NiiVue supports many popular brain imaging formats:
|
|
68
|
-
|
|
69
|
-
- 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).
|
|
70
|
-
- 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), [WRL](https://en.wikipedia.org/wiki/VRML), [X3D](https://3dprint.nih.gov/).
|
|
71
|
-
- 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)
|
|
72
|
-
- 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
|
|
73
|
-
- DICOM: [DICOM](https://dicom.nema.org/medical/dicom/current/output/chtml/part10/chapter_7.html) and [DICOM Manifests](docs/development-notes/dicom-manifests.md)
|
package/build/index.d.ts
CHANGED
|
@@ -403,7 +403,7 @@ declare class NVImage {
|
|
|
403
403
|
readNPZ(buffer: ArrayBuffer): Promise<ArrayBuffer>;
|
|
404
404
|
imageDataFromArrayBuffer(buffer: ArrayBuffer): Promise<ImageData>;
|
|
405
405
|
readBMP(buffer: ArrayBuffer): Promise<ArrayBuffer>;
|
|
406
|
-
readZARR(buffer: ArrayBuffer, zarrData: unknown): Promise<
|
|
406
|
+
readZARR(buffer: ArrayBuffer, zarrData: unknown): Promise<ArrayBufferLike>;
|
|
407
407
|
readVMR(buffer: ArrayBuffer): ArrayBuffer;
|
|
408
408
|
readFIB(buffer: ArrayBuffer): Promise<[ArrayBuffer, Float32Array]>;
|
|
409
409
|
readSRC(buffer: ArrayBuffer): Promise<ArrayBuffer>;
|
|
@@ -429,7 +429,7 @@ declare class NVImage {
|
|
|
429
429
|
* set contrast/brightness to robust range (2%..98%)
|
|
430
430
|
* @param vol - volume for estimate (use -1 to use estimate on all loaded volumes; use INFINITY for current volume)
|
|
431
431
|
* @param isBorder - if true (default) only center of volume used for estimate
|
|
432
|
-
* @
|
|
432
|
+
* @returns volume brightness and returns array [pct2, pct98, mnScale, mxScale]
|
|
433
433
|
* @see {@link https://niivue.github.io/niivue/features/timeseries2.html | live demo usage}
|
|
434
434
|
*/
|
|
435
435
|
calMinMax(vol?: number, isBorder?: boolean): number[];
|
|
@@ -824,16 +824,16 @@ type Scene = {
|
|
|
824
824
|
gamma?: number;
|
|
825
825
|
};
|
|
826
826
|
type DocumentData = {
|
|
827
|
-
title
|
|
828
|
-
imageOptionsArray
|
|
829
|
-
meshOptionsArray
|
|
830
|
-
opts
|
|
831
|
-
previewImageDataURL
|
|
832
|
-
labels
|
|
833
|
-
encodedImageBlobs
|
|
834
|
-
encodedDrawingBlob
|
|
827
|
+
title?: string;
|
|
828
|
+
imageOptionsArray?: ImageFromUrlOptions[];
|
|
829
|
+
meshOptionsArray?: unknown[];
|
|
830
|
+
opts?: Partial<NVConfigOptions>;
|
|
831
|
+
previewImageDataURL?: string;
|
|
832
|
+
labels?: NVLabel3D[];
|
|
833
|
+
encodedImageBlobs?: string[];
|
|
834
|
+
encodedDrawingBlob?: string;
|
|
835
835
|
meshesString?: string;
|
|
836
|
-
sceneData?: SceneData
|
|
836
|
+
sceneData?: Partial<SceneData>;
|
|
837
837
|
connectomes?: string[];
|
|
838
838
|
customData?: string;
|
|
839
839
|
};
|
|
@@ -927,17 +927,25 @@ declare class NVDocument {
|
|
|
927
927
|
*/
|
|
928
928
|
removeImage(image: NVImage): void;
|
|
929
929
|
/**
|
|
930
|
-
*
|
|
930
|
+
* Fetch any image data that is missing from this document.
|
|
931
|
+
* This includes loading image blobs for `ImageFromUrlOptions` with valid `url` fields.
|
|
932
|
+
* After calling this, `volumes` and `imageOptionsMap` will be populated.
|
|
931
933
|
*/
|
|
932
|
-
|
|
934
|
+
fetchLinkedData(): Promise<void>;
|
|
933
935
|
/**
|
|
934
|
-
*
|
|
936
|
+
* Returns the options for the image if it was added by url
|
|
935
937
|
*/
|
|
936
|
-
|
|
938
|
+
getImageOptions(image: NVImage): ImageFromUrlOptions | null;
|
|
937
939
|
/**
|
|
938
|
-
*
|
|
940
|
+
* Serialise the document.
|
|
941
|
+
*
|
|
942
|
+
* @param embedImages If false, encodedImageBlobs is left empty
|
|
943
|
+
* (imageOptionsArray still records the URL / name).
|
|
939
944
|
*/
|
|
940
|
-
|
|
945
|
+
json(embedImages?: boolean): ExportDocumentData;
|
|
946
|
+
download(fileName: string, compress: boolean, opts?: {
|
|
947
|
+
embedImages: boolean;
|
|
948
|
+
}): Promise<void>;
|
|
941
949
|
/**
|
|
942
950
|
* Deserialize mesh data objects
|
|
943
951
|
*/
|
|
@@ -951,9 +959,20 @@ declare class NVDocument {
|
|
|
951
959
|
*/
|
|
952
960
|
static loadFromFile(file: Blob): Promise<NVDocument>;
|
|
953
961
|
/**
|
|
954
|
-
* Factory method to return an instance of NVDocument from JSON
|
|
962
|
+
* Factory method to return an instance of NVDocument from JSON.
|
|
963
|
+
*
|
|
964
|
+
* This will merge any saved configuration options (`opts`) with the DEFAULT_OPTIONS,
|
|
965
|
+
* ensuring any missing values are filled with defaults. It also restores special-case
|
|
966
|
+
* fields like `meshThicknessOn2D` when serialized as the string "infinity".
|
|
967
|
+
*
|
|
968
|
+
* @param data - A serialized DocumentData object
|
|
969
|
+
* @returns A reconstructed NVDocument instance
|
|
955
970
|
*/
|
|
956
971
|
static loadFromJSON(data: DocumentData): NVDocument;
|
|
972
|
+
/**
|
|
973
|
+
* Factory method to return an instance of NVDocument from JSON
|
|
974
|
+
*/
|
|
975
|
+
static oldloadFromJSON(data: DocumentData): NVDocument;
|
|
957
976
|
}
|
|
958
977
|
|
|
959
978
|
type NiftiHeader = {
|
|
@@ -1039,6 +1058,7 @@ type ConnectomeOptions = {
|
|
|
1039
1058
|
edgeMax: number;
|
|
1040
1059
|
edgeScale: number;
|
|
1041
1060
|
legendLineThickness?: number;
|
|
1061
|
+
showLegend?: boolean;
|
|
1042
1062
|
};
|
|
1043
1063
|
type Connectome = ConnectomeOptions & {
|
|
1044
1064
|
nodes: NVConnectomeNode[];
|
|
@@ -1305,6 +1325,7 @@ declare class NVMesh {
|
|
|
1305
1325
|
nodeScale: number;
|
|
1306
1326
|
edgeScale: number;
|
|
1307
1327
|
legendLineThickness: number;
|
|
1328
|
+
showLegend: boolean;
|
|
1308
1329
|
nodeColormap: string;
|
|
1309
1330
|
edgeColormap: string;
|
|
1310
1331
|
nodeColormapNegative?: string;
|
|
@@ -2283,7 +2304,7 @@ declare class Niivue {
|
|
|
2283
2304
|
binarize(volume: NVImage): void;
|
|
2284
2305
|
/**
|
|
2285
2306
|
* Open drawing
|
|
2286
|
-
* @param
|
|
2307
|
+
* @param fnm - filename of NIfTI format drawing
|
|
2287
2308
|
* @param isBinarize - if true will force drawing voxels to be either 0 or 1.
|
|
2288
2309
|
* @example niivue.loadDrawingFromUrl("../images/lesion.nii.gz");
|
|
2289
2310
|
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html | live demo usage}
|
|
@@ -2306,12 +2327,17 @@ declare class Niivue {
|
|
|
2306
2327
|
*/
|
|
2307
2328
|
removeHaze(level?: number, volIndex?: number): void;
|
|
2308
2329
|
/**
|
|
2309
|
-
*
|
|
2310
|
-
*
|
|
2311
|
-
* @param
|
|
2312
|
-
*
|
|
2313
|
-
*
|
|
2314
|
-
*
|
|
2330
|
+
* Save voxel-based image to disk.
|
|
2331
|
+
*
|
|
2332
|
+
* @param options - configuration object with the following fields:
|
|
2333
|
+
* - `filename`: name of the NIfTI image to create
|
|
2334
|
+
* - `isSaveDrawing`: whether to save the drawing layer or the background image
|
|
2335
|
+
* - `volumeByIndex`: which image layer to save (0 for background)
|
|
2336
|
+
* @returns `true` if successful when writing to disk, or a `Uint8Array` if exported as binary data
|
|
2337
|
+
*
|
|
2338
|
+
* @example
|
|
2339
|
+
* niivue.saveImage({ filename: "myimage.nii.gz", isSaveDrawing: true });
|
|
2340
|
+
* niivue.saveImage({ filename: "myimage.nii.gz", isSaveDrawing: true });
|
|
2315
2341
|
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html | live demo usage}
|
|
2316
2342
|
*/
|
|
2317
2343
|
saveImage(options?: SaveImageOptions): Promise<boolean | Uint8Array>;
|
|
@@ -2320,14 +2346,14 @@ declare class Niivue {
|
|
|
2320
2346
|
* change property of mesh, tractogram or connectome
|
|
2321
2347
|
* @param id - identity of mesh to change
|
|
2322
2348
|
* @param key - attribute to change
|
|
2323
|
-
* @param
|
|
2349
|
+
* @param val - for attribute
|
|
2324
2350
|
* @example niivue.setMeshProperty(niivue.meshes[0].id, 'fiberLength', 42)
|
|
2325
2351
|
* @see {@link https://niivue.github.io/niivue/features/meshes.html | live demo usage}
|
|
2326
2352
|
*/
|
|
2327
2353
|
setMeshProperty(id: number, key: keyof NVMesh, val: number | string | boolean | Uint8Array | number[] | ColorMap | LegacyConnectome | Float32Array): void;
|
|
2328
2354
|
/**
|
|
2329
2355
|
* returns the index of the mesh vertex that is closest to the provided coordinates
|
|
2330
|
-
* @param
|
|
2356
|
+
* @param mesh - identity of mesh to change
|
|
2331
2357
|
* @param Xmm - location in left/right dimension
|
|
2332
2358
|
* @param Ymm - location in posterior/anterior dimension
|
|
2333
2359
|
* @param Zmm - location in foot/head dimension
|
|
@@ -2347,7 +2373,7 @@ declare class Niivue {
|
|
|
2347
2373
|
decimateHierarchicalMesh(mesh: number, order?: number): boolean;
|
|
2348
2374
|
/**
|
|
2349
2375
|
* reverse triangle winding of mesh (swap front and back faces)
|
|
2350
|
-
* @param
|
|
2376
|
+
* @param mesh - identity of mesh to change
|
|
2351
2377
|
* @example niivue.reverseFaces(niivue.meshes[0].id)
|
|
2352
2378
|
* @see {@link https://niivue.github.io/niivue/features/meshes.html | live demo usage}
|
|
2353
2379
|
*/
|
|
@@ -2357,7 +2383,7 @@ declare class Niivue {
|
|
|
2357
2383
|
* @param mesh - identity of mesh to change
|
|
2358
2384
|
* @param layer - selects the mesh overlay (e.g. GIfTI or STC file)
|
|
2359
2385
|
* @param key - attribute to change
|
|
2360
|
-
* @param
|
|
2386
|
+
* @param val - value for attribute
|
|
2361
2387
|
* @example niivue.setMeshLayerProperty(niivue.meshes[0].id, 0, 'frame4D', 22)
|
|
2362
2388
|
* @see {@link https://niivue.github.io/niivue/features/mesh.4D.html | live demo usage}
|
|
2363
2389
|
*/
|
|
@@ -2468,8 +2494,11 @@ declare class Niivue {
|
|
|
2468
2494
|
*/
|
|
2469
2495
|
sph2cartDeg(azimuth: number, elevation: number): number[];
|
|
2470
2496
|
/**
|
|
2471
|
-
*
|
|
2472
|
-
* @param
|
|
2497
|
+
* Update the clip plane orientation in 3D view mode.
|
|
2498
|
+
* @param depthAzimuthElevation - a 3-component array:
|
|
2499
|
+
* - `depth`: distance of clip plane from center of volume (0 to ~1.73, or >2.0 to disable clipping)
|
|
2500
|
+
* - `azimuth`: camera angle around the object in degrees (0–360 or -180–180)
|
|
2501
|
+
* - `elevation`: camera height in degrees (-90 to 90)
|
|
2473
2502
|
* @example
|
|
2474
2503
|
* niivue = new Niivue()
|
|
2475
2504
|
* niivue.setClipPlane([42, 42])
|
|
@@ -2526,7 +2555,7 @@ declare class Niivue {
|
|
|
2526
2555
|
sliceScroll2D(posChange: number, x: number, y: number, isDelta?: boolean): void;
|
|
2527
2556
|
/**
|
|
2528
2557
|
* set the slice type. This changes the view mode
|
|
2529
|
-
* @param
|
|
2558
|
+
* @param st - sliceType is an enum of slice types to use
|
|
2530
2559
|
* @example
|
|
2531
2560
|
* niivue = new Niivue()
|
|
2532
2561
|
* niivue.setSliceType(Niivue.sliceTypeMultiplanar)
|
|
@@ -2569,7 +2598,8 @@ declare class Niivue {
|
|
|
2569
2598
|
setClipPlaneThick(thick: number): void;
|
|
2570
2599
|
/**
|
|
2571
2600
|
* set the clipping region for volume rendering
|
|
2572
|
-
* @param
|
|
2601
|
+
* @param low - 3-component array specifying the lower bound of the clipping region along the X, Y, and Z axes. Values range from 0 (start) to 1 (end of volume).
|
|
2602
|
+
* @param high - 3-component array specifying the upper bound of the clipping region along the X, Y, and Z axes. Values range from 0 to 1.
|
|
2573
2603
|
* @example
|
|
2574
2604
|
* niivue.setClipPlaneColor([0.0, 0.0, 0.2], [1.0, 1.0, 0.7]) // remove inferior 20% and superior 30%
|
|
2575
2605
|
* @see {@link https://niivue.github.io/niivue/features/clipplanes.html | live demo usage}
|
|
@@ -2648,14 +2678,22 @@ declare class Niivue {
|
|
|
2648
2678
|
*/
|
|
2649
2679
|
json(): ExportDocumentData;
|
|
2650
2680
|
/**
|
|
2651
|
-
*
|
|
2652
|
-
*
|
|
2653
|
-
* @param
|
|
2681
|
+
* Save the current scene as an .nvd document.
|
|
2682
|
+
*
|
|
2683
|
+
* @param fileName Name of the file to create (default "untitled.nvd")
|
|
2684
|
+
* @param compress If true, gzip-compress the JSON (default true)
|
|
2685
|
+
* @param options Fine-grained switches:
|
|
2686
|
+
* • embedImages – store encodedImageBlobs (default true)
|
|
2687
|
+
* • embedPreview – store previewImageDataURL (default true)
|
|
2688
|
+
*
|
|
2654
2689
|
* @example
|
|
2655
|
-
*
|
|
2656
|
-
*
|
|
2690
|
+
* // smallest possible file – no preview, just metadata
|
|
2691
|
+
* await nv.saveDocument('scene.nvd', true, { embedImages:false, embedPreview:false });
|
|
2657
2692
|
*/
|
|
2658
|
-
saveDocument(fileName?: string, compress?: boolean
|
|
2693
|
+
saveDocument(fileName?: string, compress?: boolean, options?: {
|
|
2694
|
+
embedImages?: boolean;
|
|
2695
|
+
embedPreview?: boolean;
|
|
2696
|
+
}): Promise<void>;
|
|
2659
2697
|
loadImages(images: Array<ImageFromUrlOptions | LoadFromUrlParams>): Promise<this>;
|
|
2660
2698
|
loadDicoms(dicomList: ImageFromUrlOptions[]): Promise<this>;
|
|
2661
2699
|
/**
|
|
@@ -2687,20 +2725,25 @@ declare class Niivue {
|
|
|
2687
2725
|
*/
|
|
2688
2726
|
loadMeshes(meshList: LoadFromUrlParams[]): Promise<this>;
|
|
2689
2727
|
/**
|
|
2690
|
-
*
|
|
2691
|
-
*
|
|
2728
|
+
* Load a connectome from a given URL and initialize it.
|
|
2729
|
+
*
|
|
2730
|
+
* @param url - the URL to a JSON-formatted connectome definition
|
|
2731
|
+
* @param headers - optional HTTP headers to include with the request (e.g. for authorization)
|
|
2732
|
+
* @returns the `Niivue` instance (for method chaining)
|
|
2692
2733
|
* @see {@link https://niivue.github.io/niivue/features/connectome.html | live demo usage}
|
|
2693
2734
|
*/
|
|
2694
2735
|
loadConnectomeFromUrl(url: string, headers?: {}): Promise<this>;
|
|
2695
2736
|
/**
|
|
2696
|
-
*
|
|
2697
|
-
* @
|
|
2737
|
+
* Load a FreeSurfer-style connectome from a given URL and initialize it.
|
|
2738
|
+
* @param url - the URL of the JSON-formatted connectome file
|
|
2739
|
+
* @param headers - optional HTTP headers to include in the fetch request (e.g. for authorization)
|
|
2740
|
+
* @returns the `Niivue` instance (for method chaining)
|
|
2698
2741
|
* @see {@link https://niivue.github.io/niivue/features/connectome.html | live demo usage}
|
|
2699
2742
|
*/
|
|
2700
2743
|
loadFreeSurferConnectomeFromUrl(url: string, headers?: {}): Promise<this>;
|
|
2701
2744
|
/**
|
|
2702
2745
|
* load a connectome specified by json
|
|
2703
|
-
* @param
|
|
2746
|
+
* @param json - freesurfer model
|
|
2704
2747
|
* @returns Niivue instance
|
|
2705
2748
|
* @see {@link https://niivue.github.io/niivue/features/connectome.html | live demo usage}
|
|
2706
2749
|
*/
|
|
@@ -2713,7 +2756,7 @@ declare class Niivue {
|
|
|
2713
2756
|
loadConnectomeAsMesh(json: Connectome | LegacyConnectome | FreeSurferConnectome): NVMesh;
|
|
2714
2757
|
/**
|
|
2715
2758
|
* load a connectome specified by json
|
|
2716
|
-
* @param
|
|
2759
|
+
* @param json - connectome model
|
|
2717
2760
|
* @returns Niivue instance
|
|
2718
2761
|
* @see {@link https://niivue.github.io/niivue/features/connectome.html | live demo usage}
|
|
2719
2762
|
*/
|
|
@@ -2769,7 +2812,7 @@ declare class Niivue {
|
|
|
2769
2812
|
loadBmpTexture(bmpUrl: string): Promise<WebGLTexture | null>;
|
|
2770
2813
|
/**
|
|
2771
2814
|
* Load matcap for illumination model.
|
|
2772
|
-
* @param
|
|
2815
|
+
* @param bmpUrl - name of matcap to load ("Shiny", "Cortex", "Cream")
|
|
2773
2816
|
* @example
|
|
2774
2817
|
* niivue.loadMatCapTexture("Cortex");
|
|
2775
2818
|
* @see {@link https://niivue.github.io/niivue/features/shiny.volumes.html | live demo usage}
|
|
@@ -2778,7 +2821,9 @@ declare class Niivue {
|
|
|
2778
2821
|
initFontMets(): void;
|
|
2779
2822
|
/**
|
|
2780
2823
|
* Load typeface for colorbars, measurements and orientation text.
|
|
2781
|
-
* @param
|
|
2824
|
+
* @param fontSheetUrl - URL to a bitmap font sheet image (e.g., a PNG atlas of glyphs)
|
|
2825
|
+
* @param metricsUrl - URL to the corresponding font metrics JSON (defines character bounds and spacing)
|
|
2826
|
+
* @returns a Promise that resolves when the font is loaded
|
|
2782
2827
|
* @example
|
|
2783
2828
|
* niivue.loadMatCapTexture("Cortex");
|
|
2784
2829
|
* @see {@link https://niivue.github.io/niivue/features/selectfont.html | live demo usage}
|
|
@@ -2848,9 +2893,9 @@ declare class Niivue {
|
|
|
2848
2893
|
};
|
|
2849
2894
|
/**
|
|
2850
2895
|
* Define a new GLSL shader program to influence mesh coloration
|
|
2851
|
-
* @param fragmentShaderText - custom fragment shader
|
|
2852
|
-
* @param
|
|
2853
|
-
* @returns index of the new shader (
|
|
2896
|
+
* @param fragmentShaderText - the GLSL source code for the custom fragment shader
|
|
2897
|
+
* @param name - a descriptive label for the shader (used in menus or debugging)
|
|
2898
|
+
* @returns the index of the new shader (use with {@link setMeshShader})
|
|
2854
2899
|
* @see {@link https://niivue.github.io/niivue/features/mesh.atlas.html | live demo usage}
|
|
2855
2900
|
*/
|
|
2856
2901
|
setCustomMeshShader(fragmentShaderText?: string, name?: string): number;
|
|
@@ -2905,7 +2950,6 @@ declare class Niivue {
|
|
|
2905
2950
|
refreshLayers(overlayItem: NVImage, layer: number): void;
|
|
2906
2951
|
/**
|
|
2907
2952
|
* query all available color maps that can be applied to volumes
|
|
2908
|
-
* @param sort - whether or not to sort the returned array
|
|
2909
2953
|
* @returns an array of colormap strings
|
|
2910
2954
|
* @example
|
|
2911
2955
|
* niivue = new Niivue()
|
|
@@ -2916,7 +2960,7 @@ declare class Niivue {
|
|
|
2916
2960
|
/**
|
|
2917
2961
|
* create a new colormap
|
|
2918
2962
|
* @param key - name of new colormap
|
|
2919
|
-
* @param
|
|
2963
|
+
* @param cmap - colormap properties (Red, Green, Blue, Alpha and Indices)
|
|
2920
2964
|
* @see {@link https://niivue.github.io/niivue/features/colormaps.html | live demo usage}
|
|
2921
2965
|
*/
|
|
2922
2966
|
addColormap(key: string, cmap: ColorMap): void;
|
|
@@ -2956,7 +3000,7 @@ declare class Niivue {
|
|
|
2956
3000
|
conform(volume: NVImage, toRAS?: boolean, isLinear?: boolean, asFloat32?: boolean, isRobustMinMax?: boolean): Promise<NVImage>;
|
|
2957
3001
|
/**
|
|
2958
3002
|
* darken crevices and brighten corners when 3D rendering drawings.
|
|
2959
|
-
* @param
|
|
3003
|
+
* @param ao - amount of ambient occlusion (default 0.4)
|
|
2960
3004
|
* @see {@link https://niivue.github.io/niivue/features/torso.html | live demo usage}
|
|
2961
3005
|
*/
|
|
2962
3006
|
setRenderDrawAmbientOcclusion(ao: number): void;
|
|
@@ -3090,9 +3134,13 @@ declare class Niivue {
|
|
|
3090
3134
|
createOnLocationChange(axCorSag?: number): void;
|
|
3091
3135
|
/**
|
|
3092
3136
|
* Add a 3D Label
|
|
3093
|
-
* @param text - text of the label
|
|
3094
|
-
* @param style - label
|
|
3095
|
-
* @param
|
|
3137
|
+
* @param text - the text content of the label
|
|
3138
|
+
* @param style - visual styling options for the label (e.g., color, scale, line width)
|
|
3139
|
+
* @param points - a 3D point `[x, y, z]` or array of points to anchor the label in space
|
|
3140
|
+
* @param anchor - optional label anchor position (e.g., top-left, center, etc.)
|
|
3141
|
+
* @param onClick - optional callback function to invoke when the label is clicked
|
|
3142
|
+
* @returns the created `NVLabel3D` instance
|
|
3143
|
+
* @see {@link https://niivue.github.io/niivue/features/labels.html | live demo usage}
|
|
3096
3144
|
*/
|
|
3097
3145
|
addLabel(text: string, style: NVLabel3DStyle, points?: number[] | number[][], anchor?: LabelAnchorPoint, onClick?: (label: NVLabel3D) => void): NVLabel3D;
|
|
3098
3146
|
calculateScreenPoint(point: [number, number, number], mvpMatrix: mat4, leftTopWidthHeight: number[]): vec4;
|