@niivue/niivue 0.50.0 → 0.52.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 +70 -0
- package/build/index.d.ts +35 -222
- package/build/index.js +554 -654
- 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 +35 -222
- package/dist/index.js +735 -1713
- 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 +205 -89
- package/package.json +2 -2
- package/src/niivue/index.ts +150 -56
- package/src/niivue/utils.ts +34 -0
- package/src/nvdocument.ts +8 -4
- package/src/nvimage/index.ts +246 -128
- package/src/nvmesh-loaders.ts +36 -3
- package/src/nvmesh-types.ts +7 -1
- package/src/nvmesh.ts +2 -2
- package/src/shader-srcs.ts +142 -8
- package/src/nvcontroller.ts +0 -398
- package/src/nvmessage.ts +0 -103
- package/src/session-bus.ts +0 -196
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# NiiVue
|
|
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. We have additional [repositories](https://github.com/niivue) that wrap NiiVue for use in jupyter notebooks, vscode, and electron applications.
|
|
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/).
|
|
8
|
+
|
|
9
|
+
## Local Development
|
|
10
|
+
|
|
11
|
+
To run a hot-loading development that is updated whenever you save changes to any source files, you can run:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
git clone git@github.com:niivue/niivue.git
|
|
15
|
+
cd niivue
|
|
16
|
+
npm install
|
|
17
|
+
npm run dev
|
|
18
|
+
```
|
|
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
|
+
# Projects and People using NiiVue
|
|
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
|
+
- [OpenNeuro.org](https://openneuro.org) uses NiiVue to visualize datasets
|
|
39
|
+
- [neurodesk](https://www.neurodesk.org/) uses NiiVue for their [QSMxT Quantitative Susceptibility Mapping toolbox](https://github.com/QSMxT/QSMxT-UI)
|
|
40
|
+
- [Neuroinformatics Research and Development Group](http://neuroinformatics.uw.edu/) embeds NiiVue in [tractoscope](https://github.com/nrdg/tractoscope)
|
|
41
|
+
- [nilearn](https://nilearn.github.io/stable/index.html) is extending [ipyniivue](https://github.com/niivue/ipyniivue)
|
|
42
|
+
- [niivue-vscode](https://github.com/niivue/niivue-vscode) is a VSCode extension for displaying images
|
|
43
|
+
- [QuantCo](https://www.quantco.com/) is using NiiVue in medical imaging workflows
|
|
44
|
+
- [FSL Clinical](https://fslclinical.com/) is using NiiVue in brain imaging reports
|
|
45
|
+
- [brain2print](https://brain2print.org/) (from the NiiVue team) uses NiiVue for showing both volume data and converted meshes
|
|
46
|
+
- [ct2print](https://ct2print.org/) (from the NiiVue team) uses NiiVue for showing volume and mesh data
|
|
47
|
+
- [ipyniivue](https://github.com/niivue/ipyniivue) allows NiiVue to be used in Jupyter Notebooks
|
|
48
|
+
- [T2Lesion](https://niivue.github.io/T2lesion/) (from the NiiVue team) uses NiiVue to show input data and segmented lesion masks
|
|
49
|
+
- [NiiVue Desktop](https://github.com/niivue/desktop) (from the NiiVue team) uses NiiVue in a crossplatform Electron app
|
|
50
|
+
- [NiiVue iOS](https://github.com/niivue/ios) (from the NiiVue team) uses NiiVue in a hybrid Swift + webView mobile app
|
|
51
|
+
- [NiiVue Neglect](https://niivue.github.io/niivue-neglect/) uses NiiVue to visualise stroke lesion data in the spatial neglect severity prediction tool
|
|
52
|
+
- [Plurimedia](https://www.plurimedia.it/) uses NiiVue in client work for medical image visualization
|
|
53
|
+
- [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.
|
|
54
|
+
- [VoxLogicA-UI](https://voxlogica-project.github.io/VoxLogicA-UI/) makes advanced medical
|
|
55
|
+
imaging analysis intuitive
|
|
56
|
+
|
|
57
|
+
# Funding
|
|
58
|
+
|
|
59
|
+
- 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)
|
|
60
|
+
- 2023-2026 [RF1 MH133701](https://reporter.nih.gov/search/D3sOjJtXwkSRKLpYf1ctBg/project-details/10724895) NIH NIMH
|
|
61
|
+
|
|
62
|
+
# Supported Formats
|
|
63
|
+
|
|
64
|
+
NiiVue supports many popular brain imaging formats:
|
|
65
|
+
|
|
66
|
+
- 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).
|
|
67
|
+
- 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/).
|
|
68
|
+
- 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)
|
|
69
|
+
- 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
|
|
70
|
+
- 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
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { mat4, vec3, vec4, vec2 } from 'gl-matrix';
|
|
2
2
|
import { NIFTI1, NIFTI2 } from 'nifti-reader-js';
|
|
3
|
-
import { WebSocketSubject } from 'rxjs/webSocket';
|
|
4
3
|
|
|
5
4
|
type ColorMap = {
|
|
6
5
|
R: number[];
|
|
@@ -398,7 +397,7 @@ declare class NVImage {
|
|
|
398
397
|
readECAT(buffer: ArrayBuffer): ArrayBuffer;
|
|
399
398
|
readV16(buffer: ArrayBuffer): ArrayBuffer;
|
|
400
399
|
imageDataFromArrayBuffer(buffer: ArrayBuffer): Promise<ImageData>;
|
|
401
|
-
readBMP(buffer: ArrayBuffer): Promise<
|
|
400
|
+
readBMP(buffer: ArrayBuffer): Promise<ArrayBuffer>;
|
|
402
401
|
readVMR(buffer: ArrayBuffer): ArrayBuffer;
|
|
403
402
|
readMGH(buffer: ArrayBuffer): Promise<ArrayBuffer>;
|
|
404
403
|
readFIB(buffer: ArrayBuffer): Promise<[ArrayBuffer, Float32Array]>;
|
|
@@ -408,7 +407,7 @@ declare class NVImage {
|
|
|
408
407
|
readMIF(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): Promise<ArrayBuffer>;
|
|
409
408
|
readNRRD(dataBuffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): Promise<ArrayBuffer>;
|
|
410
409
|
calculateRAS(): void;
|
|
411
|
-
hdr2RAS(nVolumes?: number): NIFTI1 | NIFTI2
|
|
410
|
+
hdr2RAS(nVolumes?: number): Promise<NIFTI1 | NIFTI2>;
|
|
412
411
|
img2RAS(nVolume?: number): TypedVoxelArray;
|
|
413
412
|
vox2mm(XYZ: number[], mtx: mat4): vec3;
|
|
414
413
|
mm2vox(mm: number[], frac?: boolean): Float32Array | vec3;
|
|
@@ -438,7 +437,10 @@ declare class NVImage {
|
|
|
438
437
|
name: string;
|
|
439
438
|
data: ArrayBuffer;
|
|
440
439
|
}>>;
|
|
441
|
-
static
|
|
440
|
+
static readFirstDecompressedBytes(stream: ReadableStream<Uint8Array>, minBytes: number): Promise<Uint8Array>;
|
|
441
|
+
static extractFilenameFromUrl(url: string): string | null;
|
|
442
|
+
static loadInitialVolumesGz(url?: string, headers?: {}, limitFrames4D?: number): Promise<ArrayBuffer | null>;
|
|
443
|
+
static loadInitialVolumes(url?: string, headers?: {}, limitFrames4D?: number): Promise<ArrayBuffer | null>;
|
|
442
444
|
/**
|
|
443
445
|
* factory function to load and return a new NVImage instance from a given URL
|
|
444
446
|
* @returns NVImage instance
|
|
@@ -683,7 +685,7 @@ type NVConfigOptions = {
|
|
|
683
685
|
sagittalNoseLeft: boolean;
|
|
684
686
|
isSliceMM: boolean;
|
|
685
687
|
isV1SliceShader: boolean;
|
|
686
|
-
|
|
688
|
+
forceDevicePixelRatio: number;
|
|
687
689
|
logLevel: 'debug' | 'info' | 'warn' | 'error' | 'fatal' | 'silent';
|
|
688
690
|
loadingText: string;
|
|
689
691
|
isForceMouseClickToVoxelCenters: boolean;
|
|
@@ -727,6 +729,8 @@ type NVConfigOptions = {
|
|
|
727
729
|
measureLineColor: number[];
|
|
728
730
|
measureTextHeight: number;
|
|
729
731
|
isAlphaClipDark: boolean;
|
|
732
|
+
gradientOrder: number;
|
|
733
|
+
gradientOpacity: number;
|
|
730
734
|
};
|
|
731
735
|
declare const DEFAULT_OPTIONS: NVConfigOptions;
|
|
732
736
|
type SceneData = {
|
|
@@ -1093,11 +1097,16 @@ type ANNOT = Uint32Array | {
|
|
|
1093
1097
|
scalars: Float32Array;
|
|
1094
1098
|
colormapLabel: LUT;
|
|
1095
1099
|
};
|
|
1096
|
-
type MZ3 =
|
|
1100
|
+
type MZ3 = {
|
|
1097
1101
|
positions: Float32Array | null;
|
|
1098
1102
|
indices: Uint32Array | null;
|
|
1099
1103
|
scalars: Float32Array;
|
|
1100
1104
|
colors: Float32Array | null;
|
|
1105
|
+
} | {
|
|
1106
|
+
scalars: Float32Array;
|
|
1107
|
+
colormapLabel: LUT;
|
|
1108
|
+
} | {
|
|
1109
|
+
scalars: Float32Array;
|
|
1101
1110
|
};
|
|
1102
1111
|
type GII = {
|
|
1103
1112
|
scalars: Float32Array;
|
|
@@ -1303,213 +1312,6 @@ declare class NVMesh {
|
|
|
1303
1312
|
loadFromBase64({ base64, gl, name, opacity, rgba255, visible, layers }?: Partial<LoadFromBase64Params>): Promise<NVMesh>;
|
|
1304
1313
|
}
|
|
1305
1314
|
|
|
1306
|
-
/**
|
|
1307
|
-
* Enum for sync operations
|
|
1308
|
-
*/
|
|
1309
|
-
declare enum NVMESSAGE {
|
|
1310
|
-
ZOOM = 1,// "zoom",
|
|
1311
|
-
CLIP_PLANE = 2,// "clipPlane",
|
|
1312
|
-
AZIMUTH_ELEVATION = 3,// "ae",
|
|
1313
|
-
FRAME_CHANGED = 4,// "frame changed",
|
|
1314
|
-
VOLUME_ADDED_FROM_URL = 5,// "volume added from url",
|
|
1315
|
-
VOLUME_WITH_URL_REMOVED = 6,// "volume with url removed",
|
|
1316
|
-
COLORMAP_CHANGED = 7,// "color map has changed",
|
|
1317
|
-
OPACITY_CHANGED = 8,// "opacity has changed",
|
|
1318
|
-
MESH_FROM_URL_ADDED = 9,// "mesh added from url",
|
|
1319
|
-
MESH_WITH_URL_REMOVED = 10,// "mesh with url removed",
|
|
1320
|
-
CUSTOM_SHADER_ADDED = 11,// "custom shader added",
|
|
1321
|
-
SHADER_CHANGED = 12,// "mesh shader changed",
|
|
1322
|
-
MESH_PROPERTY_CHANGED = 13,// "mesh property changed",
|
|
1323
|
-
USER_JOINED = "user joined",// TODO this breaks the scheme a bit -- see session-bus::localStorageEventListener
|
|
1324
|
-
CREATE = "create",// TODO same as above
|
|
1325
|
-
VOLUME_LOADED_FROM_URL = "volume with url added"
|
|
1326
|
-
}
|
|
1327
|
-
type Message = {
|
|
1328
|
-
userKey?: string;
|
|
1329
|
-
from?: string;
|
|
1330
|
-
} & ({
|
|
1331
|
-
op: NVMESSAGE.ZOOM;
|
|
1332
|
-
zoom: number;
|
|
1333
|
-
} | {
|
|
1334
|
-
op: NVMESSAGE.CLIP_PLANE;
|
|
1335
|
-
clipPlane: number[];
|
|
1336
|
-
} | {
|
|
1337
|
-
op: NVMESSAGE.AZIMUTH_ELEVATION;
|
|
1338
|
-
elevation: number;
|
|
1339
|
-
azimuth: number;
|
|
1340
|
-
} | {
|
|
1341
|
-
op: NVMESSAGE.FRAME_CHANGED;
|
|
1342
|
-
url: string;
|
|
1343
|
-
index: number;
|
|
1344
|
-
} | {
|
|
1345
|
-
op: NVMESSAGE.VOLUME_ADDED_FROM_URL;
|
|
1346
|
-
imageOptions: any;
|
|
1347
|
-
} | {
|
|
1348
|
-
op: NVMESSAGE.VOLUME_LOADED_FROM_URL;
|
|
1349
|
-
url: string;
|
|
1350
|
-
} | {
|
|
1351
|
-
op: NVMESSAGE.VOLUME_WITH_URL_REMOVED;
|
|
1352
|
-
url: string;
|
|
1353
|
-
} | {
|
|
1354
|
-
op: NVMESSAGE.COLORMAP_CHANGED;
|
|
1355
|
-
url: string;
|
|
1356
|
-
colormap: string;
|
|
1357
|
-
} | {
|
|
1358
|
-
op: NVMESSAGE.OPACITY_CHANGED;
|
|
1359
|
-
url: string;
|
|
1360
|
-
opacity: number;
|
|
1361
|
-
} | {
|
|
1362
|
-
op: NVMESSAGE.MESH_FROM_URL_ADDED;
|
|
1363
|
-
meshOptions: LoadFromUrlParams;
|
|
1364
|
-
} | {
|
|
1365
|
-
op: NVMESSAGE.MESH_WITH_URL_REMOVED;
|
|
1366
|
-
url: string;
|
|
1367
|
-
} | {
|
|
1368
|
-
op: NVMESSAGE.CUSTOM_SHADER_ADDED;
|
|
1369
|
-
fragmentShaderText: string;
|
|
1370
|
-
name: string;
|
|
1371
|
-
} | {
|
|
1372
|
-
op: NVMESSAGE.SHADER_CHANGED;
|
|
1373
|
-
meshIndex: number;
|
|
1374
|
-
shaderIndex: number;
|
|
1375
|
-
} | {
|
|
1376
|
-
op: NVMESSAGE.MESH_PROPERTY_CHANGED;
|
|
1377
|
-
meshIndex: number;
|
|
1378
|
-
key: string;
|
|
1379
|
-
val: unknown;
|
|
1380
|
-
} | {
|
|
1381
|
-
op: NVMESSAGE.USER_JOINED;
|
|
1382
|
-
user: SessionUser;
|
|
1383
|
-
} | {
|
|
1384
|
-
op: NVMESSAGE.CREATE;
|
|
1385
|
-
key: string;
|
|
1386
|
-
});
|
|
1387
|
-
|
|
1388
|
-
/**
|
|
1389
|
-
* SessionUser specifies display name, user id and user key
|
|
1390
|
-
* @param userKey - Used to protect user properties
|
|
1391
|
-
*/
|
|
1392
|
-
declare class SessionUser {
|
|
1393
|
-
id: string;
|
|
1394
|
-
displayName: string;
|
|
1395
|
-
key: string;
|
|
1396
|
-
properties: Map<string, string>;
|
|
1397
|
-
constructor(displayName?: string, userId?: string, userKey?: string, userProperties?: Map<string, string>);
|
|
1398
|
-
}
|
|
1399
|
-
/**
|
|
1400
|
-
* SessionBus is for synchronizing both remote and local instances
|
|
1401
|
-
*/
|
|
1402
|
-
declare class SessionBus {
|
|
1403
|
-
userList: SessionUser[];
|
|
1404
|
-
user: SessionUser;
|
|
1405
|
-
userQueueName?: string;
|
|
1406
|
-
userListName?: string;
|
|
1407
|
-
onMessageCallback: (newMessage: Message) => void;
|
|
1408
|
-
isConnectedToServer: boolean;
|
|
1409
|
-
isController: boolean;
|
|
1410
|
-
sessionScene: {};
|
|
1411
|
-
sessionKey: string;
|
|
1412
|
-
sessionName: string;
|
|
1413
|
-
sessionSceneName: string;
|
|
1414
|
-
serverConnection$: WebSocketSubject<Message> | null;
|
|
1415
|
-
constructor(name: string, user: SessionUser, onMessageCallback: (newMessage: Message) => void, serverURL?: string, sessionKey?: string);
|
|
1416
|
-
sendSessionMessage(message: Message): void;
|
|
1417
|
-
connectToServer(serverURL: string, sessionName: string): void;
|
|
1418
|
-
subscribeToServer(): void;
|
|
1419
|
-
sendLocalMessage(message: Message): void;
|
|
1420
|
-
localStorageEventListener(e: StorageEvent): void;
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
/**
|
|
1424
|
-
* NVController is for synchronizing both remote and local instances of Niivue
|
|
1425
|
-
* @ignore
|
|
1426
|
-
*/
|
|
1427
|
-
declare class NVController {
|
|
1428
|
-
niivue: Niivue;
|
|
1429
|
-
mediaUrlMap: Map<string, unknown>;
|
|
1430
|
-
isInSession: boolean;
|
|
1431
|
-
user?: SessionUser;
|
|
1432
|
-
sessionBus?: SessionBus;
|
|
1433
|
-
onFrameChange: (_volume: NVImage, _index: number) => void;
|
|
1434
|
-
/**
|
|
1435
|
-
* @param niivue - niivue object to control
|
|
1436
|
-
*/
|
|
1437
|
-
constructor(niivue: Niivue);
|
|
1438
|
-
onLocationChangeHandler(location: unknown): void;
|
|
1439
|
-
addVolume(volume: NVImage, url: string): void;
|
|
1440
|
-
addMesh(mesh: NVMesh, url: string): void;
|
|
1441
|
-
onNewMessage(msg: Message): void;
|
|
1442
|
-
/**
|
|
1443
|
-
* Connects to existing session or creates new session
|
|
1444
|
-
*/
|
|
1445
|
-
connectToSession(sessionName: string, user?: SessionUser, serverBaseUrl?: string, sessionKey?: string): void;
|
|
1446
|
-
/**
|
|
1447
|
-
* Zoom level has changed
|
|
1448
|
-
*/
|
|
1449
|
-
onZoom3DChangeHandler(zoom: number): void;
|
|
1450
|
-
/**
|
|
1451
|
-
* Azimuth and/or elevation has changed
|
|
1452
|
-
*/
|
|
1453
|
-
onAzimuthElevationChangeHandler(azimuth: number, elevation: number): void;
|
|
1454
|
-
/**
|
|
1455
|
-
* Clip plane has changed
|
|
1456
|
-
*/
|
|
1457
|
-
onClipPlaneChangeHandler(clipPlane: number[]): void;
|
|
1458
|
-
/**
|
|
1459
|
-
* Add an image and notify subscribers
|
|
1460
|
-
*/
|
|
1461
|
-
onVolumeAddedFromUrlHandler(imageOptions: ImageFromUrlOptions, volume: NVImage): void;
|
|
1462
|
-
/**
|
|
1463
|
-
* A volume has been added
|
|
1464
|
-
*/
|
|
1465
|
-
onImageLoadedHandler(volume: NVImage): void;
|
|
1466
|
-
/**
|
|
1467
|
-
* Notifies other users that a volume has been removed
|
|
1468
|
-
*/
|
|
1469
|
-
onVolumeWithUrlRemovedHandler(url: string): void;
|
|
1470
|
-
/**
|
|
1471
|
-
* Notifies that a mesh has been loaded by URL
|
|
1472
|
-
*/
|
|
1473
|
-
onMeshAddedFromUrlHandler(meshOptions: LoadFromUrlParams): void;
|
|
1474
|
-
/**
|
|
1475
|
-
* Notifies that a mesh has been added
|
|
1476
|
-
*/
|
|
1477
|
-
onMeshLoadedHandler(mesh: NVMesh): void;
|
|
1478
|
-
onMeshWithUrlRemovedHandler(url: string): void;
|
|
1479
|
-
/**
|
|
1480
|
-
*
|
|
1481
|
-
* @param volume - volume that has changed color maps
|
|
1482
|
-
*/
|
|
1483
|
-
onColormapChangeHandler(volume: NVImage): void;
|
|
1484
|
-
/**
|
|
1485
|
-
* @param volume - volume that has changed opacity
|
|
1486
|
-
*/
|
|
1487
|
-
onOpacityChangeHandler(volume: NVImage): void;
|
|
1488
|
-
/**
|
|
1489
|
-
* Frame for 4D image has changed
|
|
1490
|
-
*/
|
|
1491
|
-
onFrameChangeHandler(volume: NVImage, index: number): void;
|
|
1492
|
-
/**
|
|
1493
|
-
* Custom mesh shader has been added
|
|
1494
|
-
* @param fragmentShaderText - shader code to be compiled
|
|
1495
|
-
* @param name - name of shader, can be used as index
|
|
1496
|
-
*/
|
|
1497
|
-
onCustomMeshShaderAddedHandler(fragmentShaderText: string, name: string): void;
|
|
1498
|
-
/**
|
|
1499
|
-
* Mesh shader has changed
|
|
1500
|
-
* @param meshIndex - index of mesh
|
|
1501
|
-
* @param shaderIndex - index of shader
|
|
1502
|
-
*/
|
|
1503
|
-
onMeshShaderChanged(meshIndex: number, shaderIndex: number): void;
|
|
1504
|
-
/**
|
|
1505
|
-
* Mesh property has been changed
|
|
1506
|
-
* @param meshIndex - index of mesh
|
|
1507
|
-
* @param key - property index
|
|
1508
|
-
* @param val - property value
|
|
1509
|
-
*/
|
|
1510
|
-
onMeshPropertyChanged(meshIndex: number, key: string, val: unknown): void;
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
1315
|
type TypedNumberArray = Float64Array | Float32Array | Uint32Array | Uint16Array | Uint8Array | Int32Array | Int16Array | Int8Array;
|
|
1514
1316
|
declare class NVUtilities {
|
|
1515
1317
|
static arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
|
|
@@ -1752,6 +1554,7 @@ declare class Niivue {
|
|
|
1752
1554
|
volumeTexture: WebGLTexture | null;
|
|
1753
1555
|
gradientTexture: WebGLTexture | null;
|
|
1754
1556
|
gradientTextureAmount: number;
|
|
1557
|
+
renderGradientValues: boolean;
|
|
1755
1558
|
drawTexture: WebGLTexture | null;
|
|
1756
1559
|
drawUndoBitmaps: Uint8Array[];
|
|
1757
1560
|
drawLut: LUT;
|
|
@@ -1778,6 +1581,7 @@ declare class Niivue {
|
|
|
1778
1581
|
line3DShader?: Shader;
|
|
1779
1582
|
passThroughShader?: Shader;
|
|
1780
1583
|
renderGradientShader?: Shader;
|
|
1584
|
+
renderGradientValuesShader?: Shader;
|
|
1781
1585
|
renderSliceShader?: Shader;
|
|
1782
1586
|
renderVolumeShader?: Shader;
|
|
1783
1587
|
pickingMeshShader?: Shader;
|
|
@@ -1801,7 +1605,9 @@ declare class Niivue {
|
|
|
1801
1605
|
orientShaderRGBU: Shader | null;
|
|
1802
1606
|
surfaceShader: Shader | null;
|
|
1803
1607
|
blurShader: Shader | null;
|
|
1804
|
-
|
|
1608
|
+
sobelBlurShader: Shader | null;
|
|
1609
|
+
sobelFirstOrderShader: Shader | null;
|
|
1610
|
+
sobelSecondOrderShader: Shader | null;
|
|
1805
1611
|
genericVAO: WebGLVertexArrayObject | null;
|
|
1806
1612
|
unusedVAO: any;
|
|
1807
1613
|
crosshairs3D: NiivueObject3D | null;
|
|
@@ -2048,7 +1854,6 @@ declare class Niivue {
|
|
|
2048
1854
|
mediaUrlMap: Map<NVImage | NVMesh, string>;
|
|
2049
1855
|
initialized: boolean;
|
|
2050
1856
|
currentDrawUndoBitmap: number;
|
|
2051
|
-
loadingText: string;
|
|
2052
1857
|
/**
|
|
2053
1858
|
* @param options - options object to set modifiable Niivue properties
|
|
2054
1859
|
*/
|
|
@@ -2311,11 +2116,11 @@ declare class Niivue {
|
|
|
2311
2116
|
getRadiologicalConvention(): boolean;
|
|
2312
2117
|
/**
|
|
2313
2118
|
* Force WebGL canvas to use high resolution display, regardless of browser defaults.
|
|
2314
|
-
* @param
|
|
2119
|
+
* @param forceDevicePixelRatio - -1: block high DPI; 0= allow high DPI: >0 use specified pixel ratio
|
|
2315
2120
|
* @example niivue.setHighResolutionCapable(true);
|
|
2316
2121
|
* @see {@link https://niivue.github.io/niivue/features/sync.mesh.html | live demo usage}
|
|
2317
2122
|
*/
|
|
2318
|
-
setHighResolutionCapable(
|
|
2123
|
+
setHighResolutionCapable(forceDevicePixelRatio: number | boolean): void;
|
|
2319
2124
|
/**
|
|
2320
2125
|
* add a new volume to the canvas
|
|
2321
2126
|
* @param volume - the new volume to add to the canvas
|
|
@@ -2484,7 +2289,7 @@ declare class Niivue {
|
|
|
2484
2289
|
* @example
|
|
2485
2290
|
* niivue = new Niivue()
|
|
2486
2291
|
* niivue.removeMesh(this.meshes[3])
|
|
2487
|
-
* @see {@link https://niivue.github.io/niivue/features/
|
|
2292
|
+
* @see {@link https://niivue.github.io/niivue/features/connectome.html | live demo usage}
|
|
2488
2293
|
*/
|
|
2489
2294
|
removeMesh(mesh: NVMesh): void;
|
|
2490
2295
|
/**
|
|
@@ -2648,12 +2453,21 @@ declare class Niivue {
|
|
|
2648
2453
|
setClipVolume(low: number[], high: number[]): void;
|
|
2649
2454
|
/**
|
|
2650
2455
|
* set proportion of volume rendering influenced by selected matcap.
|
|
2651
|
-
* @param gradientAmount - amount of matcap (0..1), default 0 (matte, surface normal does not influence color)
|
|
2456
|
+
* @param gradientAmount - amount of matcap (NaN or 0..1), default 0 (matte, surface normal does not influence color). NaN renders the gradients.
|
|
2652
2457
|
* @example
|
|
2653
2458
|
* niivue.setVolumeRenderIllumination(0.6);
|
|
2654
2459
|
* @see {@link https://niivue.github.io/niivue/features/shiny.volumes.html | live demo usage}
|
|
2460
|
+
* @see {@link https://niivue.github.io/niivue/features/gradient.order.html | live demo usage}
|
|
2655
2461
|
*/
|
|
2656
2462
|
setVolumeRenderIllumination(gradientAmount?: number): Promise<void>;
|
|
2463
|
+
/**
|
|
2464
|
+
* set volume rendering opacity influence of the gradient magnitude
|
|
2465
|
+
* @param gradientOpacity - amount of gradient magnitude influence on opacity (0..1), default 0 (no-influence)
|
|
2466
|
+
* @example
|
|
2467
|
+
* niivue.setGradientOpacity(0.6);
|
|
2468
|
+
* @see {@link https://niivue.github.io/niivue/features/gradient.opacity.html | live demo usage}
|
|
2469
|
+
*/
|
|
2470
|
+
setGradientOpacity(gradientOpacity?: number): Promise<void>;
|
|
2657
2471
|
overlayRGBA(volume: NVImage): Uint8ClampedArray;
|
|
2658
2472
|
vox2mm(XYZ: number[], mtx: mat4): vec3;
|
|
2659
2473
|
/**
|
|
@@ -2731,12 +2545,10 @@ declare class Niivue {
|
|
|
2731
2545
|
loadVolumes(volumeList: ImageFromUrlOptions[]): Promise<this>;
|
|
2732
2546
|
/**
|
|
2733
2547
|
* Add mesh and notify subscribers
|
|
2734
|
-
* @see {@link https://niivue.github.io/niivue/features/multiuser.meshes.html | live demo usage}
|
|
2735
2548
|
*/
|
|
2736
2549
|
addMeshFromUrl(meshOptions: LoadFromUrlParams): Promise<NVMesh>;
|
|
2737
2550
|
/**
|
|
2738
2551
|
* Add mesh and notify subscribers
|
|
2739
|
-
* @see {@link https://niivue.github.io/niivue/features/multiuser.meshes.html | live demo usage}
|
|
2740
2552
|
*/
|
|
2741
2553
|
addMeshesFromUrl(meshOptions: LoadFromUrlParams[]): Promise<NVMesh[]>;
|
|
2742
2554
|
/**
|
|
@@ -2824,6 +2636,7 @@ declare class Niivue {
|
|
|
2824
2636
|
refreshDrawing(isForceRedraw?: boolean, useClickToSegmentBitmap?: boolean): void;
|
|
2825
2637
|
r8Tex(texID: WebGLTexture | null, activeID: number, dims: number[], isInit?: boolean): WebGLTexture | null;
|
|
2826
2638
|
rgbaTex(texID: WebGLTexture | null, activeID: number, dims: number[], isInit?: boolean): WebGLTexture | null;
|
|
2639
|
+
rgba16Tex(texID: WebGLTexture | null, activeID: number, dims: number[], isInit?: boolean): WebGLTexture | null;
|
|
2827
2640
|
requestCORSIfNotSameOrigin(img: HTMLImageElement, url: string): void;
|
|
2828
2641
|
loadPngAsTexture(pngUrl: string, textureNum: number): Promise<WebGLTexture | null>;
|
|
2829
2642
|
loadFontTexture(fontUrl: string): Promise<WebGLTexture | null>;
|
|
@@ -3196,4 +3009,4 @@ declare class Niivue {
|
|
|
3196
3009
|
set gl(gl: WebGL2RenderingContext | null);
|
|
3197
3010
|
}
|
|
3198
3011
|
|
|
3199
|
-
export { COLORMAP_TYPE, type Connectome, type ConnectomeOptions, DEFAULT_OPTIONS, DRAG_MODE, DRAG_MODE_PRIMARY, DRAG_MODE_SECONDARY, type DicomLoader, type DicomLoaderInput, type DocumentData, type DragReleaseParams, type ExportDocumentData, INITIAL_SCENE_DATA, LabelAnchorPoint, LabelLineTerminator, LabelTextAlignment, type LegacyConnectome, type LegacyNodes, MULTIPLANAR_TYPE, type NVConfigOptions, type NVConnectomeEdge, type NVConnectomeNode,
|
|
3012
|
+
export { COLORMAP_TYPE, type Connectome, type ConnectomeOptions, DEFAULT_OPTIONS, DRAG_MODE, DRAG_MODE_PRIMARY, DRAG_MODE_SECONDARY, type DicomLoader, type DicomLoaderInput, type DocumentData, type DragReleaseParams, type ExportDocumentData, INITIAL_SCENE_DATA, LabelAnchorPoint, LabelLineTerminator, LabelTextAlignment, type LegacyConnectome, type LegacyNodes, MULTIPLANAR_TYPE, type NVConfigOptions, type NVConnectomeEdge, type NVConnectomeNode, NVDocument, NVImage, NVImageFromUrlOptions, NVLabel3D, NVLabel3DStyle, NVMesh, NVMeshFromUrlOptions, NVMeshLayerDefaults, NVMeshLoaders, NVMeshUtilities, NVUtilities, type NiftiHeader, type NiiVueLocation, type NiiVueLocationValue, Niivue, type Point, SHOW_RENDER, SLICE_TYPE, type Scene, type SyncOpts, type Volume, cmapper, ColorTables as colortables };
|