@niivue/niivue 0.38.7 → 0.38.8

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.
@@ -0,0 +1,4445 @@
1
+ import { Subject, Subscription } from 'rxjs';
2
+ import { mat4, vec3, vec4, vec2 } from 'gl-matrix';
3
+ import * as nifti from 'nifti-reader-js';
4
+ import { WebSocketSubject } from 'rxjs/webSocket';
5
+
6
+ type ColorMap = {
7
+ R: number[];
8
+ G: number[];
9
+ B: number[];
10
+ A: number[];
11
+ I: number[];
12
+ min?: number;
13
+ max?: number;
14
+ labels?: string[];
15
+ };
16
+ type LUT = {
17
+ lut: Uint8ClampedArray;
18
+ min?: number;
19
+ max?: number;
20
+ labels?: string[];
21
+ };
22
+ declare class ColorTables {
23
+ gamma: number;
24
+ version: number;
25
+ cluts: Record<string, ColorMap>;
26
+ /**
27
+ * Sets cluts to alphabetically sorted cmaps
28
+ */
29
+ constructor();
30
+ addColormap(key: string, cmap: ColorMap): void;
31
+ colormaps(): Array<keyof typeof this.cluts>;
32
+ colorMaps(): Array<keyof typeof this.cluts>;
33
+ colormapFromKey(name: string): ColorMap;
34
+ colormap(key?: string, isInvert?: boolean): Uint8ClampedArray;
35
+ makeLabelLut(cm: ColorMap, alphaFill?: number): LUT;
36
+ makeLabelLutFromUrl(name: string): Promise<LUT>;
37
+ makeDrawLut(name: string | ColorMap): LUT;
38
+ makeLut(Rsi: number[], Gsi: number[], Bsi: number[], Asi: number[], Isi: number[], isInvert: boolean): Uint8ClampedArray;
39
+ }
40
+ declare const cmapper: ColorTables;
41
+
42
+ declare class Shader {
43
+ program: WebGLProgram;
44
+ uniforms: Record<string, WebGLUniformLocation | null>;
45
+ isMatcap?: boolean;
46
+ constructor(gl: WebGL2RenderingContext, vertexSrc: string, fragmentSrc: string);
47
+ use(gl: WebGL2RenderingContext): void;
48
+ }
49
+
50
+ type Geometry = {
51
+ vertexBuffer: WebGLBuffer;
52
+ indexBuffer: WebGLBuffer;
53
+ indexCount: number;
54
+ vao: WebGLVertexArrayObject | null;
55
+ };
56
+ /**
57
+ * Object rendered with WebGL
58
+ **/
59
+ declare class NiivueObject3D {
60
+ static BLEND: number;
61
+ static CULL_FACE: number;
62
+ static CULL_FRONT: number;
63
+ static CULL_BACK: number;
64
+ static ENABLE_DEPTH_TEST: number;
65
+ sphereIdx: number[];
66
+ sphereVtx: number[];
67
+ renderShaders: number[];
68
+ isVisible: boolean;
69
+ isPickable: boolean;
70
+ vertexBuffer: WebGLVertexArrayObject;
71
+ indexCount: number;
72
+ indexBuffer: WebGLVertexArrayObject | null;
73
+ vao: WebGLVertexArrayObject | null;
74
+ mode: number;
75
+ glFlags: number;
76
+ id: number;
77
+ colorId: [number, number, number, number];
78
+ modelMatrix: mat4;
79
+ scale: number[];
80
+ position: number[];
81
+ rotation: number[];
82
+ rotationRadians: number;
83
+ extentsMin: number[];
84
+ extentsMax: number[];
85
+ furthestVertexFromOrigin?: number;
86
+ originNegate?: vec3;
87
+ fieldOfViewDeObliqueMM?: vec3;
88
+ mm?: vec4;
89
+ constructor(id: number, vertexBuffer: WebGLBuffer, mode: number, indexCount: number, indexBuffer?: WebGLVertexArrayObject | null, vao?: WebGLVertexArrayObject | null);
90
+ static generateCrosshairs: (gl: WebGL2RenderingContext, id: number, xyzMM: vec4, xyzMin: vec3, xyzMax: vec3, radius: number, sides?: number) => NiivueObject3D;
91
+ static generateCrosshairsGeometry: (gl: WebGL2RenderingContext, xyzMM: vec4, xyzMin: vec3, xyzMax: vec3, radius: number, sides?: number) => Geometry;
92
+ static getFirstPerpVector: (v1: vec3) => vec3;
93
+ static subdivide: (verts: number[], faces: number[]) => void;
94
+ static weldVertices: (verts: number[], faces: number[]) => number[];
95
+ static makeSphere: (vertices: number[], indices: number[], radius: number, origin?: vec3 | vec4) => void;
96
+ static makeCylinder: (vertices: number[], indices: number[], start: vec3, dest: vec3, radius: number, sides?: number, endcaps?: boolean) => void;
97
+ static makeColoredCylinder: (vertices: number[], indices: number[], colors: number[], start: vec3, dest: vec3, radius: number, rgba255?: number[], sides?: number, endcaps?: boolean) => void;
98
+ static makeColoredSphere: (vertices: number[], indices: number[], colors: number[], radius: number, origin?: vec3 | vec4, rgba255?: number[]) => void;
99
+ }
100
+
101
+ declare enum LabelTextAlignment {
102
+ LEFT = "left",
103
+ RIGHT = "right",
104
+ CENTER = "center"
105
+ }
106
+ declare enum LabelLineTerminator {
107
+ NONE = "none",
108
+ CIRCLE = "circle",
109
+ RING = "ring"
110
+ }
111
+ /**
112
+ * Class representing label style.
113
+ */
114
+ declare class NVLabel3DStyle {
115
+ textColor: number[];
116
+ textScale: number;
117
+ textAlignment?: LabelTextAlignment;
118
+ lineWidth: number;
119
+ lineColor: number[];
120
+ lineTerminator: LabelLineTerminator;
121
+ bulletScale?: number;
122
+ bulletColor?: number[];
123
+ backgroundColor?: number[];
124
+ /**
125
+ * @param textColor - Color of text
126
+ * @param textScale - Text Size (0.0..1.0)
127
+ * @param lineWidth - Line width
128
+ * @param lineColor - Line color
129
+ * @param bulletScale - Bullet size respective of text
130
+ * @param bulletColor - Bullet color
131
+ * @param backgroundColor - Background color of label
132
+ */
133
+ constructor(textColor?: number[], textScale?: number, textAlignment?: LabelTextAlignment, lineWidth?: number, lineColor?: number[], lineTerminator?: LabelLineTerminator, bulletScale?: number, bulletColor?: number[], backgroundColor?: number[]);
134
+ }
135
+ /**
136
+ * Label class
137
+ */
138
+ declare class NVLabel3D {
139
+ text: string;
140
+ style: NVLabel3DStyle;
141
+ points?: number[] | number[][];
142
+ /**
143
+ * @param text - The text of the label
144
+ * @param style - The style of the label
145
+ * @param points - An array of points label for label lines
146
+ */
147
+ constructor(text: string, style: NVLabel3DStyle, points?: number[] | number[][]);
148
+ }
149
+
150
+ type NiftiHeader = {
151
+ littleEndian: boolean;
152
+ dim_info: number;
153
+ dims: number[];
154
+ pixDims: number[];
155
+ intent_p1: number;
156
+ intent_p2: number;
157
+ intent_p3: number;
158
+ intent_code: number;
159
+ datatypeCode: number;
160
+ numBitsPerVoxel: number;
161
+ slice_start: number;
162
+ vox_offset: number;
163
+ scl_slope: number;
164
+ scl_inter: number;
165
+ slice_end: number;
166
+ slice_code: number;
167
+ xyzt_units: number;
168
+ cal_max: number;
169
+ cal_min: number;
170
+ slice_duration: number;
171
+ toffset: number;
172
+ description: string;
173
+ aux_file: string;
174
+ qform_code: number;
175
+ sform_code: number;
176
+ quatern_b: number;
177
+ quatern_c: number;
178
+ quatern_d: number;
179
+ qoffset_x: number;
180
+ qoffset_y: number;
181
+ qoffset_z: number;
182
+ affine: number[][];
183
+ intent_name: string;
184
+ magic: string;
185
+ };
186
+ type Point = {
187
+ comments: Array<{
188
+ text: string;
189
+ prefilled?: string;
190
+ }>;
191
+ coordinates: {
192
+ x: number;
193
+ y: number;
194
+ z: number;
195
+ };
196
+ };
197
+ /**
198
+ * Representes the vertices of a connectome
199
+ */
200
+ type NVConnectomeNode = {
201
+ name: string;
202
+ x: number;
203
+ y: number;
204
+ z: number;
205
+ colorValue: number;
206
+ sizeValue: number;
207
+ label?: NVLabel3D;
208
+ };
209
+ /**
210
+ * Represents edges between connectome nodes
211
+ */
212
+ type NVConnectomeEdge = {
213
+ first: number;
214
+ second: number;
215
+ colorValue: number;
216
+ };
217
+ type ConnectomeOptions = {
218
+ name: string;
219
+ nodeColormap: string;
220
+ nodeColormapNegative: string;
221
+ nodeMinColor: number;
222
+ nodeMaxColor: number;
223
+ nodeScale: number;
224
+ edgeColormap: string;
225
+ edgeColormapNegative: string;
226
+ edgeMin: number;
227
+ edgeMax: number;
228
+ edgeScale: number;
229
+ };
230
+ type Connectome = ConnectomeOptions & {
231
+ nodes: NVConnectomeNode[];
232
+ edges: NVConnectomeEdge[];
233
+ };
234
+ type LegacyNodes = {
235
+ names: string[];
236
+ prefilled: unknown[];
237
+ X: number[];
238
+ Y: number[];
239
+ Z: number[];
240
+ Color: number[];
241
+ Size: number[];
242
+ };
243
+ type LegacyConnectome = Partial<ConnectomeOptions> & {
244
+ nodes: LegacyNodes;
245
+ edges: number[];
246
+ };
247
+
248
+ type ValuesArray = Array<{
249
+ id: string;
250
+ vals: number[];
251
+ }>;
252
+ type AnyNumberArray = number[] | Float64Array | Float32Array | Uint32Array | Uint16Array | Uint8Array | Int32Array | Int16Array | Int8Array;
253
+ type DefaultMeshType = {
254
+ positions: Float32Array;
255
+ indices: Int32Array;
256
+ colors?: Float32Array;
257
+ };
258
+ type TRACT = {
259
+ pts: number[];
260
+ offsetPt0: number[];
261
+ dps: ValuesArray;
262
+ };
263
+ type TRX = {
264
+ pts: number[];
265
+ offsetPt0: number[];
266
+ dpg: ValuesArray;
267
+ dps: ValuesArray;
268
+ dpv: ValuesArray;
269
+ header: unknown;
270
+ };
271
+ type TRK = {
272
+ pts: number[];
273
+ offsetPt0: number[];
274
+ dps: ValuesArray;
275
+ dpv: ValuesArray;
276
+ };
277
+ type TCK = {
278
+ pts: number[];
279
+ offsetPt0: number[];
280
+ };
281
+ type VTK = DefaultMeshType | {
282
+ pts: Float32Array;
283
+ offsetPt0: Uint32Array;
284
+ };
285
+ type ANNOT = Uint32Array | {
286
+ scalars: Float32Array;
287
+ colormapLabel: LUT;
288
+ };
289
+ type MZ3 = Float32Array | {
290
+ positions: Float32Array | null;
291
+ indices: Int32Array | null;
292
+ scalars: Float32Array;
293
+ colors: Float32Array | null;
294
+ };
295
+ type GII = {
296
+ scalars: Float32Array;
297
+ positions?: Float32Array;
298
+ indices?: Int32Array;
299
+ colormapLabel?: LUT;
300
+ anatomicalStructurePrimary: string;
301
+ };
302
+ type MGH = AnyNumberArray | {
303
+ scalars: AnyNumberArray;
304
+ colormapLabel: LUT;
305
+ };
306
+ type X3D = {
307
+ positions: number[];
308
+ indices: Int32Array;
309
+ rgba255: number[];
310
+ };
311
+
312
+ /** Enum for text alignment
313
+ */
314
+ declare enum MeshType {
315
+ MESH = "mesh",
316
+ CONNECTOME = "connectome",
317
+ FIBER = "fiber"
318
+ }
319
+ type NVMeshLayer = {
320
+ name?: string;
321
+ key?: string;
322
+ url?: string;
323
+ headers?: Record<string, string>;
324
+ opacity: number;
325
+ colormap: string;
326
+ colormapNegative: string;
327
+ colormapInvert: boolean;
328
+ colormapLabel?: ColorMap | LUT;
329
+ useNegativeCmap: boolean;
330
+ global_min: number;
331
+ global_max: number;
332
+ cal_min: number;
333
+ cal_max: number;
334
+ cal_minNeg: number;
335
+ cal_maxNeg: number;
336
+ isAdditiveBlend: boolean;
337
+ frame4D: number;
338
+ nFrame4D: number;
339
+ values: number[];
340
+ isOutlineBorder: boolean;
341
+ isTransparentBelowCalMin?: boolean;
342
+ alphaThreshold: boolean;
343
+ base64?: string;
344
+ colorbarVisible?: boolean;
345
+ };
346
+ declare class NVMeshFromUrlOptions {
347
+ url: string;
348
+ gl: WebGL2RenderingContext | null;
349
+ name: string;
350
+ opacity: number;
351
+ rgba255: number[];
352
+ visible: boolean;
353
+ layers: NVMeshLayer[];
354
+ colorbarVisible: boolean;
355
+ constructor(url?: string, gl?: null, name?: string, opacity?: number, rgba255?: number[], visible?: boolean, layers?: never[], colorbarVisible?: boolean);
356
+ }
357
+ type BaseLoadParams = {
358
+ gl: WebGL2RenderingContext;
359
+ name: string;
360
+ opacity: number;
361
+ rgba255: number[];
362
+ visible: boolean;
363
+ layers: NVMeshLayer[];
364
+ };
365
+ type LoadFromUrlParams = Partial<BaseLoadParams> & {
366
+ url: string;
367
+ headers?: Record<string, string>;
368
+ };
369
+ type LoadFromFileParams = BaseLoadParams & {
370
+ file: Blob;
371
+ };
372
+ type LoadFromBase64Params = BaseLoadParams & {
373
+ base64: string;
374
+ };
375
+ /**
376
+ * a NVMesh encapsulates some mesh data and provides methods to query and operate on meshes
377
+ */
378
+ declare class NVMesh {
379
+ id: string;
380
+ name: string;
381
+ anatomicalStructurePrimary: string;
382
+ colorbarVisible: boolean;
383
+ furthestVertexFromOrigin: number;
384
+ extentsMin: number | number[];
385
+ extentsMax: number | number[];
386
+ opacity: number;
387
+ visible: boolean;
388
+ meshShaderIndex: number;
389
+ offsetPt0: number[] | null;
390
+ colormapInvert: boolean;
391
+ fiberGroupColormap: ColorMap | null;
392
+ indexBuffer: WebGLBuffer;
393
+ vertexBuffer: WebGLBuffer;
394
+ vao: WebGLVertexArrayObject;
395
+ pts: number[];
396
+ tris?: number[];
397
+ layers: NVMeshLayer[];
398
+ type: MeshType;
399
+ data_type?: string;
400
+ rgba255: number[];
401
+ fiberLength?: number;
402
+ fiberLengths?: number[];
403
+ fiberDither: number;
404
+ fiberColor: string;
405
+ fiberDecimationStride: number;
406
+ fiberMask?: unknown[];
407
+ colormap?: ColorMap | LegacyConnectome | string | null;
408
+ dpg?: ValuesArray | null;
409
+ dps?: ValuesArray | null;
410
+ dpv?: ValuesArray | null;
411
+ hasConnectome: boolean;
412
+ connectome?: LegacyConnectome | string;
413
+ indexCount?: number;
414
+ vertexCount: number;
415
+ nodeScale: number;
416
+ edgeScale: number;
417
+ nodeColormap: string;
418
+ edgeColormap: string;
419
+ nodeColormapNegative?: string;
420
+ edgeColormapNegative?: string;
421
+ nodeMinColor?: number;
422
+ nodeMaxColor?: number;
423
+ edgeMin?: number;
424
+ edgeMax?: number;
425
+ nodes?: LegacyNodes | NVConnectomeNode[];
426
+ edges?: number[] | NVConnectomeEdge[];
427
+ points?: Point[];
428
+ /**
429
+ * @param pts - a 3xN array of vertex positions (X,Y,Z coordinates).
430
+ * @param tris - a 3xN array of triangle indices (I,J,K; indexed from zero). Each triangle generated from three vertices.
431
+ * @param name - a name for this image. Default is an empty string
432
+ * @param rgba255 - the base color of the mesh. RGBA values from 0 to 255. Default is white
433
+ * @param opacity - the opacity for this mesh. default is 1
434
+ * @param visible - whether or not this image is to be visible
435
+ * @param gl - WebGL rendering context
436
+ * @param connectome - specify connectome edges and nodes. Default is null (not a connectome).
437
+ * @param dpg - Data per group for tractography, see TRK format. Default is null (not tractograpgy)
438
+ * @param dps - Data per streamline for tractography, see TRK format. Default is null (not tractograpgy)
439
+ * @param dpv - Data per vertex for tractography, see TRK format. Default is null (not tractograpgy)
440
+ * @param colorbarVisible - does this mesh display a colorbar
441
+ * @param anatomicalStructurePrimary - region for mesh. Default is an empty string
442
+ */
443
+ constructor(pts: number[], tris: number[], name: string | undefined, rgba255: number[] | 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);
444
+ updateFibers(gl: WebGL2RenderingContext): void;
445
+ updateConnectome(gl: WebGL2RenderingContext): void;
446
+ updateMesh(gl: WebGL2RenderingContext): void;
447
+ reverseFaces(gl: WebGL2RenderingContext): void;
448
+ setLayerProperty(id: number, key: keyof NVMeshLayer, val: number | string | boolean, gl: WebGL2RenderingContext): void;
449
+ setProperty(key: keyof this, val: unknown, gl: WebGL2RenderingContext): void;
450
+ generatePosNormClr(pts: number[], tris: number[], rgba255: number[]): Float32Array;
451
+ static loadConnectomeFromFreeSurfer(json: {
452
+ points?: Point[];
453
+ data_type: string;
454
+ }, gl: WebGL2RenderingContext, name?: string, opacity?: number, visible?: boolean): NVMesh;
455
+ static loadConnectomeFromJSON(json: Record<string, unknown>, gl: WebGL2RenderingContext, name?: string, opacity?: number, visible?: boolean): NVMesh;
456
+ static readMesh(buffer: ArrayBuffer, name: string, gl: WebGL2RenderingContext, opacity?: number, rgba255?: number[], visible?: boolean): NVMesh;
457
+ static loadLayer(layer: NVMeshLayer, nvmesh: NVMesh): Promise<void>;
458
+ /**
459
+ * factory function to load and return a new NVMesh instance from a given URL
460
+ */
461
+ static loadFromUrl({ url, headers, gl, name, opacity, rgba255, visible, layers }?: Partial<LoadFromUrlParams>): Promise<NVMesh>;
462
+ static readFileAsync(file: Blob): Promise<ArrayBuffer>;
463
+ /**
464
+ * factory function to load and return a new NVMesh instance from a file in the browser
465
+ *
466
+ * @returns NVMesh instance
467
+ */
468
+ static loadFromFile({ file, gl, name, opacity, rgba255, visible, layers }?: Partial<LoadFromFileParams>): Promise<NVMesh>;
469
+ /**
470
+ * load and return a new NVMesh instance from a base64 encoded string
471
+ */
472
+ loadFromBase64({ base64, gl, name, opacity, rgba255, visible, layers }?: Partial<LoadFromBase64Params>): Promise<NVMesh>;
473
+ static readGII(buffer: ArrayBuffer): GII;
474
+ static readX3D(buffer: ArrayBuffer): X3D;
475
+ static readNII(buffer: ArrayBuffer, n_vert?: number): Uint8Array | Float32Array | Int32Array | Int16Array;
476
+ static readNII2(buffer: ArrayBuffer, n_vert?: number): Uint8Array | Float32Array | Int32Array | Int16Array;
477
+ static readMGH(buffer: ArrayBuffer): MGH;
478
+ static readSTL(buffer: ArrayBuffer): DefaultMeshType;
479
+ static readTxtSTL(buffer: ArrayBuffer): DefaultMeshType;
480
+ static readSRF(buffer: ArrayBuffer): DefaultMeshType;
481
+ static readFreeSurfer(buffer: ArrayBuffer): DefaultMeshType;
482
+ static readOBJ(buffer: ArrayBuffer): DefaultMeshType;
483
+ static readOFF(buffer: ArrayBuffer): DefaultMeshType;
484
+ static readGEO(buffer: ArrayBuffer, isFlipWinding?: boolean): DefaultMeshType;
485
+ static readICO(buffer: ArrayBuffer): DefaultMeshType;
486
+ static readPLY(buffer: ArrayBuffer): DefaultMeshType;
487
+ static readMZ3(buffer: ArrayBuffer, n_vert?: number): MZ3;
488
+ static readVTK(buffer: ArrayBuffer): VTK;
489
+ static readASC(buffer: ArrayBuffer): DefaultMeshType;
490
+ static readNV(buffer: ArrayBuffer): DefaultMeshType;
491
+ static readANNOT(buffer: ArrayBuffer, n_vert: number, isReadColortables?: boolean): ANNOT;
492
+ static readCURV(buffer: ArrayBuffer, n_vert: number): Float32Array;
493
+ static readSTC(buffer: ArrayBuffer, n_vert: number): Float32Array;
494
+ static readSMP(buffer: ArrayBuffer, n_vert: number): Float32Array;
495
+ static readTxtVTK(buffer: ArrayBuffer): VTK;
496
+ static readTRK(buffer: ArrayBuffer): TRK;
497
+ static readTCK(buffer: ArrayBuffer): TCK;
498
+ static readTRX(buffer: ArrayBuffer): TRX;
499
+ static readTRACT(buffer: ArrayBuffer): TRACT;
500
+ }
501
+
502
+ var atlas = {
503
+ type: "msdf",
504
+ distanceRange: 2,
505
+ size: 59.65625,
506
+ width: 512,
507
+ height: 256,
508
+ yOrigin: "bottom"
509
+ };
510
+ var metrics = {
511
+ emSize: 1,
512
+ lineHeight: 1.171875,
513
+ ascender: 0.927734375,
514
+ descender: -0.244140625,
515
+ underlineY: -0.09765625,
516
+ underlineThickness: 0.048828125
517
+ };
518
+ var glyphs = [
519
+ {
520
+ unicode: 32,
521
+ advance: 0.24755859375
522
+ },
523
+ {
524
+ unicode: 33,
525
+ advance: 0.25732421875,
526
+ planeBounds: {
527
+ left: 0.056159633438645884,
528
+ bottom: -0.02437761405677056,
529
+ right: 0.20702396031135412,
530
+ top: 0.7299440203067705
531
+ },
532
+ atlasBounds: {
533
+ left: 488.5,
534
+ bottom: 145.5,
535
+ right: 497.5,
536
+ top: 190.5
537
+ }
538
+ },
539
+ {
540
+ unicode: 34,
541
+ advance: 0.31982421875,
542
+ planeBounds: {
543
+ left: 0.049409125974004715,
544
+ bottom: 0.48691155587022,
545
+ right: 0.2840869677759953,
546
+ top: 0.77187750662978
547
+ },
548
+ atlasBounds: {
549
+ left: 486.5,
550
+ bottom: 213.5,
551
+ right: 500.5,
552
+ top: 230.5
553
+ }
554
+ },
555
+ {
556
+ unicode: 35,
557
+ advance: 0.61572265625,
558
+ planeBounds: {
559
+ left: 0.037219103997511785,
560
+ bottom: -0.02169206718177056,
561
+ right: 0.6239137085024882,
562
+ top: 0.7326295671817705
563
+ },
564
+ atlasBounds: {
565
+ left: 66.5,
566
+ bottom: 51.5,
567
+ right: 101.5,
568
+ top: 96.5
569
+ }
570
+ },
571
+ {
572
+ unicode: 36,
573
+ advance: 0.5615234375,
574
+ planeBounds: {
575
+ left: 0.02956531458715296,
576
+ bottom: -0.12381369908983761,
577
+ right: 0.5324464041628472,
578
+ top: 0.8484230740898377
579
+ },
580
+ atlasBounds: {
581
+ left: 109.5,
582
+ bottom: 197.5,
583
+ right: 139.5,
584
+ top: 255.5
585
+ }
586
+ },
587
+ {
588
+ unicode: 37,
589
+ advance: 0.732421875,
590
+ planeBounds: {
591
+ left: 0.026481776289942378,
592
+ bottom: -0.030073418674698794,
593
+ right: 0.7137525987100576,
594
+ top: 0.7410109186746989
595
+ },
596
+ atlasBounds: {
597
+ left: 88.5,
598
+ bottom: 144.5,
599
+ right: 129.5,
600
+ top: 190.5
601
+ }
602
+ },
603
+ {
604
+ unicode: 38,
605
+ advance: 0.62158203125,
606
+ planeBounds: {
607
+ left: 0.03225572125458355,
608
+ bottom: -0.030073418674698794,
609
+ right: 0.6357130287454166,
610
+ top: 0.7410109186746989
611
+ },
612
+ atlasBounds: {
613
+ left: 130.5,
614
+ bottom: 144.5,
615
+ right: 166.5,
616
+ top: 190.5
617
+ }
618
+ },
619
+ {
620
+ unicode: 39,
621
+ advance: 0.17431640625,
622
+ planeBounds: {
623
+ left: 0.028244602049502358,
624
+ bottom: 0.49895501673814824,
625
+ right: 0.14558352295049765,
626
+ top: 0.7671582645118518
627
+ },
628
+ atlasBounds: {
629
+ left: 498.5,
630
+ bottom: 62.5,
631
+ right: 505.5,
632
+ top: 78.5
633
+ }
634
+ },
635
+ {
636
+ unicode: 40,
637
+ advance: 0.341796875,
638
+ planeBounds: {
639
+ left: 0.042983329377291775,
640
+ bottom: -0.250029542422407,
641
+ right: 0.34471198312270823,
642
+ top: 0.8227834486724072
643
+ },
644
+ atlasBounds: {
645
+ left: 0.5,
646
+ bottom: 191.5,
647
+ right: 18.5,
648
+ top: 255.5
649
+ }
650
+ },
651
+ {
652
+ unicode: 41,
653
+ advance: 0.34765625,
654
+ planeBounds: {
655
+ left: -0.003159248747708225,
656
+ bottom: -0.250029542422407,
657
+ right: 0.29856940499770823,
658
+ top: 0.8227834486724072
659
+ },
660
+ atlasBounds: {
661
+ left: 19.5,
662
+ bottom: 191.5,
663
+ right: 37.5,
664
+ top: 255.5
665
+ }
666
+ },
667
+ {
668
+ unicode: 42,
669
+ advance: 0.4306640625,
670
+ planeBounds: {
671
+ left: -0.011208599684062338,
672
+ bottom: 0.27785390031593765,
673
+ right: 0.44138438093406235,
674
+ top: 0.7304468809340623
675
+ },
676
+ atlasBounds: {
677
+ left: 449.5,
678
+ bottom: 23.5,
679
+ right: 476.5,
680
+ top: 50.5
681
+ }
682
+ },
683
+ {
684
+ unicode: 43,
685
+ advance: 0.56689453125,
686
+ planeBounds: {
687
+ left: 0.01353503347629649,
688
+ bottom: 0.053493525733368255,
689
+ right: 0.5499415290237036,
690
+ top: 0.6066627242666317
691
+ },
692
+ atlasBounds: {
693
+ left: 361.5,
694
+ bottom: 17.5,
695
+ right: 393.5,
696
+ top: 50.5
697
+ }
698
+ },
699
+ {
700
+ unicode: 44,
701
+ advance: 0.1962890625,
702
+ planeBounds: {
703
+ left: -0.009919475797210583,
704
+ bottom: -0.15981695975478,
705
+ right: 0.1744702570472106,
706
+ top: 0.12514899100478
707
+ },
708
+ atlasBounds: {
709
+ left: 498.5,
710
+ bottom: 79.5,
711
+ right: 509.5,
712
+ top: 96.5
713
+ }
714
+ },
715
+ {
716
+ unicode: 45,
717
+ advance: 0.27587890625,
718
+ planeBounds: {
719
+ left: -0.00527594412977999,
720
+ bottom: 0.24333249267450235,
721
+ right: 0.27969000662978,
722
+ top: 0.36067141357549765
723
+ },
724
+ atlasBounds: {
725
+ left: 52.5,
726
+ bottom: 7.5,
727
+ right: 69.5,
728
+ top: 14.5
729
+ }
730
+ },
731
+ {
732
+ unicode: 46,
733
+ advance: 0.26318359375,
734
+ planeBounds: {
735
+ left: 0.051032680313645884,
736
+ bottom: -0.027092319686354116,
737
+ right: 0.20189700718635412,
738
+ top: 0.12377200718635412
739
+ },
740
+ atlasBounds: {
741
+ left: 501.5,
742
+ bottom: 221.5,
743
+ right: 510.5,
744
+ top: 230.5
745
+ }
746
+ },
747
+ {
748
+ unicode: 47,
749
+ advance: 0.412109375,
750
+ planeBounds: {
751
+ left: -0.013733006073205867,
752
+ bottom: -0.08573505127848349,
753
+ right: 0.4053345685732059,
754
+ top: 0.7356373950284835
755
+ },
756
+ atlasBounds: {
757
+ left: 252.5,
758
+ bottom: 206.5,
759
+ right: 277.5,
760
+ top: 255.5
761
+ }
762
+ },
763
+ {
764
+ unicode: 48,
765
+ advance: 0.5615234375,
766
+ planeBounds: {
767
+ left: 0.037458384830081196,
768
+ bottom: -0.030073418674698794,
769
+ right: 0.5235767714199189,
770
+ top: 0.7410109186746989
771
+ },
772
+ atlasBounds: {
773
+ left: 167.5,
774
+ bottom: 144.5,
775
+ right: 196.5,
776
+ top: 190.5
777
+ }
778
+ },
779
+ {
780
+ unicode: 49,
781
+ advance: 0.5615234375,
782
+ planeBounds: {
783
+ left: 0.06023674350936354,
784
+ bottom: -0.01998308280677056,
785
+ right: 0.37872810024063647,
786
+ top: 0.7343385515567705
787
+ },
788
+ atlasBounds: {
789
+ left: 488.5,
790
+ bottom: 97.5,
791
+ right: 507.5,
792
+ top: 142.5
793
+ }
794
+ },
795
+ {
796
+ unicode: 50,
797
+ advance: 0.5615234375,
798
+ planeBounds: {
799
+ left: 0.025334353719224725,
800
+ bottom: -0.01680925468177056,
801
+ right: 0.5449781462807752,
802
+ top: 0.7375123796817705
803
+ },
804
+ atlasBounds: {
805
+ left: 278.5,
806
+ bottom: 51.5,
807
+ right: 309.5,
808
+ top: 96.5
809
+ }
810
+ },
811
+ {
812
+ unicode: 51,
813
+ advance: 0.5615234375,
814
+ planeBounds: {
815
+ left: 0.028181041080081196,
816
+ bottom: -0.030073418674698794,
817
+ right: 0.5142994276699189,
818
+ top: 0.7410109186746989
819
+ },
820
+ atlasBounds: {
821
+ left: 197.5,
822
+ bottom: 144.5,
823
+ right: 226.5,
824
+ top: 190.5
825
+ }
826
+ },
827
+ {
828
+ unicode: 52,
829
+ advance: 0.5615234375,
830
+ planeBounds: {
831
+ left: 0.005886103858368255,
832
+ bottom: -0.02169206718177056,
833
+ right: 0.5590553023916317,
834
+ top: 0.7326295671817705
835
+ },
836
+ atlasBounds: {
837
+ left: 310.5,
838
+ bottom: 51.5,
839
+ right: 343.5,
840
+ top: 96.5
841
+ }
842
+ },
843
+ {
844
+ unicode: 53,
845
+ advance: 0.5615234375,
846
+ planeBounds: {
847
+ left: 0.055524791080081196,
848
+ bottom: -0.02657487968177056,
849
+ right: 0.5416431776699189,
850
+ top: 0.7277467546817705
851
+ },
852
+ atlasBounds: {
853
+ left: 344.5,
854
+ bottom: 51.5,
855
+ right: 373.5,
856
+ top: 96.5
857
+ }
858
+ },
859
+ {
860
+ unicode: 54,
861
+ advance: 0.5615234375,
862
+ planeBounds: {
863
+ left: 0.046003306705081196,
864
+ bottom: -0.034712090549698794,
865
+ right: 0.5321216932949189,
866
+ top: 0.7363722467996989
867
+ },
868
+ atlasBounds: {
869
+ left: 227.5,
870
+ bottom: 144.5,
871
+ right: 256.5,
872
+ top: 190.5
873
+ }
874
+ },
875
+ {
876
+ unicode: 55,
877
+ advance: 0.5615234375,
878
+ planeBounds: {
879
+ left: 0.018010134969224725,
880
+ bottom: -0.02169206718177056,
881
+ right: 0.5376539275307752,
882
+ top: 0.7326295671817705
883
+ },
884
+ atlasBounds: {
885
+ left: 374.5,
886
+ bottom: 51.5,
887
+ right: 405.5,
888
+ top: 96.5
889
+ }
890
+ },
891
+ {
892
+ unicode: 56,
893
+ advance: 0.5615234375,
894
+ planeBounds: {
895
+ left: 0.037702525455081196,
896
+ bottom: -0.030073418674698794,
897
+ right: 0.5238209120449189,
898
+ top: 0.7410109186746989
899
+ },
900
+ atlasBounds: {
901
+ left: 257.5,
902
+ bottom: 144.5,
903
+ right: 286.5,
904
+ top: 190.5
905
+ }
906
+ },
907
+ {
908
+ unicode: 57,
909
+ advance: 0.5615234375,
910
+ planeBounds: {
911
+ left: 0.029401744205081196,
912
+ bottom: -0.025434746799698794,
913
+ right: 0.5155201307949189,
914
+ top: 0.7456495905496989
915
+ },
916
+ atlasBounds: {
917
+ left: 287.5,
918
+ bottom: 144.5,
919
+ right: 316.5,
920
+ top: 190.5
921
+ }
922
+ },
923
+ {
924
+ unicode: 58,
925
+ advance: 0.2421875,
926
+ planeBounds: {
927
+ left: 0.046394008438645884,
928
+ bottom: -0.029431286627488215,
929
+ right: 0.19725833531135412,
930
+ top: 0.5572633178774882
931
+ },
932
+ atlasBounds: {
933
+ left: 439.5,
934
+ bottom: 61.5,
935
+ right: 448.5,
936
+ top: 96.5
937
+ }
938
+ },
939
+ {
940
+ unicode: 59,
941
+ advance: 0.21142578125,
942
+ planeBounds: {
943
+ left: 0.001066852327789419,
944
+ bottom: -0.16459733294591408,
945
+ right: 0.1854565851722106,
946
+ top: 0.556198895445914
947
+ },
948
+ atlasBounds: {
949
+ left: 406.5,
950
+ bottom: 53.5,
951
+ right: 417.5,
952
+ top: 96.5
953
+ }
954
+ },
955
+ {
956
+ unicode: 60,
957
+ advance: 0.50830078125,
958
+ planeBounds: {
959
+ left: 0.016948142433865897,
960
+ bottom: 0.0726146348300812,
961
+ right: 0.4527784200661341,
962
+ top: 0.5587330214199189
963
+ },
964
+ atlasBounds: {
965
+ left: 394.5,
966
+ bottom: 21.5,
967
+ right: 420.5,
968
+ top: 50.5
969
+ }
970
+ },
971
+ {
972
+ unicode: 61,
973
+ advance: 0.548828125,
974
+ planeBounds: {
975
+ left: 0.051535540940937666,
976
+ bottom: 0.17620354038436353,
977
+ right: 0.5041285215590624,
978
+ top: 0.49469489711563647
979
+ },
980
+ atlasBounds: {
981
+ left: 477.5,
982
+ bottom: 31.5,
983
+ right: 504.5,
984
+ top: 50.5
985
+ }
986
+ },
987
+ {
988
+ unicode: 62,
989
+ advance: 0.5224609375,
990
+ planeBounds: {
991
+ left: 0.047629290940937666,
992
+ bottom: 0.0731029160800812,
993
+ right: 0.5002222715590624,
994
+ top: 0.5592213026699189
995
+ },
996
+ atlasBounds: {
997
+ left: 421.5,
998
+ bottom: 21.5,
999
+ right: 448.5,
1000
+ top: 50.5
1001
+ }
1002
+ },
1003
+ {
1004
+ unicode: 63,
1005
+ advance: 0.47216796875,
1006
+ planeBounds: {
1007
+ left: 0.016704001808865897,
1008
+ bottom: -0.027876153049698794,
1009
+ right: 0.4525342794411341,
1010
+ top: 0.7432081842996989
1011
+ },
1012
+ atlasBounds: {
1013
+ left: 317.5,
1014
+ bottom: 144.5,
1015
+ right: 343.5,
1016
+ top: 190.5
1017
+ }
1018
+ },
1019
+ {
1020
+ unicode: 64,
1021
+ advance: 0.89794921875,
1022
+ planeBounds: {
1023
+ left: 0.034064457306783605,
1024
+ bottom: -0.23896750384690937,
1025
+ right: 0.8721996065996072,
1026
+ top: 0.7165065663469093
1027
+ },
1028
+ atlasBounds: {
1029
+ left: 155.5,
1030
+ bottom: 198.5,
1031
+ right: 205.5,
1032
+ top: 255.5
1033
+ }
1034
+ },
1035
+ {
1036
+ unicode: 65,
1037
+ advance: 0.65234375,
1038
+ planeBounds: {
1039
+ left: -0.008838044092129387,
1040
+ bottom: -0.02169206718177056,
1041
+ right: 0.6616700753421295,
1042
+ top: 0.7326295671817705
1043
+ },
1044
+ atlasBounds: {
1045
+ left: 237.5,
1046
+ bottom: 51.5,
1047
+ right: 277.5,
1048
+ top: 96.5
1049
+ }
1050
+ },
1051
+ {
1052
+ unicode: 66,
1053
+ advance: 0.62255859375,
1054
+ planeBounds: {
1055
+ left: 0.06464099434422473,
1056
+ bottom: -0.02169206718177056,
1057
+ right: 0.5842847869057752,
1058
+ top: 0.7326295671817705
1059
+ },
1060
+ atlasBounds: {
1061
+ left: 205.5,
1062
+ bottom: 51.5,
1063
+ right: 236.5,
1064
+ top: 96.5
1065
+ }
1066
+ },
1067
+ {
1068
+ unicode: 67,
1069
+ advance: 0.65087890625,
1070
+ planeBounds: {
1071
+ left: 0.038439807122511785,
1072
+ bottom: -0.030073418674698794,
1073
+ right: 0.6251344116274882,
1074
+ top: 0.7410109186746989
1075
+ },
1076
+ atlasBounds: {
1077
+ left: 344.5,
1078
+ bottom: 144.5,
1079
+ right: 379.5,
1080
+ top: 190.5
1081
+ }
1082
+ },
1083
+ {
1084
+ unicode: 68,
1085
+ advance: 0.65576171875,
1086
+ planeBounds: {
1087
+ left: 0.06301501010836826,
1088
+ bottom: -0.02169206718177056,
1089
+ right: 0.6161842086416317,
1090
+ top: 0.7326295671817705
1091
+ },
1092
+ atlasBounds: {
1093
+ left: 162.5,
1094
+ bottom: 51.5,
1095
+ right: 195.5,
1096
+ top: 96.5
1097
+ }
1098
+ },
1099
+ {
1100
+ unicode: 69,
1101
+ advance: 0.568359375,
1102
+ planeBounds: {
1103
+ left: 0.0652904160800812,
1104
+ bottom: -0.02169206718177056,
1105
+ right: 0.5514088026699189,
1106
+ top: 0.7326295671817705
1107
+ },
1108
+ atlasBounds: {
1109
+ left: 132.5,
1110
+ bottom: 51.5,
1111
+ right: 161.5,
1112
+ top: 96.5
1113
+ }
1114
+ },
1115
+ {
1116
+ unicode: 70,
1117
+ advance: 0.552734375,
1118
+ planeBounds: {
1119
+ left: 0.059675181705081196,
1120
+ bottom: -0.02169206718177056,
1121
+ right: 0.5457935682949189,
1122
+ top: 0.7326295671817705
1123
+ },
1124
+ atlasBounds: {
1125
+ left: 102.5,
1126
+ bottom: 51.5,
1127
+ right: 131.5,
1128
+ top: 96.5
1129
+ }
1130
+ },
1131
+ {
1132
+ unicode: 71,
1133
+ advance: 0.68115234375,
1134
+ planeBounds: {
1135
+ left: 0.040148791497511785,
1136
+ bottom: -0.030073418674698794,
1137
+ right: 0.6268433960024882,
1138
+ top: 0.7410109186746989
1139
+ },
1140
+ atlasBounds: {
1141
+ left: 380.5,
1142
+ bottom: 144.5,
1143
+ right: 415.5,
1144
+ top: 190.5
1145
+ }
1146
+ },
1147
+ {
1148
+ unicode: 72,
1149
+ advance: 0.712890625,
1150
+ planeBounds: {
1151
+ left: 0.062365588372511785,
1152
+ bottom: -0.02169206718177056,
1153
+ right: 0.6490601928774882,
1154
+ top: 0.7326295671817705
1155
+ },
1156
+ atlasBounds: {
1157
+ left: 30.5,
1158
+ bottom: 51.5,
1159
+ right: 65.5,
1160
+ top: 96.5
1161
+ }
1162
+ },
1163
+ {
1164
+ unicode: 73,
1165
+ advance: 0.27197265625,
1166
+ planeBounds: {
1167
+ left: 0.06917965680657412,
1168
+ bottom: -0.02169206718177056,
1169
+ right: 0.20328128069342588,
1170
+ top: 0.7326295671817705
1171
+ },
1172
+ atlasBounds: {
1173
+ left: 196.5,
1174
+ bottom: 51.5,
1175
+ right: 204.5,
1176
+ top: 96.5
1177
+ }
1178
+ },
1179
+ {
1180
+ unicode: 74,
1181
+ advance: 0.5517578125,
1182
+ planeBounds: {
1183
+ left: 0.007184947330081194,
1184
+ bottom: -0.02657487968177056,
1185
+ right: 0.4933033339199188,
1186
+ top: 0.7277467546817705
1187
+ },
1188
+ atlasBounds: {
1189
+ left: 0.5,
1190
+ bottom: 51.5,
1191
+ right: 29.5,
1192
+ top: 96.5
1193
+ }
1194
+ },
1195
+ {
1196
+ unicode: 75,
1197
+ advance: 0.626953125,
1198
+ planeBounds: {
1199
+ left: 0.061633166497511785,
1200
+ bottom: -0.02169206718177056,
1201
+ right: 0.6483277710024882,
1202
+ top: 0.7326295671817705
1203
+ },
1204
+ atlasBounds: {
1205
+ left: 452.5,
1206
+ bottom: 97.5,
1207
+ right: 487.5,
1208
+ top: 142.5
1209
+ }
1210
+ },
1211
+ {
1212
+ unicode: 76,
1213
+ advance: 0.5380859375,
1214
+ planeBounds: {
1215
+ left: 0.06341786132300943,
1216
+ bottom: -0.02169206718177056,
1217
+ right: 0.5327735449269906,
1218
+ top: 0.7326295671817705
1219
+ },
1220
+ atlasBounds: {
1221
+ left: 423.5,
1222
+ bottom: 97.5,
1223
+ right: 451.5,
1224
+ top: 142.5
1225
+ }
1226
+ },
1227
+ {
1228
+ unicode: 77,
1229
+ advance: 0.873046875,
1230
+ planeBounds: {
1231
+ left: 0.05911847969322944,
1232
+ bottom: -0.02169206718177056,
1233
+ right: 0.8134401140567705,
1234
+ top: 0.7326295671817705
1235
+ },
1236
+ atlasBounds: {
1237
+ left: 377.5,
1238
+ bottom: 97.5,
1239
+ right: 422.5,
1240
+ top: 142.5
1241
+ }
1242
+ },
1243
+ {
1244
+ unicode: 78,
1245
+ advance: 0.712890625,
1246
+ planeBounds: {
1247
+ left: 0.062365588372511785,
1248
+ bottom: -0.02169206718177056,
1249
+ right: 0.6490601928774882,
1250
+ top: 0.7326295671817705
1251
+ },
1252
+ atlasBounds: {
1253
+ left: 341.5,
1254
+ bottom: 97.5,
1255
+ right: 376.5,
1256
+ top: 142.5
1257
+ }
1258
+ },
1259
+ {
1260
+ unicode: 79,
1261
+ advance: 0.6875,
1262
+ planeBounds: {
1263
+ left: 0.033395854136655315,
1264
+ bottom: -0.030073418674698794,
1265
+ right: 0.6536158646133446,
1266
+ top: 0.7410109186746989
1267
+ },
1268
+ atlasBounds: {
1269
+ left: 416.5,
1270
+ bottom: 144.5,
1271
+ right: 453.5,
1272
+ top: 190.5
1273
+ }
1274
+ },
1275
+ {
1276
+ unicode: 80,
1277
+ advance: 0.630859375,
1278
+ planeBounds: {
1279
+ left: 0.061550166358368255,
1280
+ bottom: -0.02169206718177056,
1281
+ right: 0.6147193648916317,
1282
+ top: 0.7326295671817705
1283
+ },
1284
+ atlasBounds: {
1285
+ left: 273.5,
1286
+ bottom: 97.5,
1287
+ right: 306.5,
1288
+ top: 142.5
1289
+ }
1290
+ },
1291
+ {
1292
+ unicode: 81,
1293
+ advance: 0.6875,
1294
+ planeBounds: {
1295
+ left: 0.030466166636655315,
1296
+ bottom: -0.14391866037519643,
1297
+ right: 0.6506861771133446,
1298
+ top: 0.7445045978751964
1299
+ },
1300
+ atlasBounds: {
1301
+ left: 214.5,
1302
+ bottom: 202.5,
1303
+ right: 251.5,
1304
+ top: 255.5
1305
+ }
1306
+ },
1307
+ {
1308
+ unicode: 82,
1309
+ advance: 0.61572265625,
1310
+ planeBounds: {
1311
+ left: 0.06350329135836826,
1312
+ bottom: -0.02169206718177056,
1313
+ right: 0.6166724898916317,
1314
+ top: 0.7326295671817705
1315
+ },
1316
+ atlasBounds: {
1317
+ left: 186.5,
1318
+ bottom: 97.5,
1319
+ right: 219.5,
1320
+ top: 142.5
1321
+ }
1322
+ },
1323
+ {
1324
+ unicode: 83,
1325
+ advance: 0.59326171875,
1326
+ planeBounds: {
1327
+ left: 0.020778681983368255,
1328
+ bottom: -0.030073418674698794,
1329
+ right: 0.5739478805166317,
1330
+ top: 0.7410109186746989
1331
+ },
1332
+ atlasBounds: {
1333
+ left: 454.5,
1334
+ bottom: 144.5,
1335
+ right: 487.5,
1336
+ top: 190.5
1337
+ }
1338
+ },
1339
+ {
1340
+ unicode: 84,
1341
+ advance: 0.5966796875,
1342
+ planeBounds: {
1343
+ left: 0.005480822747511787,
1344
+ bottom: -0.02169206718177056,
1345
+ right: 0.5921754272524882,
1346
+ top: 0.7326295671817705
1347
+ },
1348
+ atlasBounds: {
1349
+ left: 112.5,
1350
+ bottom: 97.5,
1351
+ right: 147.5,
1352
+ top: 142.5
1353
+ }
1354
+ },
1355
+ {
1356
+ unicode: 85,
1357
+ advance: 0.6484375,
1358
+ planeBounds: {
1359
+ left: 0.049098994483368255,
1360
+ bottom: -0.02657487968177056,
1361
+ right: 0.6022681930166317,
1362
+ top: 0.7277467546817705
1363
+ },
1364
+ atlasBounds: {
1365
+ left: 78.5,
1366
+ bottom: 97.5,
1367
+ right: 111.5,
1368
+ top: 142.5
1369
+ }
1370
+ },
1371
+ {
1372
+ unicode: 86,
1373
+ advance: 0.63623046875,
1374
+ planeBounds: {
1375
+ left: -0.008269192599201152,
1376
+ bottom: -0.02169206718177056,
1377
+ right: 0.6454762238492011,
1378
+ top: 0.7326295671817705
1379
+ },
1380
+ atlasBounds: {
1381
+ left: 38.5,
1382
+ bottom: 97.5,
1383
+ right: 77.5,
1384
+ top: 142.5
1385
+ }
1386
+ },
1387
+ {
1388
+ unicode: 87,
1389
+ advance: 0.88720703125,
1390
+ planeBounds: {
1391
+ left: 0.011923628617731797,
1392
+ bottom: -0.02169206718177056,
1393
+ right: 0.8835841838822683,
1394
+ top: 0.7326295671817705
1395
+ },
1396
+ atlasBounds: {
1397
+ left: 220.5,
1398
+ bottom: 97.5,
1399
+ right: 272.5,
1400
+ top: 142.5
1401
+ }
1402
+ },
1403
+ {
1404
+ unicode: 88,
1405
+ advance: 0.626953125,
1406
+ planeBounds: {
1407
+ left: 0.004098979136655316,
1408
+ bottom: -0.02169206718177056,
1409
+ right: 0.6243189896133446,
1410
+ top: 0.7326295671817705
1411
+ },
1412
+ atlasBounds: {
1413
+ left: 0.5,
1414
+ bottom: 97.5,
1415
+ right: 37.5,
1416
+ top: 142.5
1417
+ }
1418
+ },
1419
+ {
1420
+ unicode: 89,
1421
+ advance: 0.6005859375,
1422
+ planeBounds: {
1423
+ left: -0.010793598988344685,
1424
+ bottom: -0.02169206718177056,
1425
+ right: 0.6094264114883446,
1426
+ top: 0.7326295671817705
1427
+ },
1428
+ atlasBounds: {
1429
+ left: 148.5,
1430
+ bottom: 97.5,
1431
+ right: 185.5,
1432
+ top: 142.5
1433
+ }
1434
+ },
1435
+ {
1436
+ unicode: 90,
1437
+ advance: 0.5986328125,
1438
+ planeBounds: {
1439
+ left: 0.024196650733368255,
1440
+ bottom: -0.02169206718177056,
1441
+ right: 0.5773658492666317,
1442
+ top: 0.7326295671817705
1443
+ },
1444
+ atlasBounds: {
1445
+ left: 307.5,
1446
+ bottom: 97.5,
1447
+ right: 340.5,
1448
+ top: 142.5
1449
+ }
1450
+ },
1451
+ {
1452
+ unicode: 91,
1453
+ advance: 0.26513671875,
1454
+ planeBounds: {
1455
+ left: 0.05437250871693295,
1456
+ bottom: -0.17280296457569408,
1457
+ right: 0.27228764753306706,
1458
+ top: 0.8329592145756942
1459
+ },
1460
+ atlasBounds: {
1461
+ left: 59.5,
1462
+ bottom: 195.5,
1463
+ right: 72.5,
1464
+ top: 255.5
1465
+ }
1466
+ },
1467
+ {
1468
+ unicode: 92,
1469
+ advance: 0.41015625,
1470
+ planeBounds: {
1471
+ left: 0.0014037126767941326,
1472
+ bottom: -0.08573505127848349,
1473
+ right: 0.4204712873232059,
1474
+ top: 0.7356373950284835
1475
+ },
1476
+ atlasBounds: {
1477
+ left: 278.5,
1478
+ bottom: 206.5,
1479
+ right: 303.5,
1480
+ top: 255.5
1481
+ }
1482
+ },
1483
+ {
1484
+ unicode: 93,
1485
+ advance: 0.26513671875,
1486
+ planeBounds: {
1487
+ left: -0.020659233400995285,
1488
+ bottom: -0.17280296457569408,
1489
+ right: 0.2140186084009953,
1490
+ top: 0.8329592145756942
1491
+ },
1492
+ atlasBounds: {
1493
+ left: 94.5,
1494
+ bottom: 195.5,
1495
+ right: 108.5,
1496
+ top: 255.5
1497
+ }
1498
+ },
1499
+ {
1500
+ unicode: 94,
1501
+ advance: 0.41796875,
1502
+ planeBounds: {
1503
+ left: 0.006855376669722368,
1504
+ bottom: 0.33229482979472236,
1505
+ right: 0.40916024833027764,
1506
+ top: 0.7345997014552776
1507
+ },
1508
+ atlasBounds: {
1509
+ left: 486.5,
1510
+ bottom: 231.5,
1511
+ right: 510.5,
1512
+ top: 255.5
1513
+ }
1514
+ },
1515
+ {
1516
+ unicode: 95,
1517
+ advance: 0.451171875,
1518
+ planeBounds: {
1519
+ left: -0.017473255794918804,
1520
+ bottom: -0.09553469482549765,
1521
+ right: 0.4686451307949188,
1522
+ top: 0.021804226075497646
1523
+ },
1524
+ atlasBounds: {
1525
+ left: 70.5,
1526
+ bottom: 7.5,
1527
+ right: 99.5,
1528
+ top: 14.5
1529
+ }
1530
+ },
1531
+ {
1532
+ unicode: 96,
1533
+ advance: 0.30908203125,
1534
+ planeBounds: {
1535
+ left: 0.00391839948107648,
1536
+ bottom: 0.5860277898277895,
1537
+ right: 0.2553589442689235,
1538
+ top: 0.7704175226722105
1539
+ },
1540
+ atlasBounds: {
1541
+ left: 36.5,
1542
+ bottom: 3.5,
1543
+ right: 51.5,
1544
+ top: 14.5
1545
+ }
1546
+ },
1547
+ {
1548
+ unicode: 97,
1549
+ advance: 0.5439453125,
1550
+ planeBounds: {
1551
+ left: 0.028181041080081196,
1552
+ bottom: -0.029187146002488215,
1553
+ right: 0.5142994276699189,
1554
+ top: 0.5575074585024882
1555
+ },
1556
+ atlasBounds: {
1557
+ left: 30.5,
1558
+ bottom: 15.5,
1559
+ right: 59.5,
1560
+ top: 50.5
1561
+ }
1562
+ },
1563
+ {
1564
+ unicode: 98,
1565
+ advance: 0.56103515625,
1566
+ planeBounds: {
1567
+ left: 0.048932994205081196,
1568
+ bottom: -0.032187684160555265,
1569
+ right: 0.5350513807949189,
1570
+ top: 0.7724220591605554
1571
+ },
1572
+ atlasBounds: {
1573
+ left: 304.5,
1574
+ bottom: 207.5,
1575
+ right: 333.5,
1576
+ top: 255.5
1577
+ }
1578
+ },
1579
+ {
1580
+ unicode: 99,
1581
+ advance: 0.5234375,
1582
+ planeBounds: {
1583
+ left: 0.024518931705081196,
1584
+ bottom: -0.029187146002488215,
1585
+ right: 0.5106373182949189,
1586
+ top: 0.5575074585024882
1587
+ },
1588
+ atlasBounds: {
1589
+ left: 0.5,
1590
+ bottom: 15.5,
1591
+ right: 29.5,
1592
+ top: 50.5
1593
+ }
1594
+ },
1595
+ {
1596
+ unicode: 100,
1597
+ advance: 0.56396484375,
1598
+ planeBounds: {
1599
+ left: 0.026227916080081196,
1600
+ bottom: -0.032187684160555265,
1601
+ right: 0.5123463026699189,
1602
+ top: 0.7724220591605554
1603
+ },
1604
+ atlasBounds: {
1605
+ left: 334.5,
1606
+ bottom: 207.5,
1607
+ right: 363.5,
1608
+ top: 255.5
1609
+ }
1610
+ },
1611
+ {
1612
+ unicode: 101,
1613
+ advance: 0.52978515625,
1614
+ planeBounds: {
1615
+ left: 0.026472056705081196,
1616
+ bottom: -0.029187146002488215,
1617
+ right: 0.5125904432949189,
1618
+ top: 0.5575074585024882
1619
+ },
1620
+ atlasBounds: {
1621
+ left: 468.5,
1622
+ bottom: 61.5,
1623
+ right: 497.5,
1624
+ top: 96.5
1625
+ }
1626
+ },
1627
+ {
1628
+ unicode: 102,
1629
+ advance: 0.34716796875,
1630
+ planeBounds: {
1631
+ left: 0.004575110905578838,
1632
+ bottom: -0.022177918535555265,
1633
+ right: 0.3733545765944212,
1634
+ top: 0.7824318247855554
1635
+ },
1636
+ atlasBounds: {
1637
+ left: 364.5,
1638
+ bottom: 207.5,
1639
+ right: 386.5,
1640
+ top: 255.5
1641
+ }
1642
+ },
1643
+ {
1644
+ unicode: 103,
1645
+ advance: 0.56103515625,
1646
+ planeBounds: {
1647
+ left: 0.026960337955081196,
1648
+ bottom: -0.22888445766762702,
1649
+ right: 0.5130787245449189,
1650
+ top: 0.558962582667627
1651
+ },
1652
+ atlasBounds: {
1653
+ left: 28.5,
1654
+ bottom: 143.5,
1655
+ right: 57.5,
1656
+ top: 190.5
1657
+ }
1658
+ },
1659
+ {
1660
+ unicode: 104,
1661
+ advance: 0.55078125,
1662
+ planeBounds: {
1663
+ left: 0.049826556565937666,
1664
+ bottom: -0.01892352016762703,
1665
+ right: 0.5024195371840624,
1666
+ top: 0.768923520167627
1667
+ },
1668
+ atlasBounds: {
1669
+ left: 0.5,
1670
+ bottom: 143.5,
1671
+ right: 27.5,
1672
+ top: 190.5
1673
+ }
1674
+ },
1675
+ {
1676
+ unicode: 105,
1677
+ advance: 0.24267578125,
1678
+ planeBounds: {
1679
+ left: 0.046882289688645884,
1680
+ bottom: -0.01680925468177056,
1681
+ right: 0.19774661656135412,
1682
+ top: 0.7375123796817705
1683
+ },
1684
+ atlasBounds: {
1685
+ left: 498.5,
1686
+ bottom: 145.5,
1687
+ right: 507.5,
1688
+ top: 190.5
1689
+ }
1690
+ },
1691
+ {
1692
+ unicode: 106,
1693
+ advance: 0.23876953125,
1694
+ planeBounds: {
1695
+ left: -0.048979545900995285,
1696
+ bottom: -0.2324562772148376,
1697
+ right: 0.1856982959009953,
1698
+ top: 0.7397804959648377
1699
+ },
1700
+ atlasBounds: {
1701
+ left: 140.5,
1702
+ bottom: 197.5,
1703
+ right: 154.5,
1704
+ top: 255.5
1705
+ }
1706
+ },
1707
+ {
1708
+ unicode: 107,
1709
+ advance: 0.5068359375,
1710
+ planeBounds: {
1711
+ left: 0.044294322330081196,
1712
+ bottom: -0.01892352016762703,
1713
+ right: 0.5304127089199189,
1714
+ top: 0.768923520167627
1715
+ },
1716
+ atlasBounds: {
1717
+ left: 58.5,
1718
+ bottom: 143.5,
1719
+ right: 87.5,
1720
+ top: 190.5
1721
+ }
1722
+ },
1723
+ {
1724
+ unicode: 108,
1725
+ advance: 0.24267578125,
1726
+ planeBounds: {
1727
+ left: 0.05428707868157412,
1728
+ bottom: -0.01892352016762703,
1729
+ right: 0.18838870256842588,
1730
+ top: 0.768923520167627
1731
+ },
1732
+ atlasBounds: {
1733
+ left: 477.5,
1734
+ bottom: 208.5,
1735
+ right: 485.5,
1736
+ top: 255.5
1737
+ }
1738
+ },
1739
+ {
1740
+ unicode: 109,
1741
+ advance: 0.87646484375,
1742
+ planeBounds: {
1743
+ left: 0.04430890170737297,
1744
+ bottom: -0.024304333502488215,
1745
+ right: 0.832155942042627,
1746
+ top: 0.5623902710024882
1747
+ },
1748
+ atlasBounds: {
1749
+ left: 116.5,
1750
+ bottom: 15.5,
1751
+ right: 163.5,
1752
+ top: 50.5
1753
+ }
1754
+ },
1755
+ {
1756
+ unicode: 110,
1757
+ advance: 0.5517578125,
1758
+ planeBounds: {
1759
+ left: 0.049826556565937666,
1760
+ bottom: -0.024304333502488215,
1761
+ right: 0.5024195371840624,
1762
+ top: 0.5623902710024882
1763
+ },
1764
+ atlasBounds: {
1765
+ left: 60.5,
1766
+ bottom: 15.5,
1767
+ right: 87.5,
1768
+ top: 50.5
1769
+ }
1770
+ },
1771
+ {
1772
+ unicode: 111,
1773
+ advance: 0.5703125,
1774
+ planeBounds: {
1775
+ left: 0.025090213094224725,
1776
+ bottom: -0.029187146002488215,
1777
+ right: 0.5447340056557752,
1778
+ top: 0.5575074585024882
1779
+ },
1780
+ atlasBounds: {
1781
+ left: 193.5,
1782
+ bottom: 15.5,
1783
+ right: 224.5,
1784
+ top: 50.5
1785
+ }
1786
+ },
1787
+ {
1788
+ unicode: 112,
1789
+ advance: 0.56103515625,
1790
+ planeBounds: {
1791
+ left: 0.048444712955081196,
1792
+ bottom: -0.22644305141762702,
1793
+ right: 0.5345630995449189,
1794
+ top: 0.561403988917627
1795
+ },
1796
+ atlasBounds: {
1797
+ left: 447.5,
1798
+ bottom: 208.5,
1799
+ right: 476.5,
1800
+ top: 255.5
1801
+ }
1802
+ },
1803
+ {
1804
+ unicode: 113,
1805
+ advance: 0.568359375,
1806
+ planeBounds: {
1807
+ left: 0.025983775455081196,
1808
+ bottom: -0.22644305141762702,
1809
+ right: 0.5121021620449189,
1810
+ top: 0.561403988917627
1811
+ },
1812
+ atlasBounds: {
1813
+ left: 417.5,
1814
+ bottom: 208.5,
1815
+ right: 446.5,
1816
+ top: 255.5
1817
+ }
1818
+ },
1819
+ {
1820
+ unicode: 114,
1821
+ advance: 0.33837890625,
1822
+ planeBounds: {
1823
+ left: 0.045180595002291775,
1824
+ bottom: -0.024304333502488215,
1825
+ right: 0.34690924874770823,
1826
+ top: 0.5623902710024882
1827
+ },
1828
+ atlasBounds: {
1829
+ left: 449.5,
1830
+ bottom: 61.5,
1831
+ right: 467.5,
1832
+ top: 96.5
1833
+ }
1834
+ },
1835
+ {
1836
+ unicode: 115,
1837
+ advance: 0.515625,
1838
+ planeBounds: {
1839
+ left: 0.021669814448009427,
1840
+ bottom: -0.029187146002488215,
1841
+ right: 0.4910254980519906,
1842
+ top: 0.5575074585024882
1843
+ },
1844
+ atlasBounds: {
1845
+ left: 164.5,
1846
+ bottom: 15.5,
1847
+ right: 192.5,
1848
+ top: 50.5
1849
+ }
1850
+ },
1851
+ {
1852
+ unicode: 116,
1853
+ advance: 0.32666015625,
1854
+ planeBounds: {
1855
+ left: -0.019433670483564695,
1856
+ bottom: -0.02877457520298586,
1857
+ right: 0.3158203892335647,
1858
+ top: 0.675258950202986
1859
+ },
1860
+ atlasBounds: {
1861
+ left: 418.5,
1862
+ bottom: 54.5,
1863
+ right: 438.5,
1864
+ top: 96.5
1865
+ }
1866
+ },
1867
+ {
1868
+ unicode: 117,
1869
+ advance: 0.55126953125,
1870
+ planeBounds: {
1871
+ left: 0.048117572190937666,
1872
+ bottom: -0.034069958502488215,
1873
+ right: 0.5007105528090624,
1874
+ top: 0.5526246460024882
1875
+ },
1876
+ atlasBounds: {
1877
+ left: 88.5,
1878
+ bottom: 15.5,
1879
+ right: 115.5,
1880
+ top: 50.5
1881
+ }
1882
+ },
1883
+ {
1884
+ unicode: 118,
1885
+ advance: 0.484375,
1886
+ planeBounds: {
1887
+ left: -0.002092396419918806,
1888
+ bottom: -0.02080579450955998,
1889
+ right: 0.4840259901699188,
1890
+ top: 0.5491261070095601
1891
+ },
1892
+ atlasBounds: {
1893
+ left: 331.5,
1894
+ bottom: 16.5,
1895
+ right: 360.5,
1896
+ top: 50.5
1897
+ }
1898
+ },
1899
+ {
1900
+ unicode: 119,
1901
+ advance: 0.75146484375,
1902
+ planeBounds: {
1903
+ left: -0.002649098431770561,
1904
+ bottom: -0.02080579450955998,
1905
+ right: 0.7516725359317705,
1906
+ top: 0.5491261070095601
1907
+ },
1908
+ atlasBounds: {
1909
+ left: 225.5,
1910
+ bottom: 16.5,
1911
+ right: 270.5,
1912
+ top: 50.5
1913
+ }
1914
+ },
1915
+ {
1916
+ unicode: 120,
1917
+ advance: 0.49560546875,
1918
+ planeBounds: {
1919
+ left: -0.0046143729128470395,
1920
+ bottom: -0.02080579450955998,
1921
+ right: 0.4982667166628471,
1922
+ top: 0.5491261070095601
1923
+ },
1924
+ atlasBounds: {
1925
+ left: 300.5,
1926
+ bottom: 16.5,
1927
+ right: 330.5,
1928
+ top: 50.5
1929
+ }
1930
+ },
1931
+ {
1932
+ unicode: 121,
1933
+ advance: 0.47314453125,
1934
+ planeBounds: {
1935
+ left: -0.007219349544918806,
1936
+ bottom: -0.23645281704262702,
1937
+ right: 0.4788990370449188,
1938
+ top: 0.551394223292627
1939
+ },
1940
+ atlasBounds: {
1941
+ left: 387.5,
1942
+ bottom: 208.5,
1943
+ right: 416.5,
1944
+ top: 255.5
1945
+ }
1946
+ },
1947
+ {
1948
+ unicode: 122,
1949
+ advance: 0.49560546875,
1950
+ planeBounds: {
1951
+ left: 0.018007705073009427,
1952
+ bottom: -0.02080579450955998,
1953
+ right: 0.4873633886769906,
1954
+ top: 0.5491261070095601
1955
+ },
1956
+ atlasBounds: {
1957
+ left: 271.5,
1958
+ bottom: 16.5,
1959
+ right: 299.5,
1960
+ top: 50.5
1961
+ }
1962
+ },
1963
+ {
1964
+ unicode: 123,
1965
+ advance: 0.33837890625,
1966
+ planeBounds: {
1967
+ left: 0.011572188891435306,
1968
+ bottom: -0.20234398020069408,
1969
+ right: 0.3468262486085647,
1970
+ top: 0.8034181989506942
1971
+ },
1972
+ atlasBounds: {
1973
+ left: 73.5,
1974
+ bottom: 195.5,
1975
+ right: 93.5,
1976
+ top: 255.5
1977
+ }
1978
+ },
1979
+ {
1980
+ unicode: 124,
1981
+ advance: 0.24365234375,
1982
+ planeBounds: {
1983
+ left: 0.06315671142450235,
1984
+ bottom: -0.15466084787519643,
1985
+ right: 0.18049563232549765,
1986
+ top: 0.7337624103751964
1987
+ },
1988
+ atlasBounds: {
1989
+ left: 206.5,
1990
+ bottom: 202.5,
1991
+ right: 213.5,
1992
+ top: 255.5
1993
+ }
1994
+ },
1995
+ {
1996
+ unicode: 125,
1997
+ advance: 0.33837890625,
1998
+ planeBounds: {
1999
+ left: -0.010156326733564695,
2000
+ bottom: -0.20234398020069408,
2001
+ right: 0.3250977329835647,
2002
+ top: 0.8034181989506942
2003
+ },
2004
+ atlasBounds: {
2005
+ left: 38.5,
2006
+ bottom: 195.5,
2007
+ right: 58.5,
2008
+ top: 255.5
2009
+ }
2010
+ },
2011
+ {
2012
+ unicode: 126,
2013
+ advance: 0.68017578125,
2014
+ planeBounds: {
2015
+ left: 0.046984728997511785,
2016
+ bottom: 0.1766063915990047,
2017
+ right: 0.6336793335024882,
2018
+ top: 0.4112842334009953
2019
+ },
2020
+ atlasBounds: {
2021
+ left: 0.5,
2022
+ bottom: 0.5,
2023
+ right: 35.5,
2024
+ top: 14.5
2025
+ }
2026
+ }
2027
+ ];
2028
+ var kerning = [
2029
+ ];
2030
+ var defaultFontMetrics = {
2031
+ atlas: atlas,
2032
+ metrics: metrics,
2033
+ glyphs: glyphs,
2034
+ kerning: kerning
2035
+ };
2036
+
2037
+ /**
2038
+ * Enum for supported image types (e.g. NII, NRRD, DICOM)
2039
+ */
2040
+ declare enum ImageType {
2041
+ UNKNOWN = 0,
2042
+ NII = 1,
2043
+ DCM = 2,
2044
+ DCM_MANIFEST = 3,
2045
+ MIH = 4,
2046
+ MIF = 5,
2047
+ NHDR = 6,
2048
+ NRRD = 7,
2049
+ MHD = 8,
2050
+ MHA = 9,
2051
+ MGH = 10,
2052
+ MGZ = 11,
2053
+ V = 12,
2054
+ V16 = 13,
2055
+ VMR = 14,
2056
+ HEAD = 15,
2057
+ DCM_FOLDER = 16
2058
+ }
2059
+ type ImageFromUrlOptions = {
2060
+ url: string;
2061
+ urlImageData?: string;
2062
+ headers?: Record<string, string>;
2063
+ name?: string;
2064
+ colorMap?: string;
2065
+ colormap?: string;
2066
+ opacity?: number;
2067
+ cal_min?: number;
2068
+ cal_max?: number;
2069
+ trustCalMinMax?: boolean;
2070
+ percentileFrac?: number;
2071
+ visible?: boolean;
2072
+ useQFormNotSForm?: boolean;
2073
+ alphaThreshold?: boolean;
2074
+ colormapNegative?: string;
2075
+ cal_minNeg?: number;
2076
+ cal_maxNeg?: number;
2077
+ colorbarVisible?: boolean;
2078
+ ignoreZeroVoxels?: boolean;
2079
+ imageType?: ImageType;
2080
+ frame4D?: number;
2081
+ colormapLabel?: string[];
2082
+ pairedImgData?: null;
2083
+ limitFrames4D?: number;
2084
+ isManifest?: boolean;
2085
+ urlImgData?: string;
2086
+ };
2087
+ type ImageFromFileOptions = {
2088
+ file: File | File[];
2089
+ name?: string;
2090
+ colormap?: string;
2091
+ opacity?: number;
2092
+ urlImgData?: File | null;
2093
+ cal_min?: number;
2094
+ cal_max?: number;
2095
+ trustCalMinMax?: boolean;
2096
+ percentileFrac?: number;
2097
+ ignoreZeroVoxels?: boolean;
2098
+ visible?: boolean;
2099
+ useQFormNotSForm?: boolean;
2100
+ colormapNegative?: string;
2101
+ imageType?: ImageType;
2102
+ frame4D?: number;
2103
+ limitFrames4D?: number;
2104
+ };
2105
+ type ImageFromBase64 = {
2106
+ base64: string;
2107
+ name?: string;
2108
+ colormap?: string;
2109
+ opacity?: number;
2110
+ cal_min?: number;
2111
+ cal_max?: number;
2112
+ trustCalMinMax?: boolean;
2113
+ percentileFrac?: number;
2114
+ ignoreZeroVoxels?: boolean;
2115
+ visible?: boolean;
2116
+ };
2117
+ type ImageMetadata = {
2118
+ id: string;
2119
+ datatypeCode: number;
2120
+ nx: number;
2121
+ ny: number;
2122
+ nz: number;
2123
+ nt: number;
2124
+ dx: number;
2125
+ dy: number;
2126
+ dz: number;
2127
+ dt: number;
2128
+ bpv: number;
2129
+ };
2130
+ 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, visible?: boolean, useQFormNotSForm?: boolean, colormapNegative?: string, frame4D?: number, imageType?: ImageType, cal_minNeg?: number, cal_maxNeg?: number, colorbarVisible?: boolean, alphaThreshold?: boolean, colormapLabel?: string[]) => ImageFromUrlOptions;
2131
+
2132
+ /**
2133
+ * a NVImage encapsulates some images data and provides methods to query and operate on images
2134
+ */
2135
+ declare class NVImage {
2136
+ name: string;
2137
+ id: string;
2138
+ url?: string;
2139
+ headers?: Record<string, string>;
2140
+ _colormap: string;
2141
+ _opacity: number;
2142
+ percentileFrac: number;
2143
+ ignoreZeroVoxels: boolean;
2144
+ trustCalMinMax: boolean;
2145
+ colormapNegative: string;
2146
+ colorMapNegative: string;
2147
+ colormapLabel: LUT | null;
2148
+ colormapInvert?: boolean;
2149
+ nFrame4D?: number;
2150
+ frame4D: number;
2151
+ nTotalFrame4D?: number;
2152
+ cal_minNeg: number;
2153
+ cal_maxNeg: number;
2154
+ colorbarVisible: boolean;
2155
+ visible: boolean;
2156
+ modulationImage: number | null;
2157
+ modulateAlpha: number;
2158
+ series: any;
2159
+ nVox3D?: number;
2160
+ oblique_angle?: number;
2161
+ maxShearDeg?: number;
2162
+ useQFormNotSForm: boolean;
2163
+ alphaThreshold?: number;
2164
+ pixDims?: number[];
2165
+ matRAS?: mat4;
2166
+ pixDimsRAS?: number[];
2167
+ obliqueRAS?: mat4;
2168
+ dimsRAS?: number[];
2169
+ permRAS?: number[];
2170
+ toRAS?: mat4;
2171
+ toRASvox?: mat4;
2172
+ frac2mm?: mat4;
2173
+ frac2mmOrtho?: mat4;
2174
+ extentsMinOrtho?: number[];
2175
+ extentsMaxOrtho?: number[];
2176
+ mm2ortho?: mat4;
2177
+ hdr: nifti.NIFTI1 | nifti.NIFTI2 | null;
2178
+ imageType?: ImageType;
2179
+ img?: Uint8Array | Int16Array | Float32Array | Float64Array | Uint16Array;
2180
+ imaginary?: Float32Array;
2181
+ fileObject?: File | File[];
2182
+ dims?: number[];
2183
+ onColormapChange: (img: NVImage) => void;
2184
+ onOpacityChange: (img: NVImage) => void;
2185
+ mm000?: vec3;
2186
+ mm100?: vec3;
2187
+ mm010?: vec3;
2188
+ mm001?: vec3;
2189
+ cal_min?: number;
2190
+ cal_max?: number;
2191
+ robust_min?: number;
2192
+ robust_max?: number;
2193
+ global_min?: number;
2194
+ global_max?: number;
2195
+ urlImgData?: string;
2196
+ isManifest?: boolean;
2197
+ limitFrames4D?: number;
2198
+ DT_NONE: number;
2199
+ DT_UNKNOWN: number;
2200
+ DT_BINARY: number;
2201
+ DT_UNSIGNED_CHAR: number;
2202
+ DT_SIGNED_SHORT: number;
2203
+ DT_SIGNED_INT: number;
2204
+ DT_FLOAT: number;
2205
+ DT_COMPLEX: number;
2206
+ DT_DOUBLE: number;
2207
+ DT_RGB: number;
2208
+ DT_ALL: number;
2209
+ DT_INT8: number;
2210
+ DT_UINT16: number;
2211
+ DT_UINT32: number;
2212
+ DT_INT64: number;
2213
+ DT_UINT64: number;
2214
+ DT_FLOAT128: number;
2215
+ DT_COMPLEX128: number;
2216
+ DT_COMPLEX256: number;
2217
+ DT_RGBA32: number;
2218
+ /**
2219
+ *
2220
+ * @param dataBuffer - an array buffer of image data to load (there are also methods that abstract this more. See loadFromUrl, and loadFromFile)
2221
+ * @param name - a name for this image. Default is an empty string
2222
+ * @param colormap - a color map to use. default is gray
2223
+ * @param opacity - the opacity for this image. default is 1
2224
+ * @param pairedImgData - Allows loading formats where header and image are separate files (e.g. nifti.hdr, nifti.img)
2225
+ * @param cal_min - minimum intensity for color brightness/contrast
2226
+ * @param cal_max - maximum intensity for color brightness/contrast
2227
+ * @param trustCalMinMax - whether or not to trust cal_min and cal_max from the nifti header (trusting results in faster loading)
2228
+ * @param percentileFrac - the percentile to use for setting the robust range of the display values (smart intensity setting for images with large ranges)
2229
+ * @param ignoreZeroVoxels - whether or not to ignore zero voxels in setting the robust range of display values
2230
+ * @param visible - whether or not this image is to be visible
2231
+ * @param useQFormNotSForm - give precedence to QForm (Quaternion) or SForm (Matrix)
2232
+ * @param colormapNegative - a color map to use for symmetrical negative intensities
2233
+ * @param frame4D - volume displayed, 0 indexed, must be less than nFrame4D
2234
+ *
2235
+ * FIXME the following params are documented but not included in the actual constructor
2236
+ * @param onColormapChange - callback for color map change
2237
+ * @param onOpacityChange -callback for color map change
2238
+ *
2239
+ * TODO the following parameters were not documented
2240
+ * @param imageType - TODO
2241
+ * @param cal_minNeg - TODO
2242
+ * @param cal_maxNeg - TODO
2243
+ * @param colorbarVisible - TODO
2244
+ * @param colormapLabel - TODO
2245
+ */
2246
+ 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, visible?: boolean, useQFormNotSForm?: boolean, colormapNegative?: string, frame4D?: number, imageType?: ImageType, cal_minNeg?: number, cal_maxNeg?: number, colorbarVisible?: boolean, colormapLabel?: LUT | null);
2247
+ computeObliqueAngle(mtx44: mat4): number;
2248
+ calculateOblique(): void;
2249
+ THD_daxes_to_NIFTI(xyzDelta: number[], xyzOrigin: number[], orientSpecific: number[]): void;
2250
+ SetPixDimFromSForm(): void;
2251
+ readDICOM(buf: ArrayBuffer | ArrayBuffer[]): ArrayBuffer;
2252
+ readECAT(buffer: ArrayBuffer): ArrayBuffer;
2253
+ readV16(buffer: ArrayBuffer): ArrayBuffer;
2254
+ readVMR(buffer: ArrayBuffer): ArrayBuffer;
2255
+ readMGH(buffer: ArrayBuffer): ArrayBuffer;
2256
+ readHEAD(dataBuffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
2257
+ readMHA(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
2258
+ readMIF(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
2259
+ readNRRD(dataBuffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
2260
+ calculateRAS(): void;
2261
+ img2RAS(): Float32Array | Uint8Array | Int16Array | Float64Array | Uint16Array;
2262
+ vox2mm(XYZ: number[], mtx: mat4): vec3;
2263
+ mm2vox(mm: number[], frac?: boolean): Float32Array | vec3;
2264
+ arrayEquals(a: unknown[], b: unknown[]): boolean;
2265
+ setColormap(cm: string): void;
2266
+ setColormapLabel(cm: ColorMap): void;
2267
+ setColormapLabelFromUrl(url: string): Promise<void>;
2268
+ get colormap(): string;
2269
+ get colorMap(): string;
2270
+ set colormap(cm: string);
2271
+ set colorMap(cm: string);
2272
+ get opacity(): number;
2273
+ set opacity(opacity: number);
2274
+ calMinMax(): number[];
2275
+ intensityRaw2Scaled(raw: number): number;
2276
+ intensityScaled2Raw(scaled: number): number;
2277
+ saveToUint8Array(fnm: string, drawing8?: Uint8Array | null): Uint8Array;
2278
+ saveToDisk(fnm: string, drawing8?: Uint8Array | null): Uint8Array;
2279
+ static fetchDicomData(url: string, headers?: Record<string, string>): Promise<ArrayBuffer[]>;
2280
+ static fetchPartial(url: string, bytesToLoad: number, headers?: Record<string, string>): Promise<Response>;
2281
+ /**
2282
+ * factory function to load and return a new NVImage instance from a given URL
2283
+ * @returns NVImage instance
2284
+ */
2285
+ static loadFromUrl({ url, urlImgData, headers, name, colormap, opacity, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels, visible, useQFormNotSForm, colormapNegative, frame4D, isManifest, limitFrames4D, imageType }?: Partial<Omit<ImageFromUrlOptions, 'url'>> & {
2286
+ url?: string | Uint8Array | ArrayBuffer;
2287
+ }): Promise<NVImage>;
2288
+ static readFileAsync(file: File, bytesToLoad?: number): Promise<ArrayBuffer>;
2289
+ /**
2290
+ * factory function to load and return a new NVImage instance from a file in the browser
2291
+ */
2292
+ static loadFromFile({ file, // file can be an array of file objects or a single file object
2293
+ name, colormap, opacity, urlImgData, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels, visible, useQFormNotSForm, colormapNegative, frame4D, limitFrames4D, imageType }: ImageFromFileOptions): Promise<NVImage>;
2294
+ /**
2295
+ * factory function to load and return a new NVImage instance from a base64 encoded string
2296
+ *
2297
+ * @returns NVImage instance
2298
+ * @example
2299
+ * myImage = NVImage.loadFromBase64('SomeBase64String')
2300
+ */
2301
+ static loadFromBase64({ base64, name, colormap, opacity, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels, visible }: ImageFromBase64): NVImage;
2302
+ /**
2303
+ * make a clone of a NVImage instance and return a new NVImage
2304
+ * @returns NVImage instance
2305
+ * @example
2306
+ * myImage = NVImage.loadFromFile(SomeFileObject) // files can be from dialogs or drag and drop
2307
+ * clonedImage = myImage.clone()
2308
+ */
2309
+ clone(): NVImage;
2310
+ /**
2311
+ * fill a NVImage instance with zeros for the image data
2312
+ * @example
2313
+ * myImage = NVImage.loadFromFile(SomeFileObject) // files can be from dialogs or drag and drop
2314
+ * clonedImageWithZeros = myImage.clone().zeroImage()
2315
+ */
2316
+ zeroImage(): void;
2317
+ /**
2318
+ * get nifti specific metadata about the image
2319
+ */
2320
+ getImageMetadata(): ImageMetadata;
2321
+ /**
2322
+ * a factory function to make a zero filled image given a NVImage as a reference
2323
+ * @param nvImage - an existing NVImage as a reference
2324
+ * @param dataType - the output data type. Options: 'same', 'uint8'
2325
+ * @returns new NVImage filled with zeros for the image data
2326
+ * @example
2327
+ * myImage = NVImage.loadFromFile(SomeFileObject) // files can be from dialogs or drag and drop
2328
+ * newZeroImage = NVImage.zerosLike(myImage)
2329
+ */
2330
+ static zerosLike(nvImage: NVImage, dataType?: string): NVImage;
2331
+ getValue(x: number, y: number, z: number, frame4D?: number, isReadImaginary?: boolean): number;
2332
+ /**
2333
+ * @param id - id of 3D Object (is this the base volume or an overlay?)
2334
+ * @param gl - WebGL rendering context
2335
+ * @returns new 3D object in model space
2336
+ */
2337
+ toNiivueObject3D(id: number, gl: WebGL2RenderingContext): NiivueObject3D;
2338
+ /**
2339
+ * Update options for image
2340
+ */
2341
+ applyOptionsUpdate(options: ImageFromUrlOptions): void;
2342
+ getImageOptions(): ImageFromUrlOptions;
2343
+ /**
2344
+ * Converts NVImage to NIfTI compliant byte array
2345
+ */
2346
+ toUint8Array(drawingBytes?: Uint8Array | null): Uint8Array;
2347
+ }
2348
+
2349
+ type FreeSurferConnectome = {
2350
+ data_type: string;
2351
+ points: Array<{
2352
+ comments?: Array<{
2353
+ text: string;
2354
+ }>;
2355
+ coordinates: {
2356
+ x: number;
2357
+ y: number;
2358
+ z: number;
2359
+ };
2360
+ }>;
2361
+ };
2362
+ /**
2363
+ * Represents a connectome
2364
+ */
2365
+ declare class NVConnectome extends NVMesh {
2366
+ gl: WebGL2RenderingContext;
2367
+ nodesChanged: EventTarget;
2368
+ legendLineThickness?: number;
2369
+ constructor(gl: WebGL2RenderingContext, connectome: LegacyConnectome);
2370
+ static convertLegacyConnectome(json: LegacyConnectome): Connectome;
2371
+ static convertFreeSurferConnectome(json: FreeSurferConnectome, colormap?: string): Connectome;
2372
+ updateLabels(): void;
2373
+ addConnectomeNode(node: NVConnectomeNode): void;
2374
+ deleteConnectomeNode(node: NVConnectomeNode): void;
2375
+ updateConnectomeNodeByIndex(index: number, updatedNode: NVConnectomeNode): void;
2376
+ updateConnectomeNodeByPoint(point: [number, number, number], updatedNode: NVConnectomeNode): void;
2377
+ addConnectomeEdge(first: number, second: number, colorValue: number): NVConnectomeEdge;
2378
+ deleteConnectomeEdge(first: number, second: number): NVConnectomeEdge;
2379
+ findClosestConnectomeNode(point: number[], distance: number): NVConnectomeNode | null;
2380
+ updateConnectome(gl: WebGL2RenderingContext): void;
2381
+ updateMesh(gl: WebGL2RenderingContext): void;
2382
+ json(): Connectome;
2383
+ /**
2384
+ * Factory method to create connectome from options
2385
+ */
2386
+ static loadConnectomeFromUrl(gl: WebGL2RenderingContext, url: string): Promise<NVConnectome>;
2387
+ }
2388
+
2389
+ /**
2390
+ * Slice Type
2391
+ */
2392
+ declare enum SLICE_TYPE {
2393
+ AXIAL = 0,
2394
+ CORONAL = 1,
2395
+ SAGITTAL = 2,
2396
+ MULTIPLANAR = 3,
2397
+ RENDER = 4
2398
+ }
2399
+ /**
2400
+ * Multi-planar layout
2401
+ */
2402
+ declare enum MULTIPLANAR_TYPE {
2403
+ AUTO = 0,
2404
+ COLUMN = 1,
2405
+ GRID = 2,
2406
+ ROW = 3
2407
+ }
2408
+ declare enum DRAG_MODE {
2409
+ none = 0,
2410
+ contrast = 1,
2411
+ measurement = 2,
2412
+ pan = 3,
2413
+ slicer3D = 4,
2414
+ callbackOnly = 5
2415
+ }
2416
+ type NVConfigOptions = {
2417
+ textHeight: number;
2418
+ colorbarHeight: number;
2419
+ crosshairWidth: number;
2420
+ rulerWidth: number;
2421
+ show3Dcrosshair: boolean;
2422
+ backColor: number[];
2423
+ crosshairColor: number[];
2424
+ fontColor: number[];
2425
+ selectionBoxColor: number[];
2426
+ clipPlaneColor: number[];
2427
+ rulerColor: number[];
2428
+ colorbarMargin: number;
2429
+ trustCalMinMax: boolean;
2430
+ clipPlaneHotKey: string;
2431
+ viewModeHotKey: string;
2432
+ doubleTouchTimeout: number;
2433
+ longTouchTimeout: number;
2434
+ keyDebounceTime: number;
2435
+ isNearestInterpolation: boolean;
2436
+ isAtlasOutline: boolean;
2437
+ isRuler: boolean;
2438
+ isColorbar: boolean;
2439
+ isOrientCube: boolean;
2440
+ multiplanarPadPixels: number;
2441
+ multiplanarForceRender: boolean;
2442
+ isRadiologicalConvention: boolean;
2443
+ meshThicknessOn2D: number | string;
2444
+ dragMode: DRAG_MODE;
2445
+ isDepthPickMesh: boolean;
2446
+ isCornerOrientationText: boolean;
2447
+ sagittalNoseLeft: boolean;
2448
+ isSliceMM: boolean;
2449
+ isHighResolutionCapable: boolean;
2450
+ logging: boolean;
2451
+ loadingText: string;
2452
+ dragAndDropEnabled: boolean;
2453
+ drawingEnabled: boolean;
2454
+ penValue: number;
2455
+ floodFillNeighbors: number;
2456
+ isFilledPen: boolean;
2457
+ thumbnail: string;
2458
+ maxDrawUndoBitmaps: number;
2459
+ sliceType: SLICE_TYPE;
2460
+ isAntiAlias: boolean | null;
2461
+ isAdditiveBlend: boolean;
2462
+ isResizeCanvas: boolean;
2463
+ meshXRay: number;
2464
+ limitFrames4D: number;
2465
+ showLegend: boolean;
2466
+ legendBackgroundColor: number[];
2467
+ legendTextColor: number[];
2468
+ multiplanarLayout: MULTIPLANAR_TYPE;
2469
+ renderOverlayBlend: number;
2470
+ };
2471
+ type SceneData = {
2472
+ azimuth: number;
2473
+ elevation: number;
2474
+ crosshairPos: vec3;
2475
+ clipPlane: number[];
2476
+ clipPlaneDepthAziElev: number[];
2477
+ volScaleMultiplier: number;
2478
+ pan2Dxyzmm: vec4;
2479
+ };
2480
+ type Scene = {
2481
+ onAzimuthElevationChange: (azimuth: number, elevation: number) => void;
2482
+ onZoom3DChange: (scale: number) => void;
2483
+ sceneData: SceneData;
2484
+ renderAzimuth: number;
2485
+ renderElevation: number;
2486
+ volScaleMultiplier: number;
2487
+ crosshairPos: vec3;
2488
+ clipPlane: number[];
2489
+ clipPlaneDepthAziElev: number[];
2490
+ pan2Dxyzmm: vec4;
2491
+ _elevation?: number;
2492
+ _azimuth?: number;
2493
+ };
2494
+ type DocumentData = {
2495
+ title: string;
2496
+ imageOptionsArray: ImageFromUrlOptions[];
2497
+ meshOptionsArray: unknown[];
2498
+ opts: NVConfigOptions;
2499
+ previewImageDataURL: string;
2500
+ labels: NVLabel3D[];
2501
+ encodedImageBlobs: string[];
2502
+ encodedDrawingBlob: string;
2503
+ meshesString?: string;
2504
+ sceneData?: SceneData;
2505
+ connectomes?: string[];
2506
+ };
2507
+ type ExportDocumentData = {
2508
+ encodedImageBlobs: string[];
2509
+ encodedDrawingBlob: string;
2510
+ previewImageDataURL: string;
2511
+ imageOptionsMap: Map<string, number>;
2512
+ imageOptionsArray: ImageFromUrlOptions[];
2513
+ sceneData: Partial<SceneData>;
2514
+ opts: NVConfigOptions;
2515
+ meshesString: string;
2516
+ labels: NVLabel3D[];
2517
+ connectomes: string[];
2518
+ };
2519
+ /**
2520
+ * Creates and instance of NVDocument
2521
+ */
2522
+ declare class NVDocument {
2523
+ data: DocumentData;
2524
+ scene: Scene;
2525
+ volumes: NVImage[];
2526
+ meshDataObjects?: Array<NVMesh | NVConnectome>;
2527
+ meshes: Array<NVMesh | NVConnectome>;
2528
+ drawBitmap: Uint8Array | null;
2529
+ imageOptionsMap: Map<any, any>;
2530
+ meshOptionsMap: Map<any, any>;
2531
+ constructor();
2532
+ /**
2533
+ * Title of the document
2534
+ */
2535
+ get title(): string;
2536
+ /**
2537
+ * Gets preview image blob
2538
+ * @returns dataURL of preview image
2539
+ */
2540
+ get previewImageDataURL(): string;
2541
+ /**
2542
+ * Sets preview image blob
2543
+ * @param dataURL - encoded preview image
2544
+ */
2545
+ set previewImageDataURL(dataURL: string);
2546
+ /**
2547
+ * @param title - title of document
2548
+ */
2549
+ set title(title: string);
2550
+ get imageOptionsArray(): ImageFromUrlOptions[];
2551
+ /**
2552
+ * Gets the base 64 encoded blobs of associated images
2553
+ */
2554
+ get encodedImageBlobs(): string[];
2555
+ /**
2556
+ * Gets the base 64 encoded blob of the associated drawing
2557
+ * TODO the return type was marked as string[] here, was that an error?
2558
+ */
2559
+ get encodedDrawingBlob(): string;
2560
+ /**
2561
+ * Gets the options of the {@link Niivue} instance
2562
+ */
2563
+ get opts(): NVConfigOptions;
2564
+ /**
2565
+ * Sets the options of the {@link Niivue} instance
2566
+ */
2567
+ set opts(opts: NVConfigOptions);
2568
+ /**
2569
+ * Gets the 3D labels of the {@link Niivue} instance
2570
+ */
2571
+ get labels(): NVLabel3D[];
2572
+ /**
2573
+ * Sets the 3D labels of the {@link Niivue} instance
2574
+ */
2575
+ set labels(labels: NVLabel3D[]);
2576
+ /**
2577
+ * Checks if document has an image by id
2578
+ */
2579
+ hasImage(image: NVImage): boolean;
2580
+ /**
2581
+ * Checks if document has an image by url
2582
+ */
2583
+ hasImageFromUrl(url: string): boolean;
2584
+ /**
2585
+ * Adds an image and the options an image was created with
2586
+ */
2587
+ addImageOptions(image: NVImage, imageOptions: ImageFromUrlOptions): void;
2588
+ /**
2589
+ * Removes image from the document as well as its options
2590
+ */
2591
+ removeImage(image: NVImage): void;
2592
+ /**
2593
+ * Returns the options for the image if it was added by url
2594
+ */
2595
+ getImageOptions(image: NVImage): ImageFromUrlOptions | null;
2596
+ /**
2597
+ * Converts NVDocument to JSON
2598
+ */
2599
+ json(): ExportDocumentData;
2600
+ /**
2601
+ * Downloads a JSON file with options, scene, images, meshes and drawing of {@link Niivue} instance
2602
+ */
2603
+ download(fileName: string): void;
2604
+ /**
2605
+ * Deserialize mesh data objects
2606
+ */
2607
+ static deserializeMeshDataObjects(document: NVDocument): void;
2608
+ /**
2609
+ * Factory method to return an instance of NVDocument from a URL
2610
+ */
2611
+ static loadFromUrl(url: string): Promise<NVDocument>;
2612
+ /**
2613
+ * Factory method to return an instance of NVDocument from a File object
2614
+ */
2615
+ static loadFromFile(file: Blob): Promise<NVDocument>;
2616
+ /**
2617
+ * Factory method to return an instance of NVDocument from JSON
2618
+ */
2619
+ static loadFromJSON(data: DocumentData): NVDocument;
2620
+ }
2621
+
2622
+ /**
2623
+ * Enum for sync operations
2624
+ */
2625
+ declare enum NVMESSAGE {
2626
+ ZOOM = 1,// "zoom",
2627
+ CLIP_PLANE = 2,// "clipPlane",
2628
+ AZIMUTH_ELEVATION = 3,// "ae",
2629
+ FRAME_CHANGED = 4,// "frame changed",
2630
+ VOLUME_ADDED_FROM_URL = 5,// "volume added from url",
2631
+ VOLUME_WITH_URL_REMOVED = 6,// "volume with url removed",
2632
+ COLORMAP_CHANGED = 7,// "color map has changed",
2633
+ OPACITY_CHANGED = 8,// "opacity has changed",
2634
+ MESH_FROM_URL_ADDED = 9,// "mesh added from url",
2635
+ MESH_WITH_URL_REMOVED = 10,// "mesh with url removed",
2636
+ CUSTOM_SHADER_ADDED = 11,// "custom shader added",
2637
+ SHADER_CHANGED = 12,// "mesh shader changed",
2638
+ MESH_PROPERTY_CHANGED = 13,// "mesh property changed",
2639
+ USER_JOINED = "user joined",// TODO this breaks the scheme a bit -- see session-bus::localStorageEventListener
2640
+ CREATE = "create",// TODO same as above
2641
+ VOLUME_LOADED_FROM_URL = "volume with url added"
2642
+ }
2643
+ type Message = {
2644
+ userKey?: string;
2645
+ from?: string;
2646
+ } & ({
2647
+ op: NVMESSAGE.ZOOM;
2648
+ zoom: number;
2649
+ } | {
2650
+ op: NVMESSAGE.CLIP_PLANE;
2651
+ clipPlane: number[];
2652
+ } | {
2653
+ op: NVMESSAGE.AZIMUTH_ELEVATION;
2654
+ elevation: number;
2655
+ azimuth: number;
2656
+ } | {
2657
+ op: NVMESSAGE.FRAME_CHANGED;
2658
+ url: string;
2659
+ index: number;
2660
+ } | {
2661
+ op: NVMESSAGE.VOLUME_ADDED_FROM_URL;
2662
+ imageOptions: any;
2663
+ } | {
2664
+ op: NVMESSAGE.VOLUME_LOADED_FROM_URL;
2665
+ url: string;
2666
+ } | {
2667
+ op: NVMESSAGE.VOLUME_WITH_URL_REMOVED;
2668
+ url: string;
2669
+ } | {
2670
+ op: NVMESSAGE.COLORMAP_CHANGED;
2671
+ url: string;
2672
+ colormap: string;
2673
+ } | {
2674
+ op: NVMESSAGE.OPACITY_CHANGED;
2675
+ url: string;
2676
+ opacity: number;
2677
+ } | {
2678
+ op: NVMESSAGE.MESH_FROM_URL_ADDED;
2679
+ meshOptions: LoadFromUrlParams;
2680
+ } | {
2681
+ op: NVMESSAGE.MESH_WITH_URL_REMOVED;
2682
+ url: string;
2683
+ } | {
2684
+ op: NVMESSAGE.CUSTOM_SHADER_ADDED;
2685
+ fragmentShaderText: string;
2686
+ name: string;
2687
+ } | {
2688
+ op: NVMESSAGE.SHADER_CHANGED;
2689
+ meshIndex: number;
2690
+ shaderIndex: number;
2691
+ } | {
2692
+ op: NVMESSAGE.MESH_PROPERTY_CHANGED;
2693
+ meshIndex: number;
2694
+ key: string;
2695
+ val: unknown;
2696
+ } | {
2697
+ op: NVMESSAGE.USER_JOINED;
2698
+ user: SessionUser;
2699
+ } | {
2700
+ op: NVMESSAGE.CREATE;
2701
+ key: string;
2702
+ });
2703
+
2704
+ /**
2705
+ * SessionUser specifies display name, user id and user key
2706
+ * @param userKey - Used to protect user properties
2707
+ */
2708
+ declare class SessionUser {
2709
+ id: string;
2710
+ displayName: string;
2711
+ key: string;
2712
+ properties: Map<string, string>;
2713
+ constructor(displayName?: string, userId?: string, userKey?: string, userProperties?: Map<string, string>);
2714
+ }
2715
+ /**
2716
+ * SessionBus is for synchronizing both remote and local instances
2717
+ */
2718
+ declare class SessionBus {
2719
+ userList: SessionUser[];
2720
+ user: SessionUser;
2721
+ userQueueName?: string;
2722
+ userListName?: string;
2723
+ onMessageCallback: (newMessage: Message) => void;
2724
+ isConnectedToServer: boolean;
2725
+ isController: boolean;
2726
+ sessionScene: {};
2727
+ sessionKey: string;
2728
+ sessionName: string;
2729
+ sessionSceneName: string;
2730
+ serverConnection$: WebSocketSubject<Message> | null;
2731
+ constructor(name: string, user: SessionUser, onMessageCallback: (newMessage: Message) => void, serverURL?: string, sessionKey?: string);
2732
+ sendSessionMessage(message: Message): void;
2733
+ connectToServer(serverURL: string, sessionName: string): void;
2734
+ subscribeToServer(): void;
2735
+ sendLocalMessage(message: Message): void;
2736
+ localStorageEventListener(e: StorageEvent): void;
2737
+ }
2738
+
2739
+ /**
2740
+ * NVController is for synchronizing both remote and local instances of Niivue
2741
+ */
2742
+ declare class NVController {
2743
+ niivue: Niivue;
2744
+ mediaUrlMap: Map<string, unknown>;
2745
+ isInSession: boolean;
2746
+ user?: SessionUser;
2747
+ sessionBus?: SessionBus;
2748
+ onFrameChange: (_volume: NVImage, _index: number) => void;
2749
+ /**
2750
+ * @param niivue - niivue object to control
2751
+ */
2752
+ constructor(niivue: Niivue);
2753
+ onLocationChangeHandler(location: unknown): void;
2754
+ addVolume(volume: NVImage, url: string): void;
2755
+ addMesh(mesh: NVMesh, url: string): void;
2756
+ onNewMessage(msg: Message): void;
2757
+ /**
2758
+ * Connects to existing session or creates new session
2759
+ */
2760
+ connectToSession(sessionName: string, user?: SessionUser, serverBaseUrl?: string, sessionKey?: string): void;
2761
+ /**
2762
+ * Zoom level has changed
2763
+ */
2764
+ onZoom3DChangeHandler(zoom: number): void;
2765
+ /**
2766
+ * Azimuth and/or elevation has changed
2767
+ */
2768
+ onAzimuthElevationChangeHandler(azimuth: number, elevation: number): void;
2769
+ /**
2770
+ * Clip plane has changed
2771
+ */
2772
+ onClipPlaneChangeHandler(clipPlane: number[]): void;
2773
+ /**
2774
+ * Add an image and notify subscribers
2775
+ */
2776
+ onVolumeAddedFromUrlHandler(imageOptions: ImageFromUrlOptions, volume: NVImage): void;
2777
+ /**
2778
+ * A volume has been added
2779
+ */
2780
+ onImageLoadedHandler(volume: NVImage): void;
2781
+ /**
2782
+ * Notifies other users that a volume has been removed
2783
+ */
2784
+ onVolumeWithUrlRemovedHandler(url: string): void;
2785
+ /**
2786
+ * Notifies that a mesh has been loaded by URL
2787
+ */
2788
+ onMeshAddedFromUrlHandler(meshOptions: LoadFromUrlParams): void;
2789
+ /**
2790
+ * Notifies that a mesh has been added
2791
+ */
2792
+ onMeshLoadedHandler(mesh: NVMesh): void;
2793
+ onMeshWithUrlRemovedHandler(url: string): void;
2794
+ /**
2795
+ *
2796
+ * @param volume - volume that has changed color maps
2797
+ */
2798
+ onColormapChangeHandler(volume: NVImage): void;
2799
+ /**
2800
+ * @param volume - volume that has changed opacity
2801
+ */
2802
+ onOpacityChangeHandler(volume: NVImage): void;
2803
+ /**
2804
+ * Frame for 4D image has changed
2805
+ */
2806
+ onFrameChangeHandler(volume: NVImage, index: number): void;
2807
+ /**
2808
+ * Custom mesh shader has been added
2809
+ * @param fragmentShaderText - shader code to be compiled
2810
+ * @param name - name of shader, can be used as index
2811
+ */
2812
+ onCustomMeshShaderAddedHandler(fragmentShaderText: string, name: string): void;
2813
+ /**
2814
+ * Mesh shader has changed
2815
+ * @param meshIndex - index of mesh
2816
+ * @param shaderIndex - index of shader
2817
+ */
2818
+ onMeshShaderChanged(meshIndex: number, shaderIndex: number): void;
2819
+ /**
2820
+ * Mesh property has been changed
2821
+ * @param meshIndex - index of mesh
2822
+ * @param key - property index
2823
+ * @param val - property value
2824
+ */
2825
+ onMeshPropertyChanged(meshIndex: number, key: string, val: unknown): void;
2826
+ }
2827
+
2828
+ /**
2829
+ * Namespace for utility functions
2830
+ */
2831
+ declare class NVUtilities {
2832
+ static arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
2833
+ static uint8tob64(bytes: Uint8Array): string;
2834
+ static download(content: string, fileName: string, contentType: string): void;
2835
+ static readFileAsync(file: Blob): Promise<ArrayBuffer>;
2836
+ static blobToBase64(blob: Blob): Promise<string>;
2837
+ static decompressBase64String(base64: string): string;
2838
+ static compressToBase64String(string: string): string;
2839
+ static arraysAreEqual(a: unknown[], b: unknown[]): boolean;
2840
+ /**
2841
+ * Generate a pre-filled number array.
2842
+ *
2843
+ * @param start - start value
2844
+ * @param stop - stop value
2845
+ * @param step - step value
2846
+ * @returns filled number array
2847
+ */
2848
+ static range(start: number, stop: number, step: number): number[];
2849
+ }
2850
+
2851
+ type DragReleaseParams = {
2852
+ fracStart: vec3;
2853
+ fracEnd: vec3;
2854
+ voxStart: vec3;
2855
+ voxEnd: vec3;
2856
+ mmStart: vec4;
2857
+ mmEnd: vec4;
2858
+ mmLength: number;
2859
+ tileIdx: number;
2860
+ axCorSag: SLICE_TYPE;
2861
+ };
2862
+ type FontMetrics = {
2863
+ distanceRange: number;
2864
+ size: number;
2865
+ mets: Record<number, {
2866
+ xadv: number;
2867
+ uv_lbwh: number[];
2868
+ lbwh: number[];
2869
+ }>;
2870
+ };
2871
+ type ColormapListEntry = {
2872
+ name: string;
2873
+ min: number;
2874
+ max: number;
2875
+ alphaThreshold: boolean;
2876
+ negative: boolean;
2877
+ visible: boolean;
2878
+ invert: boolean;
2879
+ };
2880
+ type Graph = {
2881
+ LTWH: number[];
2882
+ plotLTWH?: number[];
2883
+ opacity: number;
2884
+ vols: number[];
2885
+ autoSizeMultiplanar: boolean;
2886
+ normalizeValues: boolean;
2887
+ backColor?: number[];
2888
+ lineColor?: number[];
2889
+ textColor?: number[];
2890
+ lineThickness?: number;
2891
+ lineAlpha?: number;
2892
+ lines?: number[][];
2893
+ selectedColumn?: number;
2894
+ lineRGB?: number[][];
2895
+ };
2896
+ type Descriptive = {
2897
+ mean: number;
2898
+ stdev: number;
2899
+ nvox: number;
2900
+ volumeMM3: number;
2901
+ volumeML: number;
2902
+ min: number;
2903
+ max: number;
2904
+ meanNot0: number;
2905
+ stdevNot0: number;
2906
+ nvoxNot0: number;
2907
+ minNot0: number;
2908
+ maxNot0: number;
2909
+ cal_min: number;
2910
+ cal_max: number;
2911
+ robust_min: number;
2912
+ robust_max: number;
2913
+ };
2914
+ type SliceScale = {
2915
+ volScale: number[];
2916
+ vox: number[];
2917
+ longestAxis: number;
2918
+ dimsMM: vec3;
2919
+ };
2920
+ type MvpMatrix2D = {
2921
+ modelViewProjectionMatrix: mat4;
2922
+ modelMatrix: mat4;
2923
+ normalMatrix: mat4;
2924
+ leftTopMM: number[];
2925
+ fovMM: number[];
2926
+ };
2927
+ type MM = {
2928
+ mnMM: vec3;
2929
+ mxMM: vec3;
2930
+ rotation: mat4;
2931
+ fovMM: vec3;
2932
+ };
2933
+ /**
2934
+ * Niivue exposes many properties. It's always good to call `updateGLVolume` after altering one of these settings.
2935
+ */
2936
+ type NiiVueOptions = {
2937
+ textHeight?: number;
2938
+ colorbarHeight?: number;
2939
+ colorbarMargin?: number;
2940
+ crosshairWidth?: number;
2941
+ rulerWidth?: number;
2942
+ backColor?: number[];
2943
+ crosshairColor?: number[];
2944
+ fontColor?: number[];
2945
+ selectionBoxColor?: number[];
2946
+ clipPlaneColor?: number[];
2947
+ rulerColor?: number[];
2948
+ show3Dcrosshair?: boolean;
2949
+ trustCalMinMax?: boolean;
2950
+ clipPlaneHotKey?: string;
2951
+ viewModeHotKey?: string;
2952
+ keyDebounceTime?: number;
2953
+ doubleTouchTimeout?: number;
2954
+ longTouchTimeout?: number;
2955
+ isRadiologicalConvention?: boolean;
2956
+ logging?: boolean;
2957
+ loadingText?: string;
2958
+ dragAndDropEnabled?: boolean;
2959
+ isNearestInterpolation?: boolean;
2960
+ isAtlasOutline?: boolean;
2961
+ isRuler?: boolean;
2962
+ isColorbar?: boolean;
2963
+ isOrientCube?: boolean;
2964
+ multiplanarPadPixels?: number;
2965
+ multiplanarForceRender?: boolean;
2966
+ meshThicknessOn2D?: number;
2967
+ dragMode?: DRAG_MODE;
2968
+ isDepthPickMesh?: boolean;
2969
+ isCornerOrientationText?: boolean;
2970
+ sagittalNoseLeft?: boolean;
2971
+ isSliceMM?: boolean;
2972
+ isHighResolutionCapable?: boolean;
2973
+ drawingEnabled?: boolean;
2974
+ penValue?: number;
2975
+ floodFillNeighbors?: number;
2976
+ maxDrawUndoBitmaps?: number;
2977
+ thumbnail?: string;
2978
+ };
2979
+ type UIData = {
2980
+ mousedown: boolean;
2981
+ touchdown: boolean;
2982
+ mouseButtonLeftDown: boolean;
2983
+ mouseButtonCenterDown: boolean;
2984
+ mouseButtonRightDown: boolean;
2985
+ mouseDepthPicker: boolean;
2986
+ clickedTile: number;
2987
+ pan2DxyzmmAtMouseDown: vec4;
2988
+ prevX: number;
2989
+ prevY: number;
2990
+ currX: number;
2991
+ currY: number;
2992
+ currentTouchTime: number;
2993
+ lastTouchTime: number;
2994
+ touchTimer: NodeJS.Timeout | null;
2995
+ doubleTouch: boolean;
2996
+ isDragging: boolean;
2997
+ dragStart: number[];
2998
+ dragEnd: number[];
2999
+ dragClipPlaneStartDepthAziElev: number[];
3000
+ lastTwoTouchDistance: number;
3001
+ multiTouchGesture: boolean;
3002
+ loading$: Subject<unknown>;
3003
+ dpr?: number;
3004
+ };
3005
+ /**
3006
+ * Niivue can be attached to a canvas. An instance of Niivue contains methods for
3007
+ * loading and rendering NIFTI image data in a WebGL 2.0 context.
3008
+ *
3009
+ * @example
3010
+ * let niivue = new Niivue(\{crosshairColor: [0,1,0,0.5], textHeight: 0.5\}) // a see-through green crosshair, and larger text labels
3011
+ */
3012
+ declare class Niivue {
3013
+ canvas: HTMLCanvasElement | null;
3014
+ _gl: WebGL2RenderingContext | null;
3015
+ isBusy: boolean;
3016
+ needsRefresh: boolean;
3017
+ colormapTexture: WebGLTexture | null;
3018
+ colormapLists: ColormapListEntry[];
3019
+ volumeTexture: WebGLTexture | null;
3020
+ gradientTexture: WebGLTexture | null;
3021
+ gradientTextureAmount: number;
3022
+ drawTexture: WebGLTexture | null;
3023
+ drawUndoBitmaps: Uint8Array[];
3024
+ drawLut: LUT;
3025
+ drawOpacity: number;
3026
+ renderDrawAmbientOcclusion: number;
3027
+ colorbarHeight: number;
3028
+ drawPenLocation: number[];
3029
+ drawPenAxCorSag: number;
3030
+ drawFillOverwrites: boolean;
3031
+ drawPenFillPts: number[][];
3032
+ overlayTexture: WebGLTexture | null;
3033
+ overlayTextureID: WebGLTexture | null;
3034
+ sliceMMShader?: Shader;
3035
+ orientCubeShader?: Shader;
3036
+ orientCubeShaderVAO: WebGLVertexArrayObject | null;
3037
+ rectShader?: Shader;
3038
+ renderShader?: Shader;
3039
+ lineShader?: Shader;
3040
+ line3DShader?: Shader;
3041
+ passThroughShader?: Shader;
3042
+ renderGradientShader?: Shader;
3043
+ renderSliceShader?: Shader;
3044
+ renderVolumeShader?: Shader;
3045
+ pickingMeshShader?: Shader;
3046
+ pickingImageShader?: Shader;
3047
+ colorbarShader?: Shader;
3048
+ fontShader: Shader | null;
3049
+ fiberShader?: Shader;
3050
+ fontTexture: WebGLTexture | null;
3051
+ circleShader?: Shader;
3052
+ matCapTexture: WebGLTexture | null;
3053
+ bmpShader: Shader | null;
3054
+ bmpTexture: WebGLTexture | null;
3055
+ thumbnailVisible: boolean;
3056
+ bmpTextureWH: number;
3057
+ growCutShader?: Shader;
3058
+ orientShaderAtlasU: Shader | null;
3059
+ orientShaderAtlasI: Shader | null;
3060
+ orientShaderU: Shader | null;
3061
+ orientShaderI: Shader | null;
3062
+ orientShaderF: Shader | null;
3063
+ orientShaderRGBU: Shader | null;
3064
+ surfaceShader: Shader | null;
3065
+ blurShader: Shader | null;
3066
+ sobelShader: Shader | null;
3067
+ genericVAO: WebGLVertexArrayObject | null;
3068
+ unusedVAO: null;
3069
+ crosshairs3D: NiivueObject3D | null;
3070
+ DEFAULT_FONT_GLYPH_SHEET: any;
3071
+ DEFAULT_FONT_METRICS: {
3072
+ atlas: {
3073
+ type: string;
3074
+ distanceRange: number;
3075
+ size: number;
3076
+ width: number;
3077
+ height: number;
3078
+ yOrigin: string;
3079
+ };
3080
+ metrics: {
3081
+ emSize: number;
3082
+ lineHeight: number;
3083
+ ascender: number;
3084
+ descender: number;
3085
+ underlineY: number;
3086
+ underlineThickness: number;
3087
+ };
3088
+ glyphs: ({
3089
+ unicode: number;
3090
+ advance: number;
3091
+ planeBounds?: undefined;
3092
+ atlasBounds?: undefined;
3093
+ } | {
3094
+ unicode: number;
3095
+ advance: number;
3096
+ planeBounds: {
3097
+ left: number;
3098
+ bottom: number;
3099
+ right: number;
3100
+ top: number;
3101
+ };
3102
+ atlasBounds: {
3103
+ left: number;
3104
+ bottom: number;
3105
+ right: number;
3106
+ top: number;
3107
+ };
3108
+ })[];
3109
+ kerning: never[];
3110
+ };
3111
+ fontMetrics?: typeof defaultFontMetrics;
3112
+ fontMets: FontMetrics | null;
3113
+ backgroundMasksOverlays: number;
3114
+ overlayOutlineWidth: number;
3115
+ overlayAlphaShader: number;
3116
+ isAlphaClipDark: boolean;
3117
+ position?: vec3;
3118
+ extentsMin?: vec3;
3119
+ extentsMax?: vec3;
3120
+ syncOpts: Record<string, unknown>;
3121
+ readyForSync: boolean;
3122
+ uiData: UIData;
3123
+ eventsToSubjects: Record<string, Subject<unknown>>;
3124
+ back: NVImage | null;
3125
+ overlays: NVImage[];
3126
+ deferredVolumes: NVImage[];
3127
+ deferredMeshes: LoadFromUrlParams[];
3128
+ furthestVertexFromOrigin: number;
3129
+ volScale: number[];
3130
+ vox: number[];
3131
+ mousePos: number[];
3132
+ screenSlices: Array<{
3133
+ leftTopWidthHeight: number[];
3134
+ axCorSag: SLICE_TYPE;
3135
+ sliceFrac: number;
3136
+ AxyzMxy: number[];
3137
+ leftTopMM: number[];
3138
+ fovMM: number[];
3139
+ screen2frac?: number[];
3140
+ }>;
3141
+ cuboidVertexBuffer?: WebGLBuffer;
3142
+ otherNV: Niivue | Niivue[] | null;
3143
+ volumeObject3D: NiivueObject3D | null;
3144
+ pivot3D: number[];
3145
+ furthestFromPivot: number;
3146
+ currentClipPlaneIndex: number;
3147
+ lastCalled: number;
3148
+ selectedObjectId: number;
3149
+ CLIP_PLANE_ID: number;
3150
+ VOLUME_ID: number;
3151
+ DISTANCE_FROM_CAMERA: number;
3152
+ graph: Graph;
3153
+ meshShaders: Array<{
3154
+ Name: string;
3155
+ Frag: string;
3156
+ shader?: Shader;
3157
+ }>;
3158
+ dragModes: {
3159
+ contrast: DRAG_MODE;
3160
+ measurement: DRAG_MODE;
3161
+ none: DRAG_MODE;
3162
+ pan: DRAG_MODE;
3163
+ slicer3D: DRAG_MODE;
3164
+ callbackOnly: DRAG_MODE;
3165
+ };
3166
+ sliceTypeAxial: SLICE_TYPE;
3167
+ sliceTypeCoronal: SLICE_TYPE;
3168
+ sliceTypeSagittal: SLICE_TYPE;
3169
+ sliceTypeMultiplanar: SLICE_TYPE;
3170
+ sliceTypeRender: SLICE_TYPE;
3171
+ sliceMosaicString: string;
3172
+ /**
3173
+ * callback function to run when the right mouse button is released after dragging
3174
+ * @example
3175
+ * niivue.onDragRelease = () =\> \{
3176
+ * console.log('drag ended')
3177
+ * \}
3178
+ */
3179
+ onDragRelease: (params: DragReleaseParams) => void;
3180
+ /**
3181
+ * callback function to run when the left mouse button is released
3182
+ * @example
3183
+ * niivue.onMouseUp = () =\> \{
3184
+ * console.log('mouse up')
3185
+ * \}
3186
+ */
3187
+ onMouseUp: (data: Partial<UIData>) => void;
3188
+ /**
3189
+ * callback function to run when the crosshair location changes
3190
+ * @example
3191
+ * niivue.onLocationChange = (data) =\> \{
3192
+ * console.log('location changed')
3193
+ * console.log('mm: ', data.mm)
3194
+ * console.log('vox: ', data.vox)
3195
+ * console.log('frac: ', data.frac)
3196
+ * console.log('values: ', data.values)
3197
+ * \}
3198
+ */
3199
+ onLocationChange: (location: unknown) => void;
3200
+ /**
3201
+ * callback function to run when the user changes the intensity range with the selection box action (right click)
3202
+ * @example
3203
+ * niivue.onIntensityChange = (volume) =\> \{
3204
+ * console.log('intensity changed')
3205
+ * console.log('volume: ', volume)
3206
+ * \}
3207
+ */
3208
+ onIntensityChange: (volume: NVImage) => void;
3209
+ /**
3210
+ * callback function to run when a new volume is loaded
3211
+ * @example
3212
+ * niivue.onImageLoaded = (volume) =\> \{
3213
+ * console.log('volume loaded')
3214
+ * console.log('volume: ', volume)
3215
+ * \}
3216
+ */
3217
+ onImageLoaded: (volume: NVImage) => void;
3218
+ /**
3219
+ * callback function to run when a new mesh is loaded
3220
+ * @example
3221
+ * niivue.onMeshLoaded = (mesh) =\> \{
3222
+ * console.log('mesh loaded')
3223
+ * console.log('mesh: ', mesh)
3224
+ * \}
3225
+ */
3226
+ onMeshLoaded: (mesh: NVMesh) => void;
3227
+ /**
3228
+ * callback function to run when the user changes the volume when a 4D image is loaded
3229
+ * @example
3230
+ * niivue.onFrameChange = (volume, frameNumber) =\> \{
3231
+ * console.log('frame changed')
3232
+ * console.log('volume: ', volume)
3233
+ * console.log('frameNumber: ', frameNumber)
3234
+ * \}
3235
+ */
3236
+ onFrameChange: (volume: NVImage, index: number) => void;
3237
+ /**
3238
+ * callback function to run when niivue reports an error
3239
+ * @example
3240
+ * niivue.onError = (error) =\> \{
3241
+ * console.log('error: ', error)
3242
+ * \}
3243
+ */
3244
+ onError: () => void;
3245
+ onColormapChange: () => void;
3246
+ /**
3247
+ * callback function to run when niivue reports detailed info
3248
+ * @example
3249
+ * niivue.onInfo = (info) =\> \{
3250
+ * console.log('info: ', info)
3251
+ * \}
3252
+ */
3253
+ onInfo: () => void;
3254
+ /**
3255
+ * callback function to run when niivue reports a warning
3256
+ * @example
3257
+ * niivue.onWarn = (warn) =\> \{
3258
+ * console.log('warn: ', warn)
3259
+ * \}
3260
+ */
3261
+ onWarn: () => void;
3262
+ /**
3263
+ * callback function to run when niivue reports a debug message
3264
+ * @example
3265
+ * niivue.onDebug = (debug) =\> \{
3266
+ * console.log('debug: ', debug)
3267
+ * \}
3268
+ */
3269
+ onDebug: () => void;
3270
+ /**
3271
+ * callback function to run when a volume is added from a url
3272
+ * @example
3273
+ * niivue.onVolumeAddedFromUrl = (imageOptions, volume) =\> \{
3274
+ * console.log('volume added from url')
3275
+ * console.log('imageOptions: ', imageOptions)
3276
+ * console.log('volume: ', volume)
3277
+ * \}
3278
+ */
3279
+ onVolumeAddedFromUrl: (imageOptions: ImageFromUrlOptions, volume: NVImage) => void;
3280
+ onVolumeWithUrlRemoved: (url: string) => void;
3281
+ /**
3282
+ * callback function to run when updateGLVolume is called (most users will not need to use
3283
+ * @example
3284
+ * niivue.onVolumeUpdated = () =\> \{
3285
+ * console.log('volume updated')
3286
+ * \}
3287
+ */
3288
+ onVolumeUpdated: () => void;
3289
+ /**
3290
+ * callback function to run when a mesh is added from a url
3291
+ * @example
3292
+ * niivue.onMeshAddedFromUrl = (meshOptions, mesh) =\> \{
3293
+ * console.log('mesh added from url')
3294
+ * console.log('meshOptions: ', meshOptions)
3295
+ * console.log('mesh: ', mesh)
3296
+ * \}
3297
+ */
3298
+ onMeshAddedFromUrl: (meshOptions: LoadFromUrlParams, mesh: NVMesh) => void;
3299
+ onMeshAdded: () => void;
3300
+ onMeshWithUrlRemoved: (url: string) => void;
3301
+ onZoom3DChange: (zoom: number) => void;
3302
+ /**
3303
+ * callback function to run when the user changes the rotation of the 3D rendering
3304
+ * @example
3305
+ * niivue.onAzimuthElevationChange = (azimuth, elevation) =\> \{
3306
+ * console.log('azimuth: ', azimuth)
3307
+ * console.log('elevation: ', elevation)
3308
+ * \}
3309
+ */
3310
+ onAzimuthElevationChange: (azimuth: number, elevation: number) => void;
3311
+ /**
3312
+ * callback function to run when the user changes the clip plane
3313
+ * @example
3314
+ * niivue.onClipPlaneChange = (clipPlane) =\> \{
3315
+ * console.log('clipPlane: ', clipPlane)
3316
+ * \}
3317
+ */
3318
+ onClipPlaneChange: (clipPlane: number[]) => void;
3319
+ onCustomMeshShaderAdded: (fragmentShaderText: string, name: string) => void;
3320
+ onMeshShaderChanged: (meshIndex: number, shaderIndex: number) => void;
3321
+ onMeshPropertyChanged: (meshIndex: number, key: string, val: unknown) => void;
3322
+ /**
3323
+ * callback function to run when the user loads a new NiiVue document
3324
+ * @example
3325
+ * niivue.onDocumentLoaded = (document) =\> \{
3326
+ * console.log('document: ', document)
3327
+ * \}
3328
+ */
3329
+ onDocumentLoaded: (document: NVDocument) => void;
3330
+ document: NVDocument;
3331
+ opts: {
3332
+ textHeight: number;
3333
+ colorbarHeight: number;
3334
+ crosshairWidth: number;
3335
+ rulerWidth: number;
3336
+ show3Dcrosshair: boolean;
3337
+ backColor: number[];
3338
+ crosshairColor: number[];
3339
+ fontColor: number[];
3340
+ selectionBoxColor: number[];
3341
+ clipPlaneColor: number[];
3342
+ rulerColor: number[];
3343
+ colorbarMargin: number;
3344
+ trustCalMinMax: boolean;
3345
+ clipPlaneHotKey: string;
3346
+ viewModeHotKey: string;
3347
+ doubleTouchTimeout: number;
3348
+ longTouchTimeout: number;
3349
+ keyDebounceTime: number;
3350
+ isNearestInterpolation: boolean;
3351
+ isAtlasOutline: boolean;
3352
+ isRuler: boolean;
3353
+ isColorbar: boolean;
3354
+ isOrientCube: boolean;
3355
+ multiplanarPadPixels: number;
3356
+ multiplanarForceRender: boolean;
3357
+ isRadiologicalConvention: boolean;
3358
+ meshThicknessOn2D: string | number;
3359
+ dragMode: DRAG_MODE;
3360
+ isDepthPickMesh: boolean;
3361
+ isCornerOrientationText: boolean;
3362
+ sagittalNoseLeft: boolean;
3363
+ isSliceMM: boolean;
3364
+ isHighResolutionCapable: boolean;
3365
+ logging: boolean;
3366
+ loadingText: string;
3367
+ dragAndDropEnabled: boolean;
3368
+ drawingEnabled: boolean;
3369
+ penValue: number;
3370
+ floodFillNeighbors: number;
3371
+ isFilledPen: boolean;
3372
+ thumbnail: string;
3373
+ maxDrawUndoBitmaps: number;
3374
+ sliceType: SLICE_TYPE;
3375
+ isAntiAlias: boolean | null;
3376
+ isAdditiveBlend: boolean;
3377
+ isResizeCanvas: boolean;
3378
+ meshXRay: number;
3379
+ limitFrames4D: number;
3380
+ showLegend: boolean;
3381
+ legendBackgroundColor: number[];
3382
+ legendTextColor: number[];
3383
+ multiplanarLayout: MULTIPLANAR_TYPE;
3384
+ renderOverlayBlend: number;
3385
+ };
3386
+ scene: {
3387
+ onAzimuthElevationChange: (azimuth: number, elevation: number) => void;
3388
+ onZoom3DChange: (scale: number) => void;
3389
+ sceneData: {
3390
+ azimuth: number;
3391
+ elevation: number;
3392
+ crosshairPos: vec3;
3393
+ clipPlane: number[];
3394
+ clipPlaneDepthAziElev: number[];
3395
+ volScaleMultiplier: number;
3396
+ pan2Dxyzmm: vec4;
3397
+ };
3398
+ renderAzimuth: number;
3399
+ renderElevation: number;
3400
+ volScaleMultiplier: number;
3401
+ crosshairPos: vec3;
3402
+ clipPlane: number[];
3403
+ clipPlaneDepthAziElev: number[];
3404
+ pan2Dxyzmm: vec4;
3405
+ _elevation?: number | undefined;
3406
+ _azimuth?: number | undefined;
3407
+ };
3408
+ mediaUrlMap: Map<NVImage | NVMesh, string>;
3409
+ initialized: boolean;
3410
+ currentDrawUndoBitmap: number;
3411
+ loadingText: string;
3412
+ subscriptions: Array<Record<string, Subscription>>;
3413
+ /**
3414
+ * @param options - options object to set modifiable Niivue properties
3415
+ */
3416
+ constructor(options?: Partial<NiiVueOptions>);
3417
+ get volumes(): NVImage[];
3418
+ set volumes(volumes: NVImage[]);
3419
+ get meshes(): NVMesh[];
3420
+ set meshes(meshes: NVMesh[]);
3421
+ get drawBitmap(): Uint8Array | null;
3422
+ set drawBitmap(drawBitmap: Uint8Array | null);
3423
+ get volScaleMultiplier(): number;
3424
+ set volScaleMultiplier(scale: number);
3425
+ /**
3426
+ * save webgl2 canvas as png format bitmap
3427
+ * @param filename - filename for screen capture
3428
+ * @example niivue.saveScene('test.png');
3429
+ * @see {@link https://niivue.github.io/niivue/features/ui.html|live demo usage}
3430
+ */
3431
+ saveScene(filename?: string): Promise<void>;
3432
+ /**
3433
+ * attach the Niivue instance to the webgl2 canvas by element id
3434
+ * @param id - the id of an html canvas element
3435
+ * @param isAntiAlias - determines if anti-aliasing is requested (if not specified, AA usage depends on hardware)
3436
+ * @example niivue = new Niivue().attachTo('gl')
3437
+ * @example niivue.attachTo('gl')
3438
+ * @see {@link https://niivue.github.io/niivue/features/multiplanar.html|live demo usage}
3439
+ */
3440
+ attachTo(id: string, isAntiAlias?: null): Promise<this>;
3441
+ /**
3442
+ * register a callback function to run when known Niivue events happen
3443
+ * @param event - the name of the event to watch for. Event names are shown in the type column
3444
+ * @param callback - the function to call when the event happens
3445
+ * @example
3446
+ * niivue = new Niivue()
3447
+ *
3448
+ * // 'location' update event is fired when the crosshair changes position via user input
3449
+ * function doSomethingWithLocationData(data)\{
3450
+ * // data has the shape \{mm: [N, N, N], vox: [N, N, N], frac: [N, N, N], values: this.volumes.map(v =\> \{return val\})\}
3451
+ * //...
3452
+ * \}
3453
+ */
3454
+ on(event: string, callback: (data: unknown) => void): void;
3455
+ /**
3456
+ * off unsubscribes events and subjects (the opposite of on)
3457
+ * @param event - the name of the event to watch for. Event names are shown in the type column
3458
+ * @example
3459
+ * niivue = new Niivue()
3460
+ * niivue.off('location')
3461
+ */
3462
+ off(event: string): void;
3463
+ /**
3464
+ * attach the Niivue instance to a canvas element directly
3465
+ * @param canvas - the canvas element reference
3466
+ * @example
3467
+ * niivue = new Niivue()
3468
+ * niivue.attachToCanvas(document.getElementById(id))
3469
+ */
3470
+ attachToCanvas(canvas: HTMLCanvasElement, isAntiAlias?: boolean | null): Promise<this>;
3471
+ /**
3472
+ * Sync the scene controls (orientation, crosshair location, etc.) from one Niivue instance to another. useful for using one canvas to drive another.
3473
+ * @param otherNV - the other Niivue instance that is the main controller
3474
+ * @example
3475
+ * niivue1 = new Niivue()
3476
+ * niivue2 = new Niivue()
3477
+ * niivue2.syncWith(niivue1)
3478
+ * @deprecated use broadcastTo instead
3479
+ * @see {@link https://niivue.github.io/niivue/features/sync.mesh.html|live demo usage}
3480
+ */
3481
+ syncWith(otherNV: Niivue, syncOpts?: {
3482
+ '2d': boolean;
3483
+ '3d': boolean;
3484
+ }): void;
3485
+ /**
3486
+ * Sync the scene controls (orientation, crosshair location, etc.) from one Niivue instance to others. useful for using one canvas to drive another.
3487
+ * @param otherNV - the other Niivue instance(s)
3488
+ * @example
3489
+ * niivue1 = new Niivue()
3490
+ * niivue2 = new Niivue()
3491
+ * niivue3 = new Niivue()
3492
+ * niivue1.broadcastTo(niivue2)
3493
+ * niivue1.broadcastTo([niivue2, niivue3])
3494
+ * @see {@link https://niivue.github.io/niivue/features/sync.mesh.html|live demo usage}
3495
+ */
3496
+ broadcastTo(otherNV: Niivue | Niivue[], syncOpts?: {
3497
+ '2d': boolean;
3498
+ '3d': boolean;
3499
+ }): void;
3500
+ /**
3501
+ * Sync the scene controls (orientation, crosshair location, etc.) from one Niivue instance to another. useful for using one canvas to drive another.
3502
+ * @internal
3503
+ * @example
3504
+ * niivue1 = new Niivue()
3505
+ * niivue2 = new Niivue()
3506
+ * niivue2.syncWith(niivue1)
3507
+ * niivue2.sync()
3508
+ */
3509
+ sync(): void;
3510
+ /** Not documented publicly for now
3511
+ * test if two arrays have equal values for each element
3512
+ * @param a - the first array
3513
+ * @param b - the second array
3514
+ * @example Niivue.arrayEquals(a, b)
3515
+ *
3516
+ * TODO this should maybe just use array-equal from NPM
3517
+ */
3518
+ arrayEquals(a: unknown[], b: unknown[]): boolean;
3519
+ /**
3520
+ * callback function to handle resize window events, redraws the scene.
3521
+ * @internal
3522
+ */
3523
+ resizeListener(): void;
3524
+ /**
3525
+ * callback to handle mouse move events relative to the canvas
3526
+ * @internal
3527
+ * @returns the mouse position relative to the canvas
3528
+ */
3529
+ getRelativeMousePosition(event: MouseEvent, target?: EventTarget | null): {
3530
+ x: number;
3531
+ y: number;
3532
+ } | undefined;
3533
+ getNoPaddingNoBorderCanvasRelativeMousePosition(event: MouseEvent, target: EventTarget): {
3534
+ x: number;
3535
+ y: number;
3536
+ } | undefined;
3537
+ mouseContextMenuListener(e: MouseEvent): void;
3538
+ mouseDownListener(e: MouseEvent): void;
3539
+ mouseLeftButtonHandler(e: MouseEvent): void;
3540
+ mouseCenterButtonHandler(e: MouseEvent): void;
3541
+ mouseRightButtonHandler(e: MouseEvent): void;
3542
+ /**
3543
+ * calculate the the min and max voxel indices from an array of two values (used in selecting intensities with the selection box)
3544
+ * @param array - an array of two values
3545
+ * @returns an array of two values representing the min and max voxel indices
3546
+ */
3547
+ calculateMinMaxVoxIdx(array: number[]): number[];
3548
+ calculateNewRange({ volIdx }?: {
3549
+ volIdx?: number | undefined;
3550
+ }): void;
3551
+ generateMouseUpCallback(fracStart: vec3, fracEnd: vec3): void;
3552
+ mouseUpListener(): void;
3553
+ checkMultitouch(e: TouchEvent): void;
3554
+ touchStartListener(e: TouchEvent): void;
3555
+ touchEndListener(e: TouchEvent): void;
3556
+ mouseMoveListener(e: MouseEvent): void;
3557
+ resetBriCon(msg?: TouchEvent | MouseEvent | null): void;
3558
+ setDragStart(x: number, y: number): void;
3559
+ setDragEnd(x: number, y: number): void;
3560
+ touchMoveListener(e: TouchEvent): void;
3561
+ handlePinchZoom(e: TouchEvent): void;
3562
+ keyUpListener(e: KeyboardEvent): void;
3563
+ keyDownListener(e: KeyboardEvent): void;
3564
+ wheelListener(e: WheelEvent): void;
3565
+ registerInteractions(): void;
3566
+ dragEnterListener(e: MouseEvent): void;
3567
+ dragOverListener(e: MouseEvent): void;
3568
+ getFileExt(fullname: string, upperCase?: boolean): string;
3569
+ /**
3570
+ * Add an image and notify subscribers
3571
+ * @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
3572
+ */
3573
+ addVolumeFromUrl(imageOptions: ImageFromUrlOptions): Promise<NVImage>;
3574
+ /**
3575
+ * Find media by url
3576
+ */
3577
+ getMediaByUrl(url: string): NVImage | NVMesh | undefined;
3578
+ /**
3579
+ * Remove volume by url
3580
+ * @param url - Volume added by url to remove
3581
+ * @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
3582
+ */
3583
+ removeVolumeByUrl(url: string): void;
3584
+ readDirectory(directory: FileSystemDirectoryEntry): FileSystemEntry[];
3585
+ /**
3586
+ * Returns boolean: true if filename ends with mesh extension (TRK, pial, etc)
3587
+ * @param url - filename
3588
+ */
3589
+ isMeshExt(url: string): boolean;
3590
+ dropListener(e: DragEvent): void;
3591
+ /**
3592
+ * insert a gap between slices of a mutliplanar view.
3593
+ * @param pixels - spacing between tiles of multiplanar view
3594
+ * @example niivue.setMultiplanarPadPixels(4)
3595
+ * @see {@link https://niivue.github.io/niivue/features/atlas.html|live demo usage}
3596
+ */
3597
+ setMultiplanarPadPixels(pixels: number): void;
3598
+ /**
3599
+ * control placement of 2D slices.
3600
+ * @param layout - AUTO: 0, COLUMN: 1, GRID: 2, ROW: 3,
3601
+ * @example niivue.setMultiplanarLayout(2)
3602
+ * @see {@link https://niivue.github.io/niivue/features/layout.html|live demo usage}
3603
+ */
3604
+ setMultiplanarLayout(layout: number): void;
3605
+ /**
3606
+ * determine if text appears at corner (true) or sides of 2D slice.
3607
+ * @param isCornerOrientationText - controls position of text
3608
+ * @example niivue.setCornerOrientationText(true)
3609
+ * @see {@link https://niivue.github.io/niivue/features/worldspace2.html|live demo usage}
3610
+ */
3611
+ setCornerOrientationText(isCornerOrientationText: boolean): void;
3612
+ /**
3613
+ * control whether 2D slices use radiological or neurological convention.
3614
+ * @param isRadiologicalConvention - new display convention
3615
+ * @example niivue.setCornerOrientationText(true)
3616
+ * @see {@link https://niivue.github.io/niivue/features/worldspace.html|live demo usage}
3617
+ */
3618
+ setRadiologicalConvention(isRadiologicalConvention: boolean): void;
3619
+ /**
3620
+ * Reset scene to default settings.
3621
+ * @param options - @see NiiVueOptions
3622
+ * @param resetBriCon - also reset contrast (default false).
3623
+ * @example niivue.nv1.setDefaults(opts, true);
3624
+ * @see {@link https://niivue.github.io/niivue/features/connectome.html|live demo usage}
3625
+ */
3626
+ setDefaults(options?: Partial<NiiVueOptions>, resetBriCon?: boolean): void;
3627
+ /**
3628
+ * Limit visibility of mesh in front of a 2D image. Requires world-space mode.
3629
+ * @param meshThicknessOn2D - distance from voxels for clipping mesh. Use Infinity to show entire mesh or 0.0 to hide mesh.
3630
+ * @example niivue.setMeshThicknessOn2D(42)
3631
+ * @see {@link https://niivue.github.io/niivue/features/worldspace2.html|live demo usage}
3632
+ */
3633
+ setMeshThicknessOn2D(meshThicknessOn2D: number): void;
3634
+ /**
3635
+ * Create a custom multi-slice mosaic (aka lightbox, montage) view.
3636
+ * @param str - description of mosaic.
3637
+ * @example niivue.setSliceMosaicString("A 0 20 C 30 S 42")
3638
+ * @see {@link https://niivue.github.io/niivue/features/mosaics.html|live demo usage}
3639
+ */
3640
+ setSliceMosaicString(str: string): void;
3641
+ /**
3642
+ * control 2D slice view mode.
3643
+ * @param isSliceMM - control whether 2D slices use world space (true) or voxel space (false). Beware that voxel space mode limits properties like panning, zooming and mesh visibility.
3644
+ * @example niivue.setSliceMM(true)
3645
+ * @see {@link https://niivue.github.io/niivue/features/worldspace2.html|live demo usage}
3646
+ */
3647
+ setSliceMM(isSliceMM: boolean): void;
3648
+ /**
3649
+ * control whether voxel overlays are combined using additive (emission) or traditional (transmission) blending.
3650
+ * @param isAdditiveBlend - emission (true) or transmission (false) mixing
3651
+ * @example niivue.isAdditiveBlend(true)
3652
+ * @see {@link https://niivue.github.io/niivue/features/additive.voxels.html|live demo usage}
3653
+ */
3654
+ setAdditiveBlend(isAdditiveBlend: boolean): void;
3655
+ /**
3656
+ * Detect if display is using radiological or neurological convention.
3657
+ * @returns radiological convention status
3658
+ * @example let rc = niivue.getRadiologicalConvention()
3659
+ */
3660
+ getRadiologicalConvention(): boolean;
3661
+ /**
3662
+ * Force WebGL canvas to use high resolution display, regardless of browser defaults.
3663
+ * @param isHighResolutionCapable - allow high-DPI display
3664
+ * @example niivue.setHighResolutionCapable(true);
3665
+ * @see {@link https://niivue.github.io/niivue/features/sync.mesh.html|live demo usage}
3666
+ */
3667
+ setHighResolutionCapable(isHighResolutionCapable: boolean): void;
3668
+ /**
3669
+ * add a new volume to the canvas
3670
+ * @param volume - the new volume to add to the canvas
3671
+ * @example
3672
+ * niivue = new Niivue()
3673
+ * niivue.addVolume(NVImage.loadFromUrl(\{url:'../someURL.nii.gz'\}))
3674
+ * @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
3675
+ */
3676
+ addVolume(volume: NVImage): void;
3677
+ /**
3678
+ * add a new mesh to the canvas
3679
+ * @param mesh - the new mesh to add to the canvas
3680
+ * @example
3681
+ * niivue = new Niivue()
3682
+ * niivue.addMesh(NVMesh.loadFromUrl(\{url:'../someURL.gii'\}))
3683
+ * @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
3684
+ */
3685
+ addMesh(mesh: NVMesh): void;
3686
+ /**
3687
+ * get the index of a volume by its unique id. unique ids are assigned to the NVImage.id property when a new NVImage is created.
3688
+ * @param id - the id string to search for
3689
+ * @example
3690
+ * niivue = new Niivue()
3691
+ * niivue.getVolumeIndexByID(someVolume.id)
3692
+ */
3693
+ getVolumeIndexByID(id: string): number;
3694
+ drawAddUndoBitmap(): void;
3695
+ drawClearAllUndoBitmaps(): void;
3696
+ /**
3697
+ * Restore drawing to previous state
3698
+ * @example niivue.drawUndo();
3699
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
3700
+ */
3701
+ drawUndo(): void;
3702
+ loadDrawing(drawingBitmap: NVImage): boolean;
3703
+ binarize(volume: NVImage): void;
3704
+ /**
3705
+ * Open drawing
3706
+ * @param filename - of NIfTI format drawing
3707
+ * @param isBinarize - if true will force drawing voxels to be either 0 or 1.
3708
+ * @example niivue.loadDrawingFromUrl("../images/lesion.nii.gz");
3709
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
3710
+ */
3711
+ loadDrawingFromUrl(fnm: string, isBinarize?: boolean): Promise<boolean>;
3712
+ findOtsu(mlevel?: number): number[];
3713
+ /**
3714
+ * remove dark voxels in air
3715
+ * @param levels - (2-4) segment brain into this many types. For example drawOtsu(2) will create a binary drawing where bright voxels are colored and dark voxels are clear.
3716
+ * @example niivue.drawOtsu(3);
3717
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
3718
+ */
3719
+ drawOtsu(levels?: number): void;
3720
+ /**
3721
+ * remove dark voxels in air
3722
+ * @param level - (1-5) larger values for more preserved voxels
3723
+ * @param volIndex - volume to dehaze
3724
+ * @example niivue.removeHaze(3, 0);
3725
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
3726
+ */
3727
+ removeHaze(level?: number, volIndex?: number): void;
3728
+ /**
3729
+ * save voxel-based image to disk
3730
+ * @param fnm - filename of NIfTI image to create
3731
+ * @param isSaveDrawing - determines whether drawing or background image is saved
3732
+ * @param volumeByIndex - determines layer to save (0 for background)
3733
+ * @param volumeByIndex - determines layer to save (0 for background)
3734
+ * @example niivue.saveImage('test.nii', true);
3735
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
3736
+ */
3737
+ saveImage(fnm: string, isSaveDrawing?: boolean, volumeByIndex?: number): Uint8Array | boolean;
3738
+ getMeshIndexByID(id: string | number): number;
3739
+ /**
3740
+ * change property of mesh, tractogram or connectome
3741
+ * @param id - identity of mesh to change
3742
+ * @param key - attribute to change
3743
+ * @param value - for attribute
3744
+ * @example niivue.setMeshProperty(niivue.meshes[0].id, 'fiberLength', 42)
3745
+ * @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
3746
+ */
3747
+ setMeshProperty(id: number, key: keyof NVMesh, val: number): void;
3748
+ /**
3749
+ * reverse triangle winding of mesh (swap front and back faces)
3750
+ * @param id - identity of mesh to change
3751
+ * @example niivue.reverseFaces(niivue.meshes[0].id)
3752
+ * @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
3753
+ */
3754
+ reverseFaces(mesh: number): void;
3755
+ /**
3756
+ * reverse triangle winding of mesh (swap front and back faces)
3757
+ * @param mesh - identity of mesh to change
3758
+ * @param layer - selects the mesh overlay (e.g. GIfTI or STC file)
3759
+ * @param key - attribute to change
3760
+ * @param value - for attribute
3761
+ * @example niivue.setMeshLayerProperty(niivue.meshes[0].id, 0, 'frame4D', 22)
3762
+ * @see {@link https://niivue.github.io/niivue/features/mesh.4D.html|live demo usage}
3763
+ */
3764
+ setMeshLayerProperty(mesh: number, layer: number, key: keyof NVMeshLayer, val: number): void;
3765
+ /**
3766
+ * adjust offset position and scale of 2D sliceScale
3767
+ * @param xyzmmZoom - first three components are spatial, fourth is scaling
3768
+ * @example niivue.setPan2Dxyzmm([5,-4, 2, 1.5])
3769
+ */
3770
+ setPan2Dxyzmm(xyzmmZoom: vec4): void;
3771
+ /**
3772
+ * set rotation of 3D render view
3773
+ * @example niivue.setRenderAzimuthElevation(45, 15)
3774
+ * @see {@link https://niivue.github.io/niivue/features/mask.html|live demo usage}
3775
+ */
3776
+ setRenderAzimuthElevation(a: number, e: number): void;
3777
+ /**
3778
+ * get the index of an overlay by its unique id. unique ids are assigned to the NVImage.id property when a new NVImage is created.
3779
+ * @param id - the id string to search for
3780
+ * @see NiiVue#getVolumeIndexByID
3781
+ * @example
3782
+ * niivue = new Niivue()
3783
+ * niivue.getOverlayIndexByID(someVolume.id)
3784
+ */
3785
+ getOverlayIndexByID(id: string): number;
3786
+ /**
3787
+ * set the index of a volume. This will change it's ordering and appearance if there are multiple volumes loaded.
3788
+ * @param volume - the volume to update
3789
+ * @param toIndex - the index to move the volume to. The default is the background (0 index)
3790
+ * @example
3791
+ * niivue = new Niivue()
3792
+ * niivue.setVolume(someVolume, 1) // move it to the second position in the array of loaded volumes (0 is the first position)
3793
+ */
3794
+ setVolume(volume: NVImage, toIndex?: number): void;
3795
+ setMesh(mesh: NVMesh, toIndex?: number): void;
3796
+ /**
3797
+ * Remove a volume
3798
+ * @param volume - volume to delete
3799
+ * @example
3800
+ * niivue = new Niivue()
3801
+ * niivue.removeVolume(this.volumes[3])
3802
+ * @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
3803
+ */
3804
+ removeVolume(volume: NVImage): void;
3805
+ /**
3806
+ * Remove a volume by index
3807
+ * @param index - of volume to remove
3808
+ */
3809
+ removeVolumeByIndex(index: number): void;
3810
+ /**
3811
+ * Remove a triangulated mesh, connectome or tractogram
3812
+ * @param mesh - mesh to delete
3813
+ * @example
3814
+ * niivue = new Niivue()
3815
+ * niivue.removeMesh(this.meshes[3])
3816
+ * @see {@link https://niivue.github.io/niivue/features/multiuser.meshes.html|live demo usage}
3817
+ */
3818
+ removeMesh(mesh: NVMesh): void;
3819
+ /**
3820
+ * Remove a triangulated mesh, connectome or tractogram
3821
+ * @param url - URL of mesh to delete
3822
+ * @example
3823
+ * niivue.removeMeshByUrl('../images/cit168.mz3')
3824
+ */
3825
+ removeMeshByUrl(url: string): void;
3826
+ /**
3827
+ * Move a volume to the bottom of the stack of loaded volumes. The volume will become the background
3828
+ * @param volume - the volume to move
3829
+ * @example
3830
+ * niivue = new Niivue()
3831
+ * niivue.moveVolumeToBottom(this.volumes[3]) // move the 4th volume to the 0 position. It will be the new background
3832
+ */
3833
+ moveVolumeToBottom(volume: NVImage): void;
3834
+ /**
3835
+ * Move a volume up one index position in the stack of loaded volumes. This moves it up one layer
3836
+ * @param volume - the volume to move
3837
+ * @example
3838
+ * niivue = new Niivue()
3839
+ * niivue.moveVolumeUp(this.volumes[0]) // move the background image to the second index position (it was 0 index, now will be 1)
3840
+ */
3841
+ moveVolumeUp(volume: NVImage): void;
3842
+ /**
3843
+ * Move a volume down one index position in the stack of loaded volumes. This moves it down one layer
3844
+ * @param volume - the volume to move
3845
+ * @example
3846
+ * niivue = new Niivue()
3847
+ * niivue.moveVolumeDown(this.volumes[1]) // move the second image to the background position (it was 1 index, now will be 0)
3848
+ */
3849
+ moveVolumeDown(volume: NVImage): void;
3850
+ /**
3851
+ * Move a volume to the top position in the stack of loaded volumes. This will be the top layer
3852
+ * @param volume - the volume to move
3853
+ * @example
3854
+ * niivue = new Niivue()
3855
+ * niivue.moveVolumeToTop(this.volumes[0]) // move the background image to the top layer position
3856
+ */
3857
+ moveVolumeToTop(volume: NVImage): void;
3858
+ mouseDown(x: number, y: number): void;
3859
+ mouseMove(x: number, y: number): void;
3860
+ /**
3861
+ * convert spherical AZIMUTH, ELEVATION to Cartesian
3862
+ * @param azimuth - azimuth number
3863
+ * @param elevation - elevation number
3864
+ * @returns the converted [x, y, z] coordinates
3865
+ * @example
3866
+ * niivue = new Niivue()
3867
+ * xyz = niivue.sph2cartDeg(42, 42)
3868
+ */
3869
+ sph2cartDeg(azimuth: number, elevation: number): number[];
3870
+ /**
3871
+ * update the clip plane orientation in 3D view mode
3872
+ * @param azimuthElevationDepth - a two component vector. azimuth: camera position in degrees around object, typically 0..360 (or -180..+180). elevation: camera height in degrees, range -90..90
3873
+ * @example
3874
+ * niivue = new Niivue()
3875
+ * niivue.setClipPlane([42, 42])
3876
+ * @see {@link https://niivue.github.io/niivue/features/mask.html|live demo usage}
3877
+ */
3878
+ setClipPlane(depthAzimuthElevation: number[]): void;
3879
+ /**
3880
+ * set the crosshair and colorbar outline color
3881
+ * @param color - an RGBA array. values range from 0 to 1
3882
+ * @example
3883
+ * niivue = new Niivue()
3884
+ * niivue.setCrosshairColor([0, 1, 0, 0.5]) // set crosshair to transparent green
3885
+ * @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
3886
+ */
3887
+ setCrosshairColor(color: number[]): Promise<void>;
3888
+ /**
3889
+ * set thickness of crosshair
3890
+ * @example niivue.crosshairWidth(2)
3891
+ * @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
3892
+ */
3893
+ setCrosshairWidth(crosshairWidth: number): void;
3894
+ setDrawColormap(name: string): void;
3895
+ /**
3896
+ * does dragging over a 2D slice create a drawing?
3897
+ * @param trueOrFalse - enabled (true) or not (false)
3898
+ * @example niivue.setDrawingEnabled(true)
3899
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
3900
+ */
3901
+ setDrawingEnabled(trueOrFalse: boolean): void;
3902
+ /**
3903
+ * determine color and style of drawing
3904
+ * @param penValue - sets the color of the pen
3905
+ * @param isFilledPen - determines if dragging creates flood-filled shape
3906
+ * @example niivue.setPenValue(1, true)
3907
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
3908
+ */
3909
+ setPenValue(penValue: number, isFilledPen?: boolean): void;
3910
+ /**
3911
+ * control whether drawing is transparent (0), opaque (1) or translucent (between 0 and 1).
3912
+ * @param opacity - translucency of drawing
3913
+ * @example niivue.setDrawOpacity(0.7)
3914
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
3915
+ */
3916
+ setDrawOpacity(opacity: number): void;
3917
+ /**
3918
+ * set the selection box color. A selection box is drawn when you right click and drag to change image contrast
3919
+ * @param color - an RGBA array. values range from 0 to 1
3920
+ * @example
3921
+ * niivue = new Niivue()
3922
+ * niivue.setSelectionBoxColor([0, 1, 0, 0.5]) // set to transparent green
3923
+ * @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
3924
+ */
3925
+ setSelectionBoxColor(color: number[]): void;
3926
+ sliceScroll2D(posChange: number, x: number, y: number, isDelta?: boolean): void;
3927
+ /**
3928
+ * set the slice type. This changes the view mode
3929
+ * @param sliceType - an enum of slice types to use
3930
+ * @example
3931
+ * niivue = new Niivue()
3932
+ * niivue.setSliceType(Niivue.sliceTypeMultiplanar)
3933
+ * @see {@link https://niivue.github.io/niivue/features/basic.multiplanar.html|live demo usage}
3934
+ */
3935
+ setSliceType(st: SLICE_TYPE): this;
3936
+ /**
3937
+ * set the opacity of a volume given by volume index
3938
+ * @param volIdx - the volume index of the volume to change
3939
+ * @param newOpacity - the opacity value. valid values range from 0 to 1. 0 will effectively remove a volume from the scene
3940
+ * @example
3941
+ * niivue = new Niivue()
3942
+ * niivue.setOpacity(0, 0.5) // make the first volume transparent
3943
+ * @see {@link https://niivue.github.io/niivue/features/atlas.html|live demo usage}
3944
+ */
3945
+ setOpacity(volIdx: number, newOpacity: number): void;
3946
+ /**
3947
+ * set the scale of the 3D rendering. Larger numbers effectively zoom.
3948
+ * @param scale - the new scale value
3949
+ * @example
3950
+ * niivue.setScale(2) // zoom some
3951
+ * @see {@link https://niivue.github.io/niivue/features/shiny.volumes.html|live demo usage}
3952
+ */
3953
+ setScale(scale: number): void;
3954
+ /**
3955
+ * set the color of the 3D clip plane
3956
+ * @param color - the new color. expects an array of RGBA values. values can range from 0 to 1
3957
+ * @example
3958
+ * niivue.setClipPlaneColor([1, 1, 1, 0.5]) // white, transparent
3959
+ * @see {@link https://niivue.github.io/niivue/features/clipplanes.html|live demo usage}
3960
+ */
3961
+ setClipPlaneColor(color: number[]): void;
3962
+ /**
3963
+ * set proportion of volume rendering influenced by selected matcap.
3964
+ * @param gradientAmount - amount of matcap (0..1), default 0 (matte, surface normal does not influence color)
3965
+ * @example
3966
+ * niivue.setVolumeRenderIllumination(0.6);
3967
+ * @see {@link https://niivue.github.io/niivue/features/shiny.volumes.html|live demo usage}
3968
+ */
3969
+ setVolumeRenderIllumination(gradientAmount?: number): Promise<void>;
3970
+ overlayRGBA(volume: NVImage): Uint8ClampedArray;
3971
+ vox2mm(XYZ: number[], mtx: mat4): vec3;
3972
+ /**
3973
+ * clone a volume and return a new volume
3974
+ * @param index - the index of the volume to clone
3975
+ * @returns new volume to work with, but that volume is not added to the canvas
3976
+ * @example
3977
+ * niivue = new Niivue()
3978
+ * niivue.cloneVolume(0)
3979
+ */
3980
+ cloneVolume(index: number): NVImage;
3981
+ /**
3982
+ *
3983
+ * @param url - URL of NVDocument
3984
+ */
3985
+ loadDocumentFromUrl(url: string): Promise<void>;
3986
+ /**
3987
+ * Loads an NVDocument
3988
+ * @returns Niivue instance
3989
+ * @see {@link https://niivue.github.io/niivue/features/document.load.html|live demo usage}
3990
+ */
3991
+ loadDocument(document: NVDocument): this;
3992
+ /**
3993
+ * generates JavaScript to load the current scene as a document
3994
+ * @param canvasId - id of canvas NiiVue will be attached to
3995
+ * @param esm - bundled version of NiiVue
3996
+ * @example
3997
+ * const javascript = this.generateLoadDocumentJavaScript("gl1");
3998
+ * const html = \`<html><body><canvas id="gl1"></canvas>\<script type="module" async\>
3999
+ $\{javascript\}</script></body></html>\`;
4000
+ */
4001
+ generateLoadDocumentJavaScript(canvasId: string, esm: string): string;
4002
+ /**
4003
+ * generates HTML of current scene
4004
+ * @param canvasId - id of canvas NiiVue will be attached to
4005
+ * @param esm - bundled version of NiiVue
4006
+ * @returns HTML with javascript of the current scene
4007
+ * @example
4008
+ * const template = \`<html><body><canvas id="gl1"></canvas>\<script type="module" async\>
4009
+ * %%javascript%%</script></body></html>\`;
4010
+ * nv1.generateHTML("page.html", esm);
4011
+ */
4012
+ generateHTML(canvasId: string | undefined, esm: string): string;
4013
+ /**
4014
+ * save current scene as HTML
4015
+ * @param fileName - the name of the HTML file
4016
+ * @param canvasId - id of canvas NiiVue will be attached to
4017
+ * @param esm - bundled version of NiiVue
4018
+ */
4019
+ saveHTML(fileName: string | undefined, canvasId: string | undefined, esm: string): void;
4020
+ /**
4021
+ * Converts NiiVue scene to JSON
4022
+ */
4023
+ json(): ExportDocumentData;
4024
+ /**
4025
+ * save the entire scene (objects and settings) as a document
4026
+ * @param fileName - the name of the document storing the scene
4027
+ * @example
4028
+ * niivue.saveDocument("niivue.basic.nvd")
4029
+ * @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
4030
+ */
4031
+ saveDocument(fileName?: string): Promise<void>;
4032
+ /**
4033
+ * load an array of volume objects
4034
+ * @param volumeList - the array of objects to load. each object must have a resolvable "url" property at a minimum
4035
+ * @returns returns the Niivue instance
4036
+ * @example
4037
+ * niivue = new Niivue()
4038
+ * niivue.loadVolumes([\{url: 'someImage.nii.gz\}, \{url: 'anotherImage.nii.gz\'\}])
4039
+ * @see {@link https://niivue.github.io/niivue/features/mask.html|live demo usage}
4040
+ */
4041
+ loadVolumes(volumeList: NVImage[]): Promise<this>;
4042
+ /**
4043
+ * Add mesh and notify subscribers
4044
+ * @see {@link https://niivue.github.io/niivue/features/multiuser.meshes.html|live demo usage}
4045
+ */
4046
+ addMeshFromUrl(meshOptions: LoadFromUrlParams): Promise<NVMesh>;
4047
+ /**
4048
+ * load an array of meshes
4049
+ * @param meshList - the array of objects to load. each object must have a resolvable "url" property at a minimum
4050
+ * @returns Niivue instance
4051
+ * @example
4052
+ * niivue = new Niivue()
4053
+ * niivue.loadMeshes([\{url: 'someMesh.gii'\}])
4054
+ * @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
4055
+ */
4056
+ loadMeshes(meshList: LoadFromUrlParams[]): Promise<this>;
4057
+ /**
4058
+ * load a connectome specified by url
4059
+ * @returns Niivue instance
4060
+ * @see {@link https://niivue.github.io/niivue/features/connectome.html|live demo usage}
4061
+ */
4062
+ loadConnectomeFromUrl(url: string, headers?: {}): Promise<this>;
4063
+ /**
4064
+ * load a connectome specified by url
4065
+ * @returns Niivue instance
4066
+ * @see {@link https://niivue.github.io/niivue/features/connectome.html|live demo usage}
4067
+ */
4068
+ loadFreeSurferConnectomeFromUrl(url: string, headers?: {}): Promise<this>;
4069
+ /**
4070
+ * load a connectome specified by json
4071
+ * @param connectome - freesurfer model
4072
+ * @returns Niivue instance
4073
+ * @see {@link https://niivue.github.io/niivue/features/connectome.html|live demo usage}
4074
+ */
4075
+ loadFreeSurferConnectome(json: FreeSurferConnectome): Promise<this>;
4076
+ handleNodeAdded(event: {
4077
+ detail: {
4078
+ node: NVConnectomeNode;
4079
+ };
4080
+ }): void;
4081
+ /**
4082
+ * load a connectome specified by json
4083
+ * @param connectome - model
4084
+ * @returns Niivue instance
4085
+ * @see {@link https://niivue.github.io/niivue/features/connectome.html|live demo usage}
4086
+ */
4087
+ loadConnectome(json: Connectome | LegacyConnectome): this;
4088
+ /**
4089
+ * generate a blank canvas for the pen tool
4090
+ * @example niivue.createEmptyDrawing()
4091
+ * @see {@link https://niivue.github.io/niivue/features/cactus.html|live demo usage}
4092
+ */
4093
+ createEmptyDrawing(): void;
4094
+ r16Tex(texID: WebGLTexture | null, activeID: number, dims: number[], img16: Int16Array): WebGLTexture;
4095
+ /**
4096
+ * dilate drawing so all voxels are colored.
4097
+ * works on drawing with multiple colors
4098
+ * @example niivue.drawGrowCut();
4099
+ * @see {@link https://niivue.github.io/niivue/features/draw2.html|live demo usage}
4100
+ */
4101
+ drawGrowCut(): void;
4102
+ drawPt(x: number, y: number, z: number, penValue: number): void;
4103
+ drawPenLine(ptA: number[], ptB: number[], penValue: number): void;
4104
+ drawFloodFillCore(img: Uint8Array, seedVx: number, neighbors?: number): void;
4105
+ drawFloodFill(seedXYZ: number[], newColor?: number, growSelectedCluster?: number, // if non-zero, growth based on background intensity POSITIVE_INFINITY for selected or bright, NEGATIVE_INFINITY for selected or darker
4106
+ forceMin?: number, forceMax?: number, neighbors?: number): void;
4107
+ drawPenFilled(): void;
4108
+ /**
4109
+ * close drawing: make sure you have saved any changes before calling this!
4110
+ * @example niivue.closeDrawing();
4111
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
4112
+ */
4113
+ closeDrawing(): void;
4114
+ /**
4115
+ * copy drawing bitmap from CPU to GPU storage and redraw the screen
4116
+ * @param isForceRedraw - refreshes scene immediately (default true)
4117
+ * @example niivue.refreshDrawing();
4118
+ * @see {@link https://niivue.github.io/niivue/features/cactus.html|live demo usage}
4119
+ */
4120
+ refreshDrawing(isForceRedraw?: boolean): void;
4121
+ r8Tex(texID: WebGLTexture | null, activeID: number, dims: number[], isInit?: boolean): WebGLTexture | null;
4122
+ rgbaTex(texID: WebGLTexture | null, activeID: number, dims: number[], isInit?: boolean): WebGLTexture | null;
4123
+ requestCORSIfNotSameOrigin(img: HTMLImageElement, url: string): void;
4124
+ loadPngAsTexture(pngUrl: string, textureNum: number): Promise<WebGLTexture | null>;
4125
+ loadFontTexture(fontUrl: string): Promise<WebGLTexture | null>;
4126
+ loadBmpTexture(bmpUrl: string): Promise<WebGLTexture | null>;
4127
+ /**
4128
+ * Load matcap for illumination model.
4129
+ * @param name - name of matcap to load ("Shiny", "Cortex", "Cream")
4130
+ * @example
4131
+ * niivue.loadMatCapTexture("Cortex");
4132
+ * @see {@link https://niivue.github.io/niivue/features/shiny.volumes.html|live demo usage}
4133
+ */
4134
+ loadMatCapTexture(bmpUrl: string): Promise<WebGLTexture | null>;
4135
+ initFontMets(): void;
4136
+ /**
4137
+ * Load typeface for colorbars, measurements and orientation text.
4138
+ * @param name - name of matcap to load ("Roboto", "Garamond", "Ubuntu")
4139
+ * @example
4140
+ * niivue.loadMatCapTexture("Cortex");
4141
+ * @see {@link https://niivue.github.io/niivue/features/selectfont.html|live demo usage}
4142
+ */
4143
+ loadFont(fontSheetUrl?: any, metricsUrl?: {
4144
+ atlas: {
4145
+ type: string;
4146
+ distanceRange: number;
4147
+ size: number;
4148
+ width: number;
4149
+ height: number;
4150
+ yOrigin: string;
4151
+ };
4152
+ metrics: {
4153
+ emSize: number;
4154
+ lineHeight: number;
4155
+ ascender: number;
4156
+ descender: number;
4157
+ underlineY: number;
4158
+ underlineThickness: number;
4159
+ };
4160
+ glyphs: ({
4161
+ unicode: number;
4162
+ advance: number;
4163
+ planeBounds?: undefined;
4164
+ atlasBounds?: undefined;
4165
+ } | {
4166
+ unicode: number;
4167
+ advance: number;
4168
+ planeBounds: {
4169
+ left: number;
4170
+ bottom: number;
4171
+ right: number;
4172
+ top: number;
4173
+ };
4174
+ atlasBounds: {
4175
+ left: number;
4176
+ bottom: number;
4177
+ right: number;
4178
+ top: number;
4179
+ };
4180
+ })[];
4181
+ kerning: never[];
4182
+ }): Promise<void>;
4183
+ loadDefaultMatCap(): Promise<WebGLTexture | null>;
4184
+ loadDefaultFont(): Promise<void>;
4185
+ initText(): Promise<void>;
4186
+ meshShaderNameToNumber(meshShaderName?: string): number | undefined;
4187
+ /**
4188
+ * select new shader for triangulated meshes and connectomes. Note that this function requires the mesh is fully loaded: you may want use `await` with loadMeshes (as seen in live demo).
4189
+ * @param id - id of mesh to change
4190
+ * @param meshShaderNameOrNumber - identify shader for usage
4191
+ * @example niivue.setMeshShader('toon');
4192
+ * @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
4193
+ */
4194
+ setMeshShader(id: number, meshShaderNameOrNumber?: number): void;
4195
+ /**
4196
+ *
4197
+ * @param fragmentShaderText - custom fragment shader.
4198
+ * @param name - title for new shader.
4199
+ * @returns created custom mesh shader
4200
+ */
4201
+ createCustomMeshShader(fragmentShaderText: string, name?: string): {
4202
+ Name: string;
4203
+ Frag: string;
4204
+ shader: Shader;
4205
+ };
4206
+ /**
4207
+ * Define a new GLSL shader program to influence mesh coloration
4208
+ * @param fragmentShaderText - custom fragment shader.
4209
+ * @param ame - title for new shader.
4210
+ * @returns index of the new shader (for setMeshShader)
4211
+ * @see {@link https://niivue.github.io/niivue/features/mesh.atlas.html|live demo usage}
4212
+ */
4213
+ setCustomMeshShader(fragmentShaderText?: string, name?: string): number;
4214
+ /**
4215
+ * retrieve all currently loaded meshes
4216
+ * @param sort - sort output alphabetically
4217
+ * @returns list of available mesh shader names
4218
+ * @example niivue.meshShaderNames();
4219
+ * @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
4220
+ */
4221
+ meshShaderNames(sort?: boolean): string[];
4222
+ initRenderShader(shader: Shader, gradientAmount?: number): void;
4223
+ init(): Promise<this>;
4224
+ gradientGL(hdr: NiftiHeader): void;
4225
+ /**
4226
+ * update the webGL 2.0 scene after making changes to the array of volumes. It's always good to call this method after altering one or more volumes manually (outside of Niivue setter methods)
4227
+ * @example
4228
+ * niivue = new Niivue()
4229
+ * niivue.updateGLVolume()
4230
+ * @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
4231
+ */
4232
+ updateGLVolume(): void;
4233
+ /**
4234
+ * basic statistics for selected voxel-based image
4235
+ * @param layer - selects image to describe
4236
+ * @param masks - are optional binary images to filter voxles
4237
+ * @returns numeric values to describe image
4238
+ * @example niivue.getDescriptives(0);
4239
+ * @see {@link https://niivue.github.io/niivue/features/draw2.html|live demo usage}
4240
+ */
4241
+ getDescriptives(layer?: number, masks?: never[], drawingIsMask?: boolean): Descriptive;
4242
+ refreshLayers(overlayItem: NVImage, layer: number): void;
4243
+ /**
4244
+ * query all available color maps that can be applied to volumes
4245
+ * @param sort - whether or not to sort the returned array
4246
+ * @returns an array of colormap strings
4247
+ * @example
4248
+ * niivue = new Niivue()
4249
+ * colormaps = niivue.colormaps()
4250
+ * @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
4251
+ */
4252
+ colormaps(): string[];
4253
+ /**
4254
+ * create a new colormap
4255
+ * @param key - name of new colormap
4256
+ * @param colormap - properties (Red, Green, Blue, Alpha and Indices)
4257
+ * @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
4258
+ */
4259
+ addColormap(key: string, cmap: ColorMap): void;
4260
+ /**
4261
+ * update the colormap of an image given its ID
4262
+ * @param id - the ID of the NVImage
4263
+ * @param colormap - the name of the colormap to use
4264
+ * @example
4265
+ * niivue.setColormap(niivue.volumes[0].id,, 'red')
4266
+ * @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
4267
+ */
4268
+ setColormap(id: string, colormap: string): void;
4269
+ /**
4270
+ * darken crevices and brighten corners when 3D rendering drawings.
4271
+ * @param amount - amount of ambient occlusion (default 0.4)
4272
+ * @see {@link https://niivue.github.io/niivue/features/torso.html|live demo usage}
4273
+ */
4274
+ setRenderDrawAmbientOcclusion(ao: number): void;
4275
+ setColorMap(id: string, colormap: string): void;
4276
+ /**
4277
+ * use given color map for negative voxels in image
4278
+ * @param id - the ID of the NVImage
4279
+ * @param colormapNegative - the name of the colormap to use
4280
+ * @example
4281
+ * niivue = new Niivue()
4282
+ * niivue.setColormapNegative(niivue.volumes[1].id,"winter");
4283
+ * @see {@link https://niivue.github.io/niivue/features/mosaics2.html|live demo usage}
4284
+ */
4285
+ setColormapNegative(id: string, colormapNegative: string): void;
4286
+ /**
4287
+ * modulate intensity of one image based on intensity of another
4288
+ * @param idTarget - the ID of the NVImage to be biased
4289
+ * @param idModulation - the ID of the NVImage that controls bias (null to disable modulation)
4290
+ * @param modulateAlpha - does the modulation influence alpha transparency (values greater than 1).
4291
+ * @example niivue.setModulationImage(niivue.volumes[0].id, niivue.volumes[1].id);
4292
+ * @see {@link https://niivue.github.io/niivue/features/modulate.html|live demo scalar usage}
4293
+ * @see {@link https://niivue.github.io/niivue/features/modulateAfni.html|live demo usage}
4294
+ */
4295
+ setModulationImage(idTarget: string, idModulation: string, modulateAlpha?: number): void;
4296
+ /**
4297
+ * adjust screen gamma. Low values emphasize shadows but can appear flat, high gamma hides shadow details.
4298
+ * @param gamma - selects luminance, default is 1
4299
+ * @example niivue.setGamma(1.0);
4300
+ * @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
4301
+ */
4302
+ setGamma(gamma?: number): void;
4303
+ /** Load all volumes for image opened with `limitFrames4D`, the user can also click the `...` on a 4D timeline to load deferred volumes
4304
+ * @param id - the ID of the 4D NVImage
4305
+ **/
4306
+ loadDeferred4DVolumes(id: string): Promise<void>;
4307
+ /**
4308
+ * show desired 3D volume from 4D time series
4309
+ * @param id - the ID of the 4D NVImage
4310
+ * @param frame4D - frame to display (indexed from zero)
4311
+ * @example nv1.setFrame4D(nv1.volumes[0].id, 42);
4312
+ * @see {@link https://niivue.github.io/niivue/features/timeseries.html|live demo usage}
4313
+ */
4314
+ setFrame4D(id: string, frame4D: number): void;
4315
+ /**
4316
+ * determine active 3D volume from 4D time series
4317
+ * @param id - the ID of the 4D NVImage
4318
+ * @returns currently selected volume (indexed from 0)
4319
+ * @example nv1.getFrame4D(nv1.volumes[0].id);
4320
+ * @see {@link https://niivue.github.io/niivue/features/timeseries.html|live demo usage}
4321
+ */
4322
+ getFrame4D(id: string): number;
4323
+ colormapFromKey(name: string): ColorMap;
4324
+ colormap(lutName?: string, isInvert?: boolean): Uint8ClampedArray;
4325
+ createColormapTexture(texture?: WebGLTexture | null, nRow?: number, nCol?: number): WebGLTexture | null;
4326
+ addColormapList(nm?: string, mn?: number, mx?: number, alpha?: boolean, neg?: boolean, vis?: boolean, inv?: boolean): void;
4327
+ refreshColormaps(): this | undefined;
4328
+ sliceScale(forceVox?: boolean): SliceScale;
4329
+ tileIndex(x: number, y: number): number;
4330
+ inRenderTile(x: number, y: number): number;
4331
+ sliceScroll3D(posChange?: number): void;
4332
+ deleteThumbnail(): void;
4333
+ inGraphTile(x: number, y: number): boolean;
4334
+ mouseClick(x: number, y: number, posChange?: number, isDelta?: boolean): void;
4335
+ drawRuler(): void;
4336
+ drawRuler10cm(startXYendXY: number[]): void;
4337
+ screenXY2mm(x: number, y: number, forceSlice?: number): vec3;
4338
+ dragForPanZoom(startXYendXY: number[]): void;
4339
+ dragForCenterButton(startXYendXY: number[]): void;
4340
+ dragForSlicer3D(startXYendXY: number[]): void;
4341
+ drawMeasurementTool(startXYendXY: number[]): void;
4342
+ drawRect(leftTopWidthHeight: number[], lineColor?: number[]): void;
4343
+ drawCircle(leftTopWidthHeight: number[], circleColor?: number[], fillPercent?: number): void;
4344
+ drawSelectionBox(leftTopWidthHeight: number[]): void;
4345
+ effectiveCanvasHeight(): number;
4346
+ effectiveCanvasWidth(): number;
4347
+ getAllLabels(): NVLabel3D[];
4348
+ getBulletMarginWidth(): number;
4349
+ getLegendPanelWidth(): number;
4350
+ getLegendPanelHeight(): number;
4351
+ reserveColorbarPanel(): number[];
4352
+ drawColorbarCore(layer: number | undefined, leftTopWidthHeight: number[] | undefined, isNegativeColor: boolean | undefined, min: number | undefined, max: number | undefined, isAlphaThreshold: boolean): void;
4353
+ drawColorbar(): void;
4354
+ textWidth(scale: number, str: string): number;
4355
+ textHeight(scale: number, str: string): number;
4356
+ drawChar(xy: number[], scale: number, char: number): number;
4357
+ drawLoadingText(text: string): void;
4358
+ drawText(xy: number[], str: string, scale?: number, color?: number[] | null): void;
4359
+ drawTextRight(xy: number[], str: string, scale?: number, color?: number[] | null): void;
4360
+ drawTextLeft(xy: number[], str: string, scale?: number, color?: number[] | null): void;
4361
+ drawTextRightBelow(xy: number[], str: string, scale?: number, color?: number[] | null): void;
4362
+ drawTextBetween(startXYendXY: number[], str: string, scale?: number, color?: number[] | null): void;
4363
+ drawTextBelow(xy: number[], str: string, scale?: number, color?: number[] | null): void;
4364
+ updateInterpolation(layer: number, isForceLinear?: boolean): void;
4365
+ setAtlasOutline(isOutline: boolean): void;
4366
+ /**
4367
+ * select between nearest and linear interpolation for voxel based images
4368
+ * @param isNearest - whether nearest neighbor interpolation is used, else linear interpolation
4369
+ * @example niivue.setInterpolation(true);
4370
+ * @see {@link https://niivue.github.io/niivue/features/draw2.html|live demo usage}
4371
+ */
4372
+ setInterpolation(isNearest: boolean): void;
4373
+ calculateMvpMatrix2D(leftTopWidthHeight: number[], mn: vec3, mx: vec3, clipTolerance: number | undefined, clipDepth: number | undefined, azimuth: number | undefined, elevation: number | undefined, isRadiolgical: boolean): MvpMatrix2D;
4374
+ swizzleVec3MM(v3: vec3, axCorSag: SLICE_TYPE): vec3;
4375
+ screenFieldOfViewVox(axCorSag?: number): vec3;
4376
+ screenFieldOfViewMM(axCorSag?: number, forceSliceMM?: boolean): vec3;
4377
+ screenFieldOfViewExtendedVox(axCorSag?: number): MM;
4378
+ screenFieldOfViewExtendedMM(axCorSag?: number): MM;
4379
+ drawSliceOrientationText(leftTopWidthHeight: number[], axCorSag: SLICE_TYPE): void;
4380
+ xyMM2xyzMM(axCorSag: SLICE_TYPE, sliceFrac: number): number[];
4381
+ draw2D(leftTopWidthHeight: number[], axCorSag: SLICE_TYPE, customMM?: number): void;
4382
+ calculateMvpMatrix(_unused: unknown, leftTopWidthHeight: number[] | undefined, azimuth: number, elevation: number): mat4[];
4383
+ calculateModelMatrix(azimuth: number, elevation: number): mat4;
4384
+ calculateRayDirection(azimuth: number, elevation: number): vec3;
4385
+ sceneExtentsMinMax(isSliceMM?: boolean): vec3[];
4386
+ setPivot3D(): void;
4387
+ getMaxVols(): number;
4388
+ detectPartialllyLoaded4D(): boolean;
4389
+ drawGraph(): void;
4390
+ depthPicker(leftTopWidthHeight: number[], mvpMatrix: mat4): void;
4391
+ drawImage3D(mvpMatrix: mat4, azimuth: number, elevation: number): void;
4392
+ drawOrientationCube(leftTopWidthHeight: number[], azimuth?: number, elevation?: number): void;
4393
+ createOnLocationChange(axCorSag?: number): void;
4394
+ /**
4395
+ * Add a 3D Label
4396
+ * @param text - text of the label
4397
+ * @param style - label style
4398
+ * @param point - 3D point on the model
4399
+ */
4400
+ addLabel(text: string, style: NVLabel3DStyle, points?: number[] | number[][]): NVLabel3D;
4401
+ calculateScreenPoint(point: [number, number, number], mvpMatrix: mat4, leftTopWidthHeight: number[]): vec4;
4402
+ getLabelAtPoint(screenPoint: [number, number]): NVLabel3D | null;
4403
+ drawLabelLine(label: NVLabel3D, pos: vec2, mvpMatrix: mat4, leftTopWidthHeight: number[], secondPass?: boolean): void;
4404
+ draw3DLabel(label: NVLabel3D, pos: vec2, mvpMatrix: mat4, leftTopWidthHeight: number[], bulletMargin: number | undefined, legendWidth: number, secondPass?: boolean): void;
4405
+ draw3DLabels(mvpMatrix: mat4, leftTopWidthHeight: number[], secondPass?: boolean): void;
4406
+ draw3D(leftTopWidthHeight?: number[], mvpMatrix?: mat4 | null, modelMatrix?: mat4 | null, normalMatrix?: mat4 | null, azimuth?: number | null, elevation?: number): string | undefined;
4407
+ drawMesh3D(isDepthTest?: boolean, alpha?: number, m?: mat4, modelMtx?: mat4, normMtx?: mat4): void;
4408
+ drawCrosshairs3D(isDepthTest?: boolean, alpha?: number, mvpMtx?: mat4 | null, is2DView?: boolean, isSliceMM?: boolean): void;
4409
+ mm2frac(mm: vec3 | vec4, volIdx?: number, isForceSliceMM?: boolean): vec3;
4410
+ vox2frac(vox: vec3, volIdx?: number): vec3;
4411
+ frac2vox(frac: vec3, volIdx?: number): vec3;
4412
+ /**
4413
+ * move crosshair a fixed number of voxels (not mm)
4414
+ * @param x - translate left (-) or right (+)
4415
+ * @param y - translate posterior (-) or +anterior (+)
4416
+ * @param z - translate inferior (-) or superior (+)
4417
+ * @example niivue.moveCrosshairInVox(1, 0, 0)
4418
+ * @see {@link https://niivue.github.io/niivue/features/draw2.html|live demo usage}
4419
+ */
4420
+ moveCrosshairInVox(x: number, y: number, z: number): void;
4421
+ frac2mm(frac: vec3, volIdx?: number, isForceSliceMM?: boolean): vec4;
4422
+ screenXY2TextureFrac(x: number, y: number, i: number, restrict0to1?: boolean): vec3;
4423
+ canvasPos2frac(canvasPos: number[]): vec3;
4424
+ scaleSlice(w: number, h: number, widthPadPixels?: number, heightPadPixels?: number): number[];
4425
+ drawThumbnail(): void;
4426
+ drawLine(startXYendXY: number[], thickness?: number, lineColor?: number[]): void;
4427
+ draw3DLine(startXY: vec2, endXYZ: vec3, thickness?: number, lineColor?: number[]): void;
4428
+ drawDottedLine(startXYendXY: number[], thickness?: number, lineColor?: number[]): void;
4429
+ drawGraphLine(LTRB: number[], color?: number[], thickness?: number): void;
4430
+ drawCrossLinesMM(sliceIndex: number, axCorSag: SLICE_TYPE, axiMM: number[], corMM: number[], sagMM: number[]): void;
4431
+ drawCrossLines(sliceIndex: number, axCorSag: SLICE_TYPE, axiMM: number[], corMM: number[], sagMM: number[]): void;
4432
+ /**
4433
+ * display a lightbox or montage view
4434
+ * @param mosaicStr - specifies orientation (A,C,S) and location of slices.
4435
+ * @example niivue.setSliceMosaicString("A -10 0 20");
4436
+ * @see {@link https://niivue.github.io/niivue/features/mosaics.html|live demo usage}
4437
+ */
4438
+ drawMosaic(mosaicStr: string): void;
4439
+ drawSceneCore(): string | void;
4440
+ drawScene(): string | void;
4441
+ get gl(): WebGL2RenderingContext;
4442
+ set gl(gl: WebGL2RenderingContext | null);
4443
+ }
4444
+
4445
+ export { LabelLineTerminator, LabelTextAlignment, NVController, NVDocument, NVImage, NVImageFromUrlOptions, NVLabel3D, NVLabel3DStyle, NVMesh, NVMeshFromUrlOptions, NVUtilities, Niivue, SLICE_TYPE, cmapper, ColorTables as colortables };