@niivue/niivue 0.38.7 → 0.38.9

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,4480 @@
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
+ colormapLabel: LUT | null;
2147
+ colormapInvert?: boolean;
2148
+ nFrame4D?: number;
2149
+ frame4D: number;
2150
+ nTotalFrame4D?: number;
2151
+ cal_minNeg: number;
2152
+ cal_maxNeg: number;
2153
+ colorbarVisible: boolean;
2154
+ visible: boolean;
2155
+ modulationImage: number | null;
2156
+ modulateAlpha: number;
2157
+ series: any;
2158
+ nVox3D?: number;
2159
+ oblique_angle?: number;
2160
+ maxShearDeg?: number;
2161
+ useQFormNotSForm: boolean;
2162
+ alphaThreshold?: number;
2163
+ pixDims?: number[];
2164
+ matRAS?: mat4;
2165
+ pixDimsRAS?: number[];
2166
+ obliqueRAS?: mat4;
2167
+ dimsRAS?: number[];
2168
+ permRAS?: number[];
2169
+ toRAS?: mat4;
2170
+ toRASvox?: mat4;
2171
+ frac2mm?: mat4;
2172
+ frac2mmOrtho?: mat4;
2173
+ extentsMinOrtho?: number[];
2174
+ extentsMaxOrtho?: number[];
2175
+ mm2ortho?: mat4;
2176
+ hdr: nifti.NIFTI1 | nifti.NIFTI2 | null;
2177
+ imageType?: ImageType;
2178
+ img?: Uint8Array | Int16Array | Float32Array | Float64Array | Uint16Array;
2179
+ imaginary?: Float32Array;
2180
+ fileObject?: File | File[];
2181
+ dims?: number[];
2182
+ onColormapChange: (img: NVImage) => void;
2183
+ onOpacityChange: (img: NVImage) => void;
2184
+ mm000?: vec3;
2185
+ mm100?: vec3;
2186
+ mm010?: vec3;
2187
+ mm001?: vec3;
2188
+ cal_min?: number;
2189
+ cal_max?: number;
2190
+ robust_min?: number;
2191
+ robust_max?: number;
2192
+ global_min?: number;
2193
+ global_max?: number;
2194
+ urlImgData?: string;
2195
+ isManifest?: boolean;
2196
+ limitFrames4D?: number;
2197
+ DT_NONE: number;
2198
+ DT_UNKNOWN: number;
2199
+ DT_BINARY: number;
2200
+ DT_UNSIGNED_CHAR: number;
2201
+ DT_SIGNED_SHORT: number;
2202
+ DT_SIGNED_INT: number;
2203
+ DT_FLOAT: number;
2204
+ DT_COMPLEX: number;
2205
+ DT_DOUBLE: number;
2206
+ DT_RGB: number;
2207
+ DT_ALL: number;
2208
+ DT_INT8: number;
2209
+ DT_UINT16: number;
2210
+ DT_UINT32: number;
2211
+ DT_INT64: number;
2212
+ DT_UINT64: number;
2213
+ DT_FLOAT128: number;
2214
+ DT_COMPLEX128: number;
2215
+ DT_COMPLEX256: number;
2216
+ DT_RGBA32: number;
2217
+ /**
2218
+ *
2219
+ * @param dataBuffer - an array buffer of image data to load (there are also methods that abstract this more. See loadFromUrl, and loadFromFile)
2220
+ * @param name - a name for this image. Default is an empty string
2221
+ * @param colormap - a color map to use. default is gray
2222
+ * @param opacity - the opacity for this image. default is 1
2223
+ * @param pairedImgData - Allows loading formats where header and image are separate files (e.g. nifti.hdr, nifti.img)
2224
+ * @param cal_min - minimum intensity for color brightness/contrast
2225
+ * @param cal_max - maximum intensity for color brightness/contrast
2226
+ * @param trustCalMinMax - whether or not to trust cal_min and cal_max from the nifti header (trusting results in faster loading)
2227
+ * @param percentileFrac - the percentile to use for setting the robust range of the display values (smart intensity setting for images with large ranges)
2228
+ * @param ignoreZeroVoxels - whether or not to ignore zero voxels in setting the robust range of display values
2229
+ * @param visible - whether or not this image is to be visible
2230
+ * @param useQFormNotSForm - give precedence to QForm (Quaternion) or SForm (Matrix)
2231
+ * @param colormapNegative - a color map to use for symmetrical negative intensities
2232
+ * @param frame4D - volume displayed, 0 indexed, must be less than nFrame4D
2233
+ *
2234
+ * FIXME the following params are documented but not included in the actual constructor
2235
+ * @param onColormapChange - callback for color map change
2236
+ * @param onOpacityChange -callback for color map change
2237
+ *
2238
+ * TODO the following parameters were not documented
2239
+ * @param imageType - TODO
2240
+ * @param cal_minNeg - TODO
2241
+ * @param cal_maxNeg - TODO
2242
+ * @param colorbarVisible - TODO
2243
+ * @param colormapLabel - TODO
2244
+ */
2245
+ 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);
2246
+ computeObliqueAngle(mtx44: mat4): number;
2247
+ calculateOblique(): void;
2248
+ THD_daxes_to_NIFTI(xyzDelta: number[], xyzOrigin: number[], orientSpecific: number[]): void;
2249
+ SetPixDimFromSForm(): void;
2250
+ readDICOM(buf: ArrayBuffer | ArrayBuffer[]): ArrayBuffer;
2251
+ readECAT(buffer: ArrayBuffer): ArrayBuffer;
2252
+ readV16(buffer: ArrayBuffer): ArrayBuffer;
2253
+ readVMR(buffer: ArrayBuffer): ArrayBuffer;
2254
+ readMGH(buffer: ArrayBuffer): ArrayBuffer;
2255
+ readHEAD(dataBuffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
2256
+ readMHA(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
2257
+ readMIF(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
2258
+ readNRRD(dataBuffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
2259
+ calculateRAS(): void;
2260
+ img2RAS(): Float32Array | Uint8Array | Int16Array | Float64Array | Uint16Array;
2261
+ vox2mm(XYZ: number[], mtx: mat4): vec3;
2262
+ mm2vox(mm: number[], frac?: boolean): Float32Array | vec3;
2263
+ arrayEquals(a: unknown[], b: unknown[]): boolean;
2264
+ setColormap(cm: string): void;
2265
+ setColormapLabel(cm: ColorMap): void;
2266
+ setColormapLabelFromUrl(url: string): Promise<void>;
2267
+ get colormap(): string;
2268
+ get colorMap(): string;
2269
+ set colormap(cm: string);
2270
+ set colorMap(cm: string);
2271
+ get opacity(): number;
2272
+ set opacity(opacity: number);
2273
+ calMinMax(): number[];
2274
+ intensityRaw2Scaled(raw: number): number;
2275
+ intensityScaled2Raw(scaled: number): number;
2276
+ saveToUint8Array(fnm: string, drawing8?: Uint8Array | null): Uint8Array;
2277
+ saveToDisk(fnm: string, drawing8?: Uint8Array | null): Uint8Array;
2278
+ static fetchDicomData(url: string, headers?: Record<string, string>): Promise<ArrayBuffer[]>;
2279
+ static fetchPartial(url: string, bytesToLoad: number, headers?: Record<string, string>): Promise<Response>;
2280
+ /**
2281
+ * factory function to load and return a new NVImage instance from a given URL
2282
+ * @returns NVImage instance
2283
+ */
2284
+ 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'>> & {
2285
+ url?: string | Uint8Array | ArrayBuffer;
2286
+ }): Promise<NVImage>;
2287
+ static readFileAsync(file: File, bytesToLoad?: number): Promise<ArrayBuffer>;
2288
+ /**
2289
+ * factory function to load and return a new NVImage instance from a file in the browser
2290
+ */
2291
+ static loadFromFile({ file, // file can be an array of file objects or a single file object
2292
+ name, colormap, opacity, urlImgData, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels, visible, useQFormNotSForm, colormapNegative, frame4D, limitFrames4D, imageType }: ImageFromFileOptions): Promise<NVImage>;
2293
+ /**
2294
+ * factory function to load and return a new NVImage instance from a base64 encoded string
2295
+ *
2296
+ * @returns NVImage instance
2297
+ * @example
2298
+ * myImage = NVImage.loadFromBase64('SomeBase64String')
2299
+ */
2300
+ static loadFromBase64({ base64, name, colormap, opacity, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels, visible }: ImageFromBase64): NVImage;
2301
+ /**
2302
+ * make a clone of a NVImage instance and return a new NVImage
2303
+ * @returns NVImage instance
2304
+ * @example
2305
+ * myImage = NVImage.loadFromFile(SomeFileObject) // files can be from dialogs or drag and drop
2306
+ * clonedImage = myImage.clone()
2307
+ */
2308
+ clone(): NVImage;
2309
+ /**
2310
+ * fill a NVImage instance with zeros for the image data
2311
+ * @example
2312
+ * myImage = NVImage.loadFromFile(SomeFileObject) // files can be from dialogs or drag and drop
2313
+ * clonedImageWithZeros = myImage.clone().zeroImage()
2314
+ */
2315
+ zeroImage(): void;
2316
+ /**
2317
+ * get nifti specific metadata about the image
2318
+ */
2319
+ getImageMetadata(): ImageMetadata;
2320
+ /**
2321
+ * a factory function to make a zero filled image given a NVImage as a reference
2322
+ * @param nvImage - an existing NVImage as a reference
2323
+ * @param dataType - the output data type. Options: 'same', 'uint8'
2324
+ * @returns new NVImage filled with zeros for the image data
2325
+ * @example
2326
+ * myImage = NVImage.loadFromFile(SomeFileObject) // files can be from dialogs or drag and drop
2327
+ * newZeroImage = NVImage.zerosLike(myImage)
2328
+ */
2329
+ static zerosLike(nvImage: NVImage, dataType?: string): NVImage;
2330
+ getValue(x: number, y: number, z: number, frame4D?: number, isReadImaginary?: boolean): number;
2331
+ /**
2332
+ * @param id - id of 3D Object (is this the base volume or an overlay?)
2333
+ * @param gl - WebGL rendering context
2334
+ * @returns new 3D object in model space
2335
+ */
2336
+ toNiivueObject3D(id: number, gl: WebGL2RenderingContext): NiivueObject3D;
2337
+ /**
2338
+ * Update options for image
2339
+ */
2340
+ applyOptionsUpdate(options: ImageFromUrlOptions): void;
2341
+ getImageOptions(): ImageFromUrlOptions;
2342
+ /**
2343
+ * Converts NVImage to NIfTI compliant byte array
2344
+ */
2345
+ toUint8Array(drawingBytes?: Uint8Array | null): Uint8Array;
2346
+ }
2347
+
2348
+ type FreeSurferConnectome = {
2349
+ data_type: string;
2350
+ points: Array<{
2351
+ comments?: Array<{
2352
+ text: string;
2353
+ }>;
2354
+ coordinates: {
2355
+ x: number;
2356
+ y: number;
2357
+ z: number;
2358
+ };
2359
+ }>;
2360
+ };
2361
+ /**
2362
+ * Represents a connectome
2363
+ */
2364
+ declare class NVConnectome extends NVMesh {
2365
+ gl: WebGL2RenderingContext;
2366
+ nodesChanged: EventTarget;
2367
+ legendLineThickness?: number;
2368
+ constructor(gl: WebGL2RenderingContext, connectome: LegacyConnectome);
2369
+ static convertLegacyConnectome(json: LegacyConnectome): Connectome;
2370
+ static convertFreeSurferConnectome(json: FreeSurferConnectome, colormap?: string): Connectome;
2371
+ updateLabels(): void;
2372
+ addConnectomeNode(node: NVConnectomeNode): void;
2373
+ deleteConnectomeNode(node: NVConnectomeNode): void;
2374
+ updateConnectomeNodeByIndex(index: number, updatedNode: NVConnectomeNode): void;
2375
+ updateConnectomeNodeByPoint(point: [number, number, number], updatedNode: NVConnectomeNode): void;
2376
+ addConnectomeEdge(first: number, second: number, colorValue: number): NVConnectomeEdge;
2377
+ deleteConnectomeEdge(first: number, second: number): NVConnectomeEdge;
2378
+ findClosestConnectomeNode(point: number[], distance: number): NVConnectomeNode | null;
2379
+ updateConnectome(gl: WebGL2RenderingContext): void;
2380
+ updateMesh(gl: WebGL2RenderingContext): void;
2381
+ json(): Connectome;
2382
+ /**
2383
+ * Factory method to create connectome from options
2384
+ */
2385
+ static loadConnectomeFromUrl(gl: WebGL2RenderingContext, url: string): Promise<NVConnectome>;
2386
+ }
2387
+
2388
+ /**
2389
+ * Slice Type
2390
+ */
2391
+ declare enum SLICE_TYPE {
2392
+ AXIAL = 0,
2393
+ CORONAL = 1,
2394
+ SAGITTAL = 2,
2395
+ MULTIPLANAR = 3,
2396
+ RENDER = 4
2397
+ }
2398
+ /**
2399
+ * Multi-planar layout
2400
+ */
2401
+ declare enum MULTIPLANAR_TYPE {
2402
+ AUTO = 0,
2403
+ COLUMN = 1,
2404
+ GRID = 2,
2405
+ ROW = 3
2406
+ }
2407
+ declare enum DRAG_MODE {
2408
+ none = 0,
2409
+ contrast = 1,
2410
+ measurement = 2,
2411
+ pan = 3,
2412
+ slicer3D = 4,
2413
+ callbackOnly = 5
2414
+ }
2415
+ type NVConfigOptions = {
2416
+ textHeight: number;
2417
+ colorbarHeight: number;
2418
+ crosshairWidth: number;
2419
+ rulerWidth: number;
2420
+ show3Dcrosshair: boolean;
2421
+ backColor: number[];
2422
+ crosshairColor: number[];
2423
+ fontColor: number[];
2424
+ selectionBoxColor: number[];
2425
+ clipPlaneColor: number[];
2426
+ rulerColor: number[];
2427
+ colorbarMargin: number;
2428
+ trustCalMinMax: boolean;
2429
+ clipPlaneHotKey: string;
2430
+ viewModeHotKey: string;
2431
+ doubleTouchTimeout: number;
2432
+ longTouchTimeout: number;
2433
+ keyDebounceTime: number;
2434
+ isNearestInterpolation: boolean;
2435
+ isAtlasOutline: boolean;
2436
+ isRuler: boolean;
2437
+ isColorbar: boolean;
2438
+ isOrientCube: boolean;
2439
+ multiplanarPadPixels: number;
2440
+ multiplanarForceRender: boolean;
2441
+ isRadiologicalConvention: boolean;
2442
+ meshThicknessOn2D: number | string;
2443
+ dragMode: DRAG_MODE;
2444
+ isDepthPickMesh: boolean;
2445
+ isCornerOrientationText: boolean;
2446
+ sagittalNoseLeft: boolean;
2447
+ isSliceMM: boolean;
2448
+ isHighResolutionCapable: boolean;
2449
+ logLevel: 'debug' | 'info' | 'warn' | 'error' | 'fatal' | 'silent';
2450
+ loadingText: string;
2451
+ dragAndDropEnabled: boolean;
2452
+ drawingEnabled: boolean;
2453
+ penValue: number;
2454
+ floodFillNeighbors: number;
2455
+ isFilledPen: boolean;
2456
+ thumbnail: string;
2457
+ maxDrawUndoBitmaps: number;
2458
+ sliceType: SLICE_TYPE;
2459
+ isAntiAlias: boolean | null;
2460
+ isAdditiveBlend: boolean;
2461
+ isResizeCanvas: boolean;
2462
+ meshXRay: number;
2463
+ limitFrames4D: number;
2464
+ showLegend: boolean;
2465
+ legendBackgroundColor: number[];
2466
+ legendTextColor: number[];
2467
+ multiplanarLayout: MULTIPLANAR_TYPE;
2468
+ renderOverlayBlend: number;
2469
+ };
2470
+ declare const DEFAULT_OPTIONS: NVConfigOptions;
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
+ /**
2852
+ * Class to load different mesh formats
2853
+ */
2854
+ declare class NVMeshLoaders {
2855
+ static readTRACT(buffer: ArrayBuffer): TRACT;
2856
+ static readTRX(buffer: ArrayBuffer): TRX;
2857
+ static readTCK(buffer: ArrayBuffer): TCK;
2858
+ static readTRK(buffer: ArrayBuffer): TRK;
2859
+ static readTxtVTK(buffer: ArrayBuffer): VTK;
2860
+ static readLayer(name: string, buffer: ArrayBuffer, nvmesh: NVMesh, opacity?: number, colormap?: string, colormapNegative?: string, useNegativeCmap?: boolean, cal_min?: number | null, cal_max?: number | null, isOutlineBorder?: boolean): void;
2861
+ static readSMP(buffer: ArrayBuffer, n_vert: number): Float32Array;
2862
+ static readSTC(buffer: ArrayBuffer, n_vert: number): Float32Array;
2863
+ static readCURV(buffer: ArrayBuffer, n_vert: number): Float32Array;
2864
+ static readANNOT(buffer: ArrayBuffer, n_vert: number, isReadColortables?: boolean): ANNOT;
2865
+ static readNV(buffer: ArrayBuffer): DefaultMeshType;
2866
+ static readASC(buffer: ArrayBuffer): DefaultMeshType;
2867
+ static readVTK(buffer: ArrayBuffer): VTK;
2868
+ static readDFS(buffer: ArrayBuffer): DefaultMeshType;
2869
+ static readMZ3(buffer: ArrayBuffer, n_vert?: number): MZ3;
2870
+ static readPLY(buffer: ArrayBuffer): DefaultMeshType;
2871
+ static readICO(buffer: ArrayBuffer): DefaultMeshType;
2872
+ static readGEO(buffer: ArrayBuffer, isFlipWinding?: boolean): DefaultMeshType;
2873
+ static readOFF(buffer: ArrayBuffer): DefaultMeshType;
2874
+ static readOBJ(buffer: ArrayBuffer): DefaultMeshType;
2875
+ static readFreeSurfer(buffer: ArrayBuffer): DefaultMeshType;
2876
+ static readSRF(buffer: ArrayBuffer): DefaultMeshType;
2877
+ static readTxtSTL(buffer: ArrayBuffer): DefaultMeshType;
2878
+ static readSTL(buffer: ArrayBuffer): DefaultMeshType;
2879
+ static readNII2(buffer: ArrayBuffer, n_vert?: number, anatomicalStructurePrimary?: string): Int32Array | Float32Array | Int16Array | Uint8Array;
2880
+ static readNII(buffer: ArrayBuffer, n_vert?: number, anatomicalStructurePrimary?: string): Float32Array | Uint8Array | Int32Array | Int16Array;
2881
+ static readMGH(buffer: ArrayBuffer, n_vert?: number, isReadColortables?: boolean): MGH;
2882
+ static readX3D(buffer: ArrayBuffer): X3D;
2883
+ static readGII(buffer: ArrayBuffer, n_vert?: number): GII;
2884
+ }
2885
+
2886
+ type DragReleaseParams = {
2887
+ fracStart: vec3;
2888
+ fracEnd: vec3;
2889
+ voxStart: vec3;
2890
+ voxEnd: vec3;
2891
+ mmStart: vec4;
2892
+ mmEnd: vec4;
2893
+ mmLength: number;
2894
+ tileIdx: number;
2895
+ axCorSag: SLICE_TYPE;
2896
+ };
2897
+ type FontMetrics = {
2898
+ distanceRange: number;
2899
+ size: number;
2900
+ mets: Record<number, {
2901
+ xadv: number;
2902
+ uv_lbwh: number[];
2903
+ lbwh: number[];
2904
+ }>;
2905
+ };
2906
+ type ColormapListEntry = {
2907
+ name: string;
2908
+ min: number;
2909
+ max: number;
2910
+ alphaThreshold: boolean;
2911
+ negative: boolean;
2912
+ visible: boolean;
2913
+ invert: boolean;
2914
+ };
2915
+ type Graph = {
2916
+ LTWH: number[];
2917
+ plotLTWH?: number[];
2918
+ opacity: number;
2919
+ vols: number[];
2920
+ autoSizeMultiplanar: boolean;
2921
+ normalizeValues: boolean;
2922
+ backColor?: number[];
2923
+ lineColor?: number[];
2924
+ textColor?: number[];
2925
+ lineThickness?: number;
2926
+ lineAlpha?: number;
2927
+ lines?: number[][];
2928
+ selectedColumn?: number;
2929
+ lineRGB?: number[][];
2930
+ };
2931
+ type Descriptive = {
2932
+ mean: number;
2933
+ stdev: number;
2934
+ nvox: number;
2935
+ volumeMM3: number;
2936
+ volumeML: number;
2937
+ min: number;
2938
+ max: number;
2939
+ meanNot0: number;
2940
+ stdevNot0: number;
2941
+ nvoxNot0: number;
2942
+ minNot0: number;
2943
+ maxNot0: number;
2944
+ cal_min: number;
2945
+ cal_max: number;
2946
+ robust_min: number;
2947
+ robust_max: number;
2948
+ };
2949
+ type SliceScale = {
2950
+ volScale: number[];
2951
+ vox: number[];
2952
+ longestAxis: number;
2953
+ dimsMM: vec3;
2954
+ };
2955
+ type MvpMatrix2D = {
2956
+ modelViewProjectionMatrix: mat4;
2957
+ modelMatrix: mat4;
2958
+ normalMatrix: mat4;
2959
+ leftTopMM: number[];
2960
+ fovMM: number[];
2961
+ };
2962
+ type MM = {
2963
+ mnMM: vec3;
2964
+ mxMM: vec3;
2965
+ rotation: mat4;
2966
+ fovMM: vec3;
2967
+ };
2968
+ /**
2969
+ * Niivue exposes many properties. It's always good to call `updateGLVolume` after altering one of these settings.
2970
+ */
2971
+ type NiiVueOptions = {
2972
+ textHeight?: number;
2973
+ colorbarHeight?: number;
2974
+ colorbarMargin?: number;
2975
+ crosshairWidth?: number;
2976
+ rulerWidth?: number;
2977
+ backColor?: number[];
2978
+ crosshairColor?: number[];
2979
+ fontColor?: number[];
2980
+ selectionBoxColor?: number[];
2981
+ clipPlaneColor?: number[];
2982
+ rulerColor?: number[];
2983
+ show3Dcrosshair?: boolean;
2984
+ trustCalMinMax?: boolean;
2985
+ clipPlaneHotKey?: string;
2986
+ viewModeHotKey?: string;
2987
+ keyDebounceTime?: number;
2988
+ doubleTouchTimeout?: number;
2989
+ longTouchTimeout?: number;
2990
+ isRadiologicalConvention?: boolean;
2991
+ logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'fatal' | 'silent';
2992
+ loadingText?: string;
2993
+ dragAndDropEnabled?: boolean;
2994
+ isNearestInterpolation?: boolean;
2995
+ isAtlasOutline?: boolean;
2996
+ isRuler?: boolean;
2997
+ isColorbar?: boolean;
2998
+ isOrientCube?: boolean;
2999
+ multiplanarPadPixels?: number;
3000
+ multiplanarForceRender?: boolean;
3001
+ meshThicknessOn2D?: number;
3002
+ dragMode?: DRAG_MODE;
3003
+ isDepthPickMesh?: boolean;
3004
+ isCornerOrientationText?: boolean;
3005
+ sagittalNoseLeft?: boolean;
3006
+ isSliceMM?: boolean;
3007
+ isHighResolutionCapable?: boolean;
3008
+ drawingEnabled?: boolean;
3009
+ penValue?: number;
3010
+ floodFillNeighbors?: number;
3011
+ maxDrawUndoBitmaps?: number;
3012
+ thumbnail?: string;
3013
+ };
3014
+ type UIData = {
3015
+ mousedown: boolean;
3016
+ touchdown: boolean;
3017
+ mouseButtonLeftDown: boolean;
3018
+ mouseButtonCenterDown: boolean;
3019
+ mouseButtonRightDown: boolean;
3020
+ mouseDepthPicker: boolean;
3021
+ clickedTile: number;
3022
+ pan2DxyzmmAtMouseDown: vec4;
3023
+ prevX: number;
3024
+ prevY: number;
3025
+ currX: number;
3026
+ currY: number;
3027
+ currentTouchTime: number;
3028
+ lastTouchTime: number;
3029
+ touchTimer: NodeJS.Timeout | null;
3030
+ doubleTouch: boolean;
3031
+ isDragging: boolean;
3032
+ dragStart: number[];
3033
+ dragEnd: number[];
3034
+ dragClipPlaneStartDepthAziElev: number[];
3035
+ lastTwoTouchDistance: number;
3036
+ multiTouchGesture: boolean;
3037
+ loading$: Subject<unknown>;
3038
+ dpr?: number;
3039
+ };
3040
+ /**
3041
+ * Niivue can be attached to a canvas. An instance of Niivue contains methods for
3042
+ * loading and rendering NIFTI image data in a WebGL 2.0 context.
3043
+ *
3044
+ * @example
3045
+ * let niivue = new Niivue(\{crosshairColor: [0,1,0,0.5], textHeight: 0.5\}) // a see-through green crosshair, and larger text labels
3046
+ */
3047
+ declare class Niivue {
3048
+ canvas: HTMLCanvasElement | null;
3049
+ _gl: WebGL2RenderingContext | null;
3050
+ isBusy: boolean;
3051
+ needsRefresh: boolean;
3052
+ colormapTexture: WebGLTexture | null;
3053
+ colormapLists: ColormapListEntry[];
3054
+ volumeTexture: WebGLTexture | null;
3055
+ gradientTexture: WebGLTexture | null;
3056
+ gradientTextureAmount: number;
3057
+ drawTexture: WebGLTexture | null;
3058
+ drawUndoBitmaps: Uint8Array[];
3059
+ drawLut: LUT;
3060
+ drawOpacity: number;
3061
+ renderDrawAmbientOcclusion: number;
3062
+ colorbarHeight: number;
3063
+ drawPenLocation: number[];
3064
+ drawPenAxCorSag: number;
3065
+ drawFillOverwrites: boolean;
3066
+ drawPenFillPts: number[][];
3067
+ overlayTexture: WebGLTexture | null;
3068
+ overlayTextureID: WebGLTexture | null;
3069
+ sliceMMShader?: Shader;
3070
+ orientCubeShader?: Shader;
3071
+ orientCubeShaderVAO: WebGLVertexArrayObject | null;
3072
+ rectShader?: Shader;
3073
+ renderShader?: Shader;
3074
+ lineShader?: Shader;
3075
+ line3DShader?: Shader;
3076
+ passThroughShader?: Shader;
3077
+ renderGradientShader?: Shader;
3078
+ renderSliceShader?: Shader;
3079
+ renderVolumeShader?: Shader;
3080
+ pickingMeshShader?: Shader;
3081
+ pickingImageShader?: Shader;
3082
+ colorbarShader?: Shader;
3083
+ fontShader: Shader | null;
3084
+ fiberShader?: Shader;
3085
+ fontTexture: WebGLTexture | null;
3086
+ circleShader?: Shader;
3087
+ matCapTexture: WebGLTexture | null;
3088
+ bmpShader: Shader | null;
3089
+ bmpTexture: WebGLTexture | null;
3090
+ thumbnailVisible: boolean;
3091
+ bmpTextureWH: number;
3092
+ growCutShader?: Shader;
3093
+ orientShaderAtlasU: Shader | null;
3094
+ orientShaderAtlasI: Shader | null;
3095
+ orientShaderU: Shader | null;
3096
+ orientShaderI: Shader | null;
3097
+ orientShaderF: Shader | null;
3098
+ orientShaderRGBU: Shader | null;
3099
+ surfaceShader: Shader | null;
3100
+ blurShader: Shader | null;
3101
+ sobelShader: Shader | null;
3102
+ genericVAO: WebGLVertexArrayObject | null;
3103
+ unusedVAO: null;
3104
+ crosshairs3D: NiivueObject3D | null;
3105
+ DEFAULT_FONT_GLYPH_SHEET: any;
3106
+ DEFAULT_FONT_METRICS: {
3107
+ atlas: {
3108
+ type: string;
3109
+ distanceRange: number;
3110
+ size: number;
3111
+ width: number;
3112
+ height: number;
3113
+ yOrigin: string;
3114
+ };
3115
+ metrics: {
3116
+ emSize: number;
3117
+ lineHeight: number;
3118
+ ascender: number;
3119
+ descender: number;
3120
+ underlineY: number;
3121
+ underlineThickness: number;
3122
+ };
3123
+ glyphs: ({
3124
+ unicode: number;
3125
+ advance: number;
3126
+ planeBounds?: undefined;
3127
+ atlasBounds?: undefined;
3128
+ } | {
3129
+ unicode: number;
3130
+ advance: number;
3131
+ planeBounds: {
3132
+ left: number;
3133
+ bottom: number;
3134
+ right: number;
3135
+ top: number;
3136
+ };
3137
+ atlasBounds: {
3138
+ left: number;
3139
+ bottom: number;
3140
+ right: number;
3141
+ top: number;
3142
+ };
3143
+ })[];
3144
+ kerning: never[];
3145
+ };
3146
+ fontMetrics?: typeof defaultFontMetrics;
3147
+ fontMets: FontMetrics | null;
3148
+ backgroundMasksOverlays: number;
3149
+ overlayOutlineWidth: number;
3150
+ overlayAlphaShader: number;
3151
+ isAlphaClipDark: boolean;
3152
+ position?: vec3;
3153
+ extentsMin?: vec3;
3154
+ extentsMax?: vec3;
3155
+ syncOpts: Record<string, unknown>;
3156
+ readyForSync: boolean;
3157
+ uiData: UIData;
3158
+ eventsToSubjects: Record<string, Subject<unknown>>;
3159
+ back: NVImage | null;
3160
+ overlays: NVImage[];
3161
+ deferredVolumes: ImageFromUrlOptions[];
3162
+ deferredMeshes: LoadFromUrlParams[];
3163
+ furthestVertexFromOrigin: number;
3164
+ volScale: number[];
3165
+ vox: number[];
3166
+ mousePos: number[];
3167
+ screenSlices: Array<{
3168
+ leftTopWidthHeight: number[];
3169
+ axCorSag: SLICE_TYPE;
3170
+ sliceFrac: number;
3171
+ AxyzMxy: number[];
3172
+ leftTopMM: number[];
3173
+ fovMM: number[];
3174
+ screen2frac?: number[];
3175
+ }>;
3176
+ cuboidVertexBuffer?: WebGLBuffer;
3177
+ otherNV: Niivue | Niivue[] | null;
3178
+ volumeObject3D: NiivueObject3D | null;
3179
+ pivot3D: number[];
3180
+ furthestFromPivot: number;
3181
+ currentClipPlaneIndex: number;
3182
+ lastCalled: number;
3183
+ selectedObjectId: number;
3184
+ CLIP_PLANE_ID: number;
3185
+ VOLUME_ID: number;
3186
+ DISTANCE_FROM_CAMERA: number;
3187
+ graph: Graph;
3188
+ meshShaders: Array<{
3189
+ Name: string;
3190
+ Frag: string;
3191
+ shader?: Shader;
3192
+ }>;
3193
+ dragModes: {
3194
+ contrast: DRAG_MODE;
3195
+ measurement: DRAG_MODE;
3196
+ none: DRAG_MODE;
3197
+ pan: DRAG_MODE;
3198
+ slicer3D: DRAG_MODE;
3199
+ callbackOnly: DRAG_MODE;
3200
+ };
3201
+ sliceTypeAxial: SLICE_TYPE;
3202
+ sliceTypeCoronal: SLICE_TYPE;
3203
+ sliceTypeSagittal: SLICE_TYPE;
3204
+ sliceTypeMultiplanar: SLICE_TYPE;
3205
+ sliceTypeRender: SLICE_TYPE;
3206
+ sliceMosaicString: string;
3207
+ /**
3208
+ * callback function to run when the right mouse button is released after dragging
3209
+ * @example
3210
+ * niivue.onDragRelease = () =\> \{
3211
+ * console.log('drag ended')
3212
+ * \}
3213
+ */
3214
+ onDragRelease: (params: DragReleaseParams) => void;
3215
+ /**
3216
+ * callback function to run when the left mouse button is released
3217
+ * @example
3218
+ * niivue.onMouseUp = () =\> \{
3219
+ * console.log('mouse up')
3220
+ * \}
3221
+ */
3222
+ onMouseUp: (data: Partial<UIData>) => void;
3223
+ /**
3224
+ * callback function to run when the crosshair location changes
3225
+ * @example
3226
+ * niivue.onLocationChange = (data) =\> \{
3227
+ * console.log('location changed')
3228
+ * console.log('mm: ', data.mm)
3229
+ * console.log('vox: ', data.vox)
3230
+ * console.log('frac: ', data.frac)
3231
+ * console.log('values: ', data.values)
3232
+ * \}
3233
+ */
3234
+ onLocationChange: (location: unknown) => void;
3235
+ /**
3236
+ * callback function to run when the user changes the intensity range with the selection box action (right click)
3237
+ * @example
3238
+ * niivue.onIntensityChange = (volume) =\> \{
3239
+ * console.log('intensity changed')
3240
+ * console.log('volume: ', volume)
3241
+ * \}
3242
+ */
3243
+ onIntensityChange: (volume: NVImage) => void;
3244
+ /**
3245
+ * callback function to run when a new volume is loaded
3246
+ * @example
3247
+ * niivue.onImageLoaded = (volume) =\> \{
3248
+ * console.log('volume loaded')
3249
+ * console.log('volume: ', volume)
3250
+ * \}
3251
+ */
3252
+ onImageLoaded: (volume: NVImage) => void;
3253
+ /**
3254
+ * callback function to run when a new mesh is loaded
3255
+ * @example
3256
+ * niivue.onMeshLoaded = (mesh) =\> \{
3257
+ * console.log('mesh loaded')
3258
+ * console.log('mesh: ', mesh)
3259
+ * \}
3260
+ */
3261
+ onMeshLoaded: (mesh: NVMesh) => void;
3262
+ /**
3263
+ * callback function to run when the user changes the volume when a 4D image is loaded
3264
+ * @example
3265
+ * niivue.onFrameChange = (volume, frameNumber) =\> \{
3266
+ * console.log('frame changed')
3267
+ * console.log('volume: ', volume)
3268
+ * console.log('frameNumber: ', frameNumber)
3269
+ * \}
3270
+ */
3271
+ onFrameChange: (volume: NVImage, index: number) => void;
3272
+ /**
3273
+ * callback function to run when niivue reports an error
3274
+ * @example
3275
+ * niivue.onError = (error) =\> \{
3276
+ * console.log('error: ', error)
3277
+ * \}
3278
+ */
3279
+ onError: () => void;
3280
+ onColormapChange: () => void;
3281
+ /**
3282
+ * callback function to run when niivue reports detailed info
3283
+ * @example
3284
+ * niivue.onInfo = (info) =\> \{
3285
+ * console.log('info: ', info)
3286
+ * \}
3287
+ */
3288
+ onInfo: () => void;
3289
+ /**
3290
+ * callback function to run when niivue reports a warning
3291
+ * @example
3292
+ * niivue.onWarn = (warn) =\> \{
3293
+ * console.log('warn: ', warn)
3294
+ * \}
3295
+ */
3296
+ onWarn: () => void;
3297
+ /**
3298
+ * callback function to run when niivue reports a debug message
3299
+ * @example
3300
+ * niivue.onDebug = (debug) =\> \{
3301
+ * console.log('debug: ', debug)
3302
+ * \}
3303
+ */
3304
+ onDebug: () => void;
3305
+ /**
3306
+ * callback function to run when a volume is added from a url
3307
+ * @example
3308
+ * niivue.onVolumeAddedFromUrl = (imageOptions, volume) =\> \{
3309
+ * console.log('volume added from url')
3310
+ * console.log('imageOptions: ', imageOptions)
3311
+ * console.log('volume: ', volume)
3312
+ * \}
3313
+ */
3314
+ onVolumeAddedFromUrl: (imageOptions: ImageFromUrlOptions, volume: NVImage) => void;
3315
+ onVolumeWithUrlRemoved: (url: string) => void;
3316
+ /**
3317
+ * callback function to run when updateGLVolume is called (most users will not need to use
3318
+ * @example
3319
+ * niivue.onVolumeUpdated = () =\> \{
3320
+ * console.log('volume updated')
3321
+ * \}
3322
+ */
3323
+ onVolumeUpdated: () => void;
3324
+ /**
3325
+ * callback function to run when a mesh is added from a url
3326
+ * @example
3327
+ * niivue.onMeshAddedFromUrl = (meshOptions, mesh) =\> \{
3328
+ * console.log('mesh added from url')
3329
+ * console.log('meshOptions: ', meshOptions)
3330
+ * console.log('mesh: ', mesh)
3331
+ * \}
3332
+ */
3333
+ onMeshAddedFromUrl: (meshOptions: LoadFromUrlParams, mesh: NVMesh) => void;
3334
+ onMeshAdded: () => void;
3335
+ onMeshWithUrlRemoved: (url: string) => void;
3336
+ onZoom3DChange: (zoom: number) => void;
3337
+ /**
3338
+ * callback function to run when the user changes the rotation of the 3D rendering
3339
+ * @example
3340
+ * niivue.onAzimuthElevationChange = (azimuth, elevation) =\> \{
3341
+ * console.log('azimuth: ', azimuth)
3342
+ * console.log('elevation: ', elevation)
3343
+ * \}
3344
+ */
3345
+ onAzimuthElevationChange: (azimuth: number, elevation: number) => void;
3346
+ /**
3347
+ * callback function to run when the user changes the clip plane
3348
+ * @example
3349
+ * niivue.onClipPlaneChange = (clipPlane) =\> \{
3350
+ * console.log('clipPlane: ', clipPlane)
3351
+ * \}
3352
+ */
3353
+ onClipPlaneChange: (clipPlane: number[]) => void;
3354
+ onCustomMeshShaderAdded: (fragmentShaderText: string, name: string) => void;
3355
+ onMeshShaderChanged: (meshIndex: number, shaderIndex: number) => void;
3356
+ onMeshPropertyChanged: (meshIndex: number, key: string, val: unknown) => void;
3357
+ /**
3358
+ * callback function to run when the user loads a new NiiVue document
3359
+ * @example
3360
+ * niivue.onDocumentLoaded = (document) =\> \{
3361
+ * console.log('document: ', document)
3362
+ * \}
3363
+ */
3364
+ onDocumentLoaded: (document: NVDocument) => void;
3365
+ document: NVDocument;
3366
+ opts: {
3367
+ textHeight: number;
3368
+ colorbarHeight: number;
3369
+ crosshairWidth: number;
3370
+ rulerWidth: number;
3371
+ show3Dcrosshair: boolean;
3372
+ backColor: number[];
3373
+ crosshairColor: number[];
3374
+ fontColor: number[];
3375
+ selectionBoxColor: number[];
3376
+ clipPlaneColor: number[];
3377
+ rulerColor: number[];
3378
+ colorbarMargin: number;
3379
+ trustCalMinMax: boolean;
3380
+ clipPlaneHotKey: string;
3381
+ viewModeHotKey: string;
3382
+ doubleTouchTimeout: number;
3383
+ longTouchTimeout: number;
3384
+ keyDebounceTime: number;
3385
+ isNearestInterpolation: boolean;
3386
+ isAtlasOutline: boolean;
3387
+ isRuler: boolean;
3388
+ isColorbar: boolean;
3389
+ isOrientCube: boolean;
3390
+ multiplanarPadPixels: number;
3391
+ multiplanarForceRender: boolean;
3392
+ isRadiologicalConvention: boolean;
3393
+ meshThicknessOn2D: string | number;
3394
+ dragMode: DRAG_MODE;
3395
+ isDepthPickMesh: boolean;
3396
+ isCornerOrientationText: boolean;
3397
+ sagittalNoseLeft: boolean;
3398
+ isSliceMM: boolean;
3399
+ isHighResolutionCapable: boolean;
3400
+ logLevel: "debug" | "info" | "warn" | "error" | "fatal" | "silent";
3401
+ loadingText: string;
3402
+ dragAndDropEnabled: boolean;
3403
+ drawingEnabled: boolean;
3404
+ penValue: number;
3405
+ floodFillNeighbors: number;
3406
+ isFilledPen: boolean;
3407
+ thumbnail: string;
3408
+ maxDrawUndoBitmaps: number;
3409
+ sliceType: SLICE_TYPE;
3410
+ isAntiAlias: boolean | null;
3411
+ isAdditiveBlend: boolean;
3412
+ isResizeCanvas: boolean;
3413
+ meshXRay: number;
3414
+ limitFrames4D: number;
3415
+ showLegend: boolean;
3416
+ legendBackgroundColor: number[];
3417
+ legendTextColor: number[];
3418
+ multiplanarLayout: MULTIPLANAR_TYPE;
3419
+ renderOverlayBlend: number;
3420
+ };
3421
+ scene: {
3422
+ onAzimuthElevationChange: (azimuth: number, elevation: number) => void;
3423
+ onZoom3DChange: (scale: number) => void;
3424
+ sceneData: {
3425
+ azimuth: number;
3426
+ elevation: number;
3427
+ crosshairPos: vec3;
3428
+ clipPlane: number[];
3429
+ clipPlaneDepthAziElev: number[];
3430
+ volScaleMultiplier: number;
3431
+ pan2Dxyzmm: vec4;
3432
+ };
3433
+ renderAzimuth: number;
3434
+ renderElevation: number;
3435
+ volScaleMultiplier: number;
3436
+ crosshairPos: vec3;
3437
+ clipPlane: number[];
3438
+ clipPlaneDepthAziElev: number[];
3439
+ pan2Dxyzmm: vec4;
3440
+ _elevation?: number | undefined;
3441
+ _azimuth?: number | undefined;
3442
+ };
3443
+ mediaUrlMap: Map<NVImage | NVMesh, string>;
3444
+ initialized: boolean;
3445
+ currentDrawUndoBitmap: number;
3446
+ loadingText: string;
3447
+ subscriptions: Array<Record<string, Subscription>>;
3448
+ /**
3449
+ * @param options - options object to set modifiable Niivue properties
3450
+ */
3451
+ constructor(options?: Partial<NiiVueOptions>);
3452
+ get volumes(): NVImage[];
3453
+ set volumes(volumes: NVImage[]);
3454
+ get meshes(): NVMesh[];
3455
+ set meshes(meshes: NVMesh[]);
3456
+ get drawBitmap(): Uint8Array | null;
3457
+ set drawBitmap(drawBitmap: Uint8Array | null);
3458
+ get volScaleMultiplier(): number;
3459
+ set volScaleMultiplier(scale: number);
3460
+ /**
3461
+ * save webgl2 canvas as png format bitmap
3462
+ * @param filename - filename for screen capture
3463
+ * @example niivue.saveScene('test.png');
3464
+ * @see {@link https://niivue.github.io/niivue/features/ui.html|live demo usage}
3465
+ */
3466
+ saveScene(filename?: string): Promise<void>;
3467
+ /**
3468
+ * attach the Niivue instance to the webgl2 canvas by element id
3469
+ * @param id - the id of an html canvas element
3470
+ * @param isAntiAlias - determines if anti-aliasing is requested (if not specified, AA usage depends on hardware)
3471
+ * @example niivue = new Niivue().attachTo('gl')
3472
+ * @example niivue.attachTo('gl')
3473
+ * @see {@link https://niivue.github.io/niivue/features/multiplanar.html|live demo usage}
3474
+ */
3475
+ attachTo(id: string, isAntiAlias?: null): Promise<this>;
3476
+ /**
3477
+ * register a callback function to run when known Niivue events happen
3478
+ * @param event - the name of the event to watch for. Event names are shown in the type column
3479
+ * @param callback - the function to call when the event happens
3480
+ * @example
3481
+ * niivue = new Niivue()
3482
+ *
3483
+ * // 'location' update event is fired when the crosshair changes position via user input
3484
+ * function doSomethingWithLocationData(data)\{
3485
+ * // data has the shape \{mm: [N, N, N], vox: [N, N, N], frac: [N, N, N], values: this.volumes.map(v =\> \{return val\})\}
3486
+ * //...
3487
+ * \}
3488
+ */
3489
+ on(event: string, callback: (data: unknown) => void): void;
3490
+ /**
3491
+ * off unsubscribes events and subjects (the opposite of on)
3492
+ * @param event - the name of the event to watch for. Event names are shown in the type column
3493
+ * @example
3494
+ * niivue = new Niivue()
3495
+ * niivue.off('location')
3496
+ */
3497
+ off(event: string): void;
3498
+ /**
3499
+ * attach the Niivue instance to a canvas element directly
3500
+ * @param canvas - the canvas element reference
3501
+ * @example
3502
+ * niivue = new Niivue()
3503
+ * niivue.attachToCanvas(document.getElementById(id))
3504
+ */
3505
+ attachToCanvas(canvas: HTMLCanvasElement, isAntiAlias?: boolean | null): Promise<this>;
3506
+ /**
3507
+ * Sync the scene controls (orientation, crosshair location, etc.) from one Niivue instance to another. useful for using one canvas to drive another.
3508
+ * @param otherNV - the other Niivue instance that is the main controller
3509
+ * @example
3510
+ * niivue1 = new Niivue()
3511
+ * niivue2 = new Niivue()
3512
+ * niivue2.syncWith(niivue1)
3513
+ * @deprecated use broadcastTo instead
3514
+ * @see {@link https://niivue.github.io/niivue/features/sync.mesh.html|live demo usage}
3515
+ */
3516
+ syncWith(otherNV: Niivue, syncOpts?: {
3517
+ '2d': boolean;
3518
+ '3d': boolean;
3519
+ }): void;
3520
+ /**
3521
+ * Sync the scene controls (orientation, crosshair location, etc.) from one Niivue instance to others. useful for using one canvas to drive another.
3522
+ * @param otherNV - the other Niivue instance(s)
3523
+ * @example
3524
+ * niivue1 = new Niivue()
3525
+ * niivue2 = new Niivue()
3526
+ * niivue3 = new Niivue()
3527
+ * niivue1.broadcastTo(niivue2)
3528
+ * niivue1.broadcastTo([niivue2, niivue3])
3529
+ * @see {@link https://niivue.github.io/niivue/features/sync.mesh.html|live demo usage}
3530
+ */
3531
+ broadcastTo(otherNV: Niivue | Niivue[], syncOpts?: {
3532
+ '2d': boolean;
3533
+ '3d': boolean;
3534
+ }): void;
3535
+ /**
3536
+ * Sync the scene controls (orientation, crosshair location, etc.) from one Niivue instance to another. useful for using one canvas to drive another.
3537
+ * @internal
3538
+ * @example
3539
+ * niivue1 = new Niivue()
3540
+ * niivue2 = new Niivue()
3541
+ * niivue2.syncWith(niivue1)
3542
+ * niivue2.sync()
3543
+ */
3544
+ sync(): void;
3545
+ /** Not documented publicly for now
3546
+ * test if two arrays have equal values for each element
3547
+ * @param a - the first array
3548
+ * @param b - the second array
3549
+ * @example Niivue.arrayEquals(a, b)
3550
+ *
3551
+ * TODO this should maybe just use array-equal from NPM
3552
+ */
3553
+ arrayEquals(a: unknown[], b: unknown[]): boolean;
3554
+ /**
3555
+ * callback function to handle resize window events, redraws the scene.
3556
+ * @internal
3557
+ */
3558
+ resizeListener(): void;
3559
+ /**
3560
+ * callback to handle mouse move events relative to the canvas
3561
+ * @internal
3562
+ * @returns the mouse position relative to the canvas
3563
+ */
3564
+ getRelativeMousePosition(event: MouseEvent, target?: EventTarget | null): {
3565
+ x: number;
3566
+ y: number;
3567
+ } | undefined;
3568
+ getNoPaddingNoBorderCanvasRelativeMousePosition(event: MouseEvent, target: EventTarget): {
3569
+ x: number;
3570
+ y: number;
3571
+ } | undefined;
3572
+ mouseContextMenuListener(e: MouseEvent): void;
3573
+ mouseDownListener(e: MouseEvent): void;
3574
+ mouseLeftButtonHandler(e: MouseEvent): void;
3575
+ mouseCenterButtonHandler(e: MouseEvent): void;
3576
+ mouseRightButtonHandler(e: MouseEvent): void;
3577
+ /**
3578
+ * calculate the the min and max voxel indices from an array of two values (used in selecting intensities with the selection box)
3579
+ * @param array - an array of two values
3580
+ * @returns an array of two values representing the min and max voxel indices
3581
+ */
3582
+ calculateMinMaxVoxIdx(array: number[]): number[];
3583
+ calculateNewRange({ volIdx }?: {
3584
+ volIdx?: number | undefined;
3585
+ }): void;
3586
+ generateMouseUpCallback(fracStart: vec3, fracEnd: vec3): void;
3587
+ mouseUpListener(): void;
3588
+ checkMultitouch(e: TouchEvent): void;
3589
+ touchStartListener(e: TouchEvent): void;
3590
+ touchEndListener(e: TouchEvent): void;
3591
+ mouseMoveListener(e: MouseEvent): void;
3592
+ resetBriCon(msg?: TouchEvent | MouseEvent | null): void;
3593
+ setDragStart(x: number, y: number): void;
3594
+ setDragEnd(x: number, y: number): void;
3595
+ touchMoveListener(e: TouchEvent): void;
3596
+ handlePinchZoom(e: TouchEvent): void;
3597
+ keyUpListener(e: KeyboardEvent): void;
3598
+ keyDownListener(e: KeyboardEvent): void;
3599
+ wheelListener(e: WheelEvent): void;
3600
+ registerInteractions(): void;
3601
+ dragEnterListener(e: MouseEvent): void;
3602
+ dragOverListener(e: MouseEvent): void;
3603
+ getFileExt(fullname: string, upperCase?: boolean): string;
3604
+ /**
3605
+ * Add an image and notify subscribers
3606
+ * @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
3607
+ */
3608
+ addVolumeFromUrl(imageOptions: ImageFromUrlOptions): Promise<NVImage>;
3609
+ /**
3610
+ * Find media by url
3611
+ */
3612
+ getMediaByUrl(url: string): NVImage | NVMesh | undefined;
3613
+ /**
3614
+ * Remove volume by url
3615
+ * @param url - Volume added by url to remove
3616
+ * @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
3617
+ */
3618
+ removeVolumeByUrl(url: string): void;
3619
+ readDirectory(directory: FileSystemDirectoryEntry): FileSystemEntry[];
3620
+ /**
3621
+ * Returns boolean: true if filename ends with mesh extension (TRK, pial, etc)
3622
+ * @param url - filename
3623
+ */
3624
+ isMeshExt(url: string): boolean;
3625
+ dropListener(e: DragEvent): void;
3626
+ /**
3627
+ * insert a gap between slices of a mutliplanar view.
3628
+ * @param pixels - spacing between tiles of multiplanar view
3629
+ * @example niivue.setMultiplanarPadPixels(4)
3630
+ * @see {@link https://niivue.github.io/niivue/features/atlas.html|live demo usage}
3631
+ */
3632
+ setMultiplanarPadPixels(pixels: number): void;
3633
+ /**
3634
+ * control placement of 2D slices.
3635
+ * @param layout - AUTO: 0, COLUMN: 1, GRID: 2, ROW: 3,
3636
+ * @example niivue.setMultiplanarLayout(2)
3637
+ * @see {@link https://niivue.github.io/niivue/features/layout.html|live demo usage}
3638
+ */
3639
+ setMultiplanarLayout(layout: number): void;
3640
+ /**
3641
+ * determine if text appears at corner (true) or sides of 2D slice.
3642
+ * @param isCornerOrientationText - controls position of text
3643
+ * @example niivue.setCornerOrientationText(true)
3644
+ * @see {@link https://niivue.github.io/niivue/features/worldspace2.html|live demo usage}
3645
+ */
3646
+ setCornerOrientationText(isCornerOrientationText: boolean): void;
3647
+ /**
3648
+ * control whether 2D slices use radiological or neurological convention.
3649
+ * @param isRadiologicalConvention - new display convention
3650
+ * @example niivue.setCornerOrientationText(true)
3651
+ * @see {@link https://niivue.github.io/niivue/features/worldspace.html|live demo usage}
3652
+ */
3653
+ setRadiologicalConvention(isRadiologicalConvention: boolean): void;
3654
+ /**
3655
+ * Reset scene to default settings.
3656
+ * @param options - @see NiiVueOptions
3657
+ * @param resetBriCon - also reset contrast (default false).
3658
+ * @example niivue.nv1.setDefaults(opts, true);
3659
+ * @see {@link https://niivue.github.io/niivue/features/connectome.html|live demo usage}
3660
+ */
3661
+ setDefaults(options?: Partial<NiiVueOptions>, resetBriCon?: boolean): void;
3662
+ /**
3663
+ * Limit visibility of mesh in front of a 2D image. Requires world-space mode.
3664
+ * @param meshThicknessOn2D - distance from voxels for clipping mesh. Use Infinity to show entire mesh or 0.0 to hide mesh.
3665
+ * @example niivue.setMeshThicknessOn2D(42)
3666
+ * @see {@link https://niivue.github.io/niivue/features/worldspace2.html|live demo usage}
3667
+ */
3668
+ setMeshThicknessOn2D(meshThicknessOn2D: number): void;
3669
+ /**
3670
+ * Create a custom multi-slice mosaic (aka lightbox, montage) view.
3671
+ * @param str - description of mosaic.
3672
+ * @example niivue.setSliceMosaicString("A 0 20 C 30 S 42")
3673
+ * @see {@link https://niivue.github.io/niivue/features/mosaics.html|live demo usage}
3674
+ */
3675
+ setSliceMosaicString(str: string): void;
3676
+ /**
3677
+ * control 2D slice view mode.
3678
+ * @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.
3679
+ * @example niivue.setSliceMM(true)
3680
+ * @see {@link https://niivue.github.io/niivue/features/worldspace2.html|live demo usage}
3681
+ */
3682
+ setSliceMM(isSliceMM: boolean): void;
3683
+ /**
3684
+ * control whether voxel overlays are combined using additive (emission) or traditional (transmission) blending.
3685
+ * @param isAdditiveBlend - emission (true) or transmission (false) mixing
3686
+ * @example niivue.isAdditiveBlend(true)
3687
+ * @see {@link https://niivue.github.io/niivue/features/additive.voxels.html|live demo usage}
3688
+ */
3689
+ setAdditiveBlend(isAdditiveBlend: boolean): void;
3690
+ /**
3691
+ * Detect if display is using radiological or neurological convention.
3692
+ * @returns radiological convention status
3693
+ * @example let rc = niivue.getRadiologicalConvention()
3694
+ */
3695
+ getRadiologicalConvention(): boolean;
3696
+ /**
3697
+ * Force WebGL canvas to use high resolution display, regardless of browser defaults.
3698
+ * @param isHighResolutionCapable - allow high-DPI display
3699
+ * @example niivue.setHighResolutionCapable(true);
3700
+ * @see {@link https://niivue.github.io/niivue/features/sync.mesh.html|live demo usage}
3701
+ */
3702
+ setHighResolutionCapable(isHighResolutionCapable: boolean): void;
3703
+ /**
3704
+ * add a new volume to the canvas
3705
+ * @param volume - the new volume to add to the canvas
3706
+ * @example
3707
+ * niivue = new Niivue()
3708
+ * niivue.addVolume(NVImage.loadFromUrl(\{url:'../someURL.nii.gz'\}))
3709
+ * @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
3710
+ */
3711
+ addVolume(volume: NVImage): void;
3712
+ /**
3713
+ * add a new mesh to the canvas
3714
+ * @param mesh - the new mesh to add to the canvas
3715
+ * @example
3716
+ * niivue = new Niivue()
3717
+ * niivue.addMesh(NVMesh.loadFromUrl(\{url:'../someURL.gii'\}))
3718
+ * @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
3719
+ */
3720
+ addMesh(mesh: NVMesh): void;
3721
+ /**
3722
+ * 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.
3723
+ * @param id - the id string to search for
3724
+ * @example
3725
+ * niivue = new Niivue()
3726
+ * niivue.getVolumeIndexByID(someVolume.id)
3727
+ */
3728
+ getVolumeIndexByID(id: string): number;
3729
+ drawAddUndoBitmap(): void;
3730
+ drawClearAllUndoBitmaps(): void;
3731
+ /**
3732
+ * Restore drawing to previous state
3733
+ * @example niivue.drawUndo();
3734
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
3735
+ */
3736
+ drawUndo(): void;
3737
+ loadDrawing(drawingBitmap: NVImage): boolean;
3738
+ binarize(volume: NVImage): void;
3739
+ /**
3740
+ * Open drawing
3741
+ * @param filename - of NIfTI format drawing
3742
+ * @param isBinarize - if true will force drawing voxels to be either 0 or 1.
3743
+ * @example niivue.loadDrawingFromUrl("../images/lesion.nii.gz");
3744
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
3745
+ */
3746
+ loadDrawingFromUrl(fnm: string, isBinarize?: boolean): Promise<boolean>;
3747
+ findOtsu(mlevel?: number): number[];
3748
+ /**
3749
+ * remove dark voxels in air
3750
+ * @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.
3751
+ * @example niivue.drawOtsu(3);
3752
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
3753
+ */
3754
+ drawOtsu(levels?: number): void;
3755
+ /**
3756
+ * remove dark voxels in air
3757
+ * @param level - (1-5) larger values for more preserved voxels
3758
+ * @param volIndex - volume to dehaze
3759
+ * @example niivue.removeHaze(3, 0);
3760
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
3761
+ */
3762
+ removeHaze(level?: number, volIndex?: number): void;
3763
+ /**
3764
+ * save voxel-based image to disk
3765
+ * @param fnm - filename of NIfTI image to create
3766
+ * @param isSaveDrawing - determines whether drawing or background image is saved
3767
+ * @param volumeByIndex - determines layer to save (0 for background)
3768
+ * @param volumeByIndex - determines layer to save (0 for background)
3769
+ * @example niivue.saveImage('test.nii', true);
3770
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
3771
+ */
3772
+ saveImage(fnm: string, isSaveDrawing?: boolean, volumeByIndex?: number): Uint8Array | boolean;
3773
+ getMeshIndexByID(id: string | number): number;
3774
+ /**
3775
+ * change property of mesh, tractogram or connectome
3776
+ * @param id - identity of mesh to change
3777
+ * @param key - attribute to change
3778
+ * @param value - for attribute
3779
+ * @example niivue.setMeshProperty(niivue.meshes[0].id, 'fiberLength', 42)
3780
+ * @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
3781
+ */
3782
+ setMeshProperty(id: number, key: keyof NVMesh, val: number): void;
3783
+ /**
3784
+ * reverse triangle winding of mesh (swap front and back faces)
3785
+ * @param id - identity of mesh to change
3786
+ * @example niivue.reverseFaces(niivue.meshes[0].id)
3787
+ * @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
3788
+ */
3789
+ reverseFaces(mesh: number): void;
3790
+ /**
3791
+ * reverse triangle winding of mesh (swap front and back faces)
3792
+ * @param mesh - identity of mesh to change
3793
+ * @param layer - selects the mesh overlay (e.g. GIfTI or STC file)
3794
+ * @param key - attribute to change
3795
+ * @param value - for attribute
3796
+ * @example niivue.setMeshLayerProperty(niivue.meshes[0].id, 0, 'frame4D', 22)
3797
+ * @see {@link https://niivue.github.io/niivue/features/mesh.4D.html|live demo usage}
3798
+ */
3799
+ setMeshLayerProperty(mesh: number, layer: number, key: keyof NVMeshLayer, val: number): void;
3800
+ /**
3801
+ * adjust offset position and scale of 2D sliceScale
3802
+ * @param xyzmmZoom - first three components are spatial, fourth is scaling
3803
+ * @example niivue.setPan2Dxyzmm([5,-4, 2, 1.5])
3804
+ */
3805
+ setPan2Dxyzmm(xyzmmZoom: vec4): void;
3806
+ /**
3807
+ * set rotation of 3D render view
3808
+ * @example niivue.setRenderAzimuthElevation(45, 15)
3809
+ * @see {@link https://niivue.github.io/niivue/features/mask.html|live demo usage}
3810
+ */
3811
+ setRenderAzimuthElevation(a: number, e: number): void;
3812
+ /**
3813
+ * 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.
3814
+ * @param id - the id string to search for
3815
+ * @see NiiVue#getVolumeIndexByID
3816
+ * @example
3817
+ * niivue = new Niivue()
3818
+ * niivue.getOverlayIndexByID(someVolume.id)
3819
+ */
3820
+ getOverlayIndexByID(id: string): number;
3821
+ /**
3822
+ * set the index of a volume. This will change it's ordering and appearance if there are multiple volumes loaded.
3823
+ * @param volume - the volume to update
3824
+ * @param toIndex - the index to move the volume to. The default is the background (0 index)
3825
+ * @example
3826
+ * niivue = new Niivue()
3827
+ * niivue.setVolume(someVolume, 1) // move it to the second position in the array of loaded volumes (0 is the first position)
3828
+ */
3829
+ setVolume(volume: NVImage, toIndex?: number): void;
3830
+ setMesh(mesh: NVMesh, toIndex?: number): void;
3831
+ /**
3832
+ * Remove a volume
3833
+ * @param volume - volume to delete
3834
+ * @example
3835
+ * niivue = new Niivue()
3836
+ * niivue.removeVolume(this.volumes[3])
3837
+ * @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
3838
+ */
3839
+ removeVolume(volume: NVImage): void;
3840
+ /**
3841
+ * Remove a volume by index
3842
+ * @param index - of volume to remove
3843
+ */
3844
+ removeVolumeByIndex(index: number): void;
3845
+ /**
3846
+ * Remove a triangulated mesh, connectome or tractogram
3847
+ * @param mesh - mesh to delete
3848
+ * @example
3849
+ * niivue = new Niivue()
3850
+ * niivue.removeMesh(this.meshes[3])
3851
+ * @see {@link https://niivue.github.io/niivue/features/multiuser.meshes.html|live demo usage}
3852
+ */
3853
+ removeMesh(mesh: NVMesh): void;
3854
+ /**
3855
+ * Remove a triangulated mesh, connectome or tractogram
3856
+ * @param url - URL of mesh to delete
3857
+ * @example
3858
+ * niivue.removeMeshByUrl('../images/cit168.mz3')
3859
+ */
3860
+ removeMeshByUrl(url: string): void;
3861
+ /**
3862
+ * Move a volume to the bottom of the stack of loaded volumes. The volume will become the background
3863
+ * @param volume - the volume to move
3864
+ * @example
3865
+ * niivue = new Niivue()
3866
+ * niivue.moveVolumeToBottom(this.volumes[3]) // move the 4th volume to the 0 position. It will be the new background
3867
+ */
3868
+ moveVolumeToBottom(volume: NVImage): void;
3869
+ /**
3870
+ * Move a volume up one index position in the stack of loaded volumes. This moves it up one layer
3871
+ * @param volume - the volume to move
3872
+ * @example
3873
+ * niivue = new Niivue()
3874
+ * niivue.moveVolumeUp(this.volumes[0]) // move the background image to the second index position (it was 0 index, now will be 1)
3875
+ */
3876
+ moveVolumeUp(volume: NVImage): void;
3877
+ /**
3878
+ * Move a volume down one index position in the stack of loaded volumes. This moves it down one layer
3879
+ * @param volume - the volume to move
3880
+ * @example
3881
+ * niivue = new Niivue()
3882
+ * niivue.moveVolumeDown(this.volumes[1]) // move the second image to the background position (it was 1 index, now will be 0)
3883
+ */
3884
+ moveVolumeDown(volume: NVImage): void;
3885
+ /**
3886
+ * Move a volume to the top position in the stack of loaded volumes. This will be the top layer
3887
+ * @param volume - the volume to move
3888
+ * @example
3889
+ * niivue = new Niivue()
3890
+ * niivue.moveVolumeToTop(this.volumes[0]) // move the background image to the top layer position
3891
+ */
3892
+ moveVolumeToTop(volume: NVImage): void;
3893
+ mouseDown(x: number, y: number): void;
3894
+ mouseMove(x: number, y: number): void;
3895
+ /**
3896
+ * convert spherical AZIMUTH, ELEVATION to Cartesian
3897
+ * @param azimuth - azimuth number
3898
+ * @param elevation - elevation number
3899
+ * @returns the converted [x, y, z] coordinates
3900
+ * @example
3901
+ * niivue = new Niivue()
3902
+ * xyz = niivue.sph2cartDeg(42, 42)
3903
+ */
3904
+ sph2cartDeg(azimuth: number, elevation: number): number[];
3905
+ /**
3906
+ * update the clip plane orientation in 3D view mode
3907
+ * @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
3908
+ * @example
3909
+ * niivue = new Niivue()
3910
+ * niivue.setClipPlane([42, 42])
3911
+ * @see {@link https://niivue.github.io/niivue/features/mask.html|live demo usage}
3912
+ */
3913
+ setClipPlane(depthAzimuthElevation: number[]): void;
3914
+ /**
3915
+ * set the crosshair and colorbar outline color
3916
+ * @param color - an RGBA array. values range from 0 to 1
3917
+ * @example
3918
+ * niivue = new Niivue()
3919
+ * niivue.setCrosshairColor([0, 1, 0, 0.5]) // set crosshair to transparent green
3920
+ * @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
3921
+ */
3922
+ setCrosshairColor(color: number[]): Promise<void>;
3923
+ /**
3924
+ * set thickness of crosshair
3925
+ * @example niivue.crosshairWidth(2)
3926
+ * @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
3927
+ */
3928
+ setCrosshairWidth(crosshairWidth: number): void;
3929
+ setDrawColormap(name: string): void;
3930
+ /**
3931
+ * does dragging over a 2D slice create a drawing?
3932
+ * @param trueOrFalse - enabled (true) or not (false)
3933
+ * @example niivue.setDrawingEnabled(true)
3934
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
3935
+ */
3936
+ setDrawingEnabled(trueOrFalse: boolean): void;
3937
+ /**
3938
+ * determine color and style of drawing
3939
+ * @param penValue - sets the color of the pen
3940
+ * @param isFilledPen - determines if dragging creates flood-filled shape
3941
+ * @example niivue.setPenValue(1, true)
3942
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
3943
+ */
3944
+ setPenValue(penValue: number, isFilledPen?: boolean): void;
3945
+ /**
3946
+ * control whether drawing is transparent (0), opaque (1) or translucent (between 0 and 1).
3947
+ * @param opacity - translucency of drawing
3948
+ * @example niivue.setDrawOpacity(0.7)
3949
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
3950
+ */
3951
+ setDrawOpacity(opacity: number): void;
3952
+ /**
3953
+ * set the selection box color. A selection box is drawn when you right click and drag to change image contrast
3954
+ * @param color - an RGBA array. values range from 0 to 1
3955
+ * @example
3956
+ * niivue = new Niivue()
3957
+ * niivue.setSelectionBoxColor([0, 1, 0, 0.5]) // set to transparent green
3958
+ * @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
3959
+ */
3960
+ setSelectionBoxColor(color: number[]): void;
3961
+ sliceScroll2D(posChange: number, x: number, y: number, isDelta?: boolean): void;
3962
+ /**
3963
+ * set the slice type. This changes the view mode
3964
+ * @param sliceType - an enum of slice types to use
3965
+ * @example
3966
+ * niivue = new Niivue()
3967
+ * niivue.setSliceType(Niivue.sliceTypeMultiplanar)
3968
+ * @see {@link https://niivue.github.io/niivue/features/basic.multiplanar.html|live demo usage}
3969
+ */
3970
+ setSliceType(st: SLICE_TYPE): this;
3971
+ /**
3972
+ * set the opacity of a volume given by volume index
3973
+ * @param volIdx - the volume index of the volume to change
3974
+ * @param newOpacity - the opacity value. valid values range from 0 to 1. 0 will effectively remove a volume from the scene
3975
+ * @example
3976
+ * niivue = new Niivue()
3977
+ * niivue.setOpacity(0, 0.5) // make the first volume transparent
3978
+ * @see {@link https://niivue.github.io/niivue/features/atlas.html|live demo usage}
3979
+ */
3980
+ setOpacity(volIdx: number, newOpacity: number): void;
3981
+ /**
3982
+ * set the scale of the 3D rendering. Larger numbers effectively zoom.
3983
+ * @param scale - the new scale value
3984
+ * @example
3985
+ * niivue.setScale(2) // zoom some
3986
+ * @see {@link https://niivue.github.io/niivue/features/shiny.volumes.html|live demo usage}
3987
+ */
3988
+ setScale(scale: number): void;
3989
+ /**
3990
+ * set the color of the 3D clip plane
3991
+ * @param color - the new color. expects an array of RGBA values. values can range from 0 to 1
3992
+ * @example
3993
+ * niivue.setClipPlaneColor([1, 1, 1, 0.5]) // white, transparent
3994
+ * @see {@link https://niivue.github.io/niivue/features/clipplanes.html|live demo usage}
3995
+ */
3996
+ setClipPlaneColor(color: number[]): void;
3997
+ /**
3998
+ * set proportion of volume rendering influenced by selected matcap.
3999
+ * @param gradientAmount - amount of matcap (0..1), default 0 (matte, surface normal does not influence color)
4000
+ * @example
4001
+ * niivue.setVolumeRenderIllumination(0.6);
4002
+ * @see {@link https://niivue.github.io/niivue/features/shiny.volumes.html|live demo usage}
4003
+ */
4004
+ setVolumeRenderIllumination(gradientAmount?: number): Promise<void>;
4005
+ overlayRGBA(volume: NVImage): Uint8ClampedArray;
4006
+ vox2mm(XYZ: number[], mtx: mat4): vec3;
4007
+ /**
4008
+ * clone a volume and return a new volume
4009
+ * @param index - the index of the volume to clone
4010
+ * @returns new volume to work with, but that volume is not added to the canvas
4011
+ * @example
4012
+ * niivue = new Niivue()
4013
+ * niivue.cloneVolume(0)
4014
+ */
4015
+ cloneVolume(index: number): NVImage;
4016
+ /**
4017
+ *
4018
+ * @param url - URL of NVDocument
4019
+ */
4020
+ loadDocumentFromUrl(url: string): Promise<void>;
4021
+ /**
4022
+ * Loads an NVDocument
4023
+ * @returns Niivue instance
4024
+ * @see {@link https://niivue.github.io/niivue/features/document.load.html|live demo usage}
4025
+ */
4026
+ loadDocument(document: NVDocument): this;
4027
+ /**
4028
+ * generates JavaScript to load the current scene as a document
4029
+ * @param canvasId - id of canvas NiiVue will be attached to
4030
+ * @param esm - bundled version of NiiVue
4031
+ * @example
4032
+ * const javascript = this.generateLoadDocumentJavaScript("gl1");
4033
+ * const html = \`<html><body><canvas id="gl1"></canvas>\<script type="module" async\>
4034
+ $\{javascript\}</script></body></html>\`;
4035
+ */
4036
+ generateLoadDocumentJavaScript(canvasId: string, esm: string): string;
4037
+ /**
4038
+ * generates HTML of current scene
4039
+ * @param canvasId - id of canvas NiiVue will be attached to
4040
+ * @param esm - bundled version of NiiVue
4041
+ * @returns HTML with javascript of the current scene
4042
+ * @example
4043
+ * const template = \`<html><body><canvas id="gl1"></canvas>\<script type="module" async\>
4044
+ * %%javascript%%</script></body></html>\`;
4045
+ * nv1.generateHTML("page.html", esm);
4046
+ */
4047
+ generateHTML(canvasId: string | undefined, esm: string): string;
4048
+ /**
4049
+ * save current scene as HTML
4050
+ * @param fileName - the name of the HTML file
4051
+ * @param canvasId - id of canvas NiiVue will be attached to
4052
+ * @param esm - bundled version of NiiVue
4053
+ */
4054
+ saveHTML(fileName: string | undefined, canvasId: string | undefined, esm: string): void;
4055
+ /**
4056
+ * Converts NiiVue scene to JSON
4057
+ */
4058
+ json(): ExportDocumentData;
4059
+ /**
4060
+ * save the entire scene (objects and settings) as a document
4061
+ * @param fileName - the name of the document storing the scene
4062
+ * @example
4063
+ * niivue.saveDocument("niivue.basic.nvd")
4064
+ * @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
4065
+ */
4066
+ saveDocument(fileName?: string): Promise<void>;
4067
+ /**
4068
+ * load an array of volume objects
4069
+ * @param volumeList - the array of objects to load. each object must have a resolvable "url" property at a minimum
4070
+ * @returns returns the Niivue instance
4071
+ * @example
4072
+ * niivue = new Niivue()
4073
+ * niivue.loadVolumes([\{url: 'someImage.nii.gz\}, \{url: 'anotherImage.nii.gz\'\}])
4074
+ * @see {@link https://niivue.github.io/niivue/features/mask.html|live demo usage}
4075
+ */
4076
+ loadVolumes(volumeList: ImageFromUrlOptions[]): Promise<this>;
4077
+ /**
4078
+ * Add mesh and notify subscribers
4079
+ * @see {@link https://niivue.github.io/niivue/features/multiuser.meshes.html|live demo usage}
4080
+ */
4081
+ addMeshFromUrl(meshOptions: LoadFromUrlParams): Promise<NVMesh>;
4082
+ /**
4083
+ * load an array of meshes
4084
+ * @param meshList - the array of objects to load. each object must have a resolvable "url" property at a minimum
4085
+ * @returns Niivue instance
4086
+ * @example
4087
+ * niivue = new Niivue()
4088
+ * niivue.loadMeshes([\{url: 'someMesh.gii'\}])
4089
+ * @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
4090
+ */
4091
+ loadMeshes(meshList: LoadFromUrlParams[]): Promise<this>;
4092
+ /**
4093
+ * load a connectome specified by url
4094
+ * @returns Niivue instance
4095
+ * @see {@link https://niivue.github.io/niivue/features/connectome.html|live demo usage}
4096
+ */
4097
+ loadConnectomeFromUrl(url: string, headers?: {}): Promise<this>;
4098
+ /**
4099
+ * load a connectome specified by url
4100
+ * @returns Niivue instance
4101
+ * @see {@link https://niivue.github.io/niivue/features/connectome.html|live demo usage}
4102
+ */
4103
+ loadFreeSurferConnectomeFromUrl(url: string, headers?: {}): Promise<this>;
4104
+ /**
4105
+ * load a connectome specified by json
4106
+ * @param connectome - freesurfer model
4107
+ * @returns Niivue instance
4108
+ * @see {@link https://niivue.github.io/niivue/features/connectome.html|live demo usage}
4109
+ */
4110
+ loadFreeSurferConnectome(json: FreeSurferConnectome): Promise<this>;
4111
+ handleNodeAdded(event: {
4112
+ detail: {
4113
+ node: NVConnectomeNode;
4114
+ };
4115
+ }): void;
4116
+ /**
4117
+ * load a connectome specified by json
4118
+ * @param connectome - model
4119
+ * @returns Niivue instance
4120
+ * @see {@link https://niivue.github.io/niivue/features/connectome.html|live demo usage}
4121
+ */
4122
+ loadConnectome(json: Connectome | LegacyConnectome): this;
4123
+ /**
4124
+ * generate a blank canvas for the pen tool
4125
+ * @example niivue.createEmptyDrawing()
4126
+ * @see {@link https://niivue.github.io/niivue/features/cactus.html|live demo usage}
4127
+ */
4128
+ createEmptyDrawing(): void;
4129
+ r16Tex(texID: WebGLTexture | null, activeID: number, dims: number[], img16: Int16Array): WebGLTexture;
4130
+ /**
4131
+ * dilate drawing so all voxels are colored.
4132
+ * works on drawing with multiple colors
4133
+ * @example niivue.drawGrowCut();
4134
+ * @see {@link https://niivue.github.io/niivue/features/draw2.html|live demo usage}
4135
+ */
4136
+ drawGrowCut(): void;
4137
+ drawPt(x: number, y: number, z: number, penValue: number): void;
4138
+ drawPenLine(ptA: number[], ptB: number[], penValue: number): void;
4139
+ drawFloodFillCore(img: Uint8Array, seedVx: number, neighbors?: number): void;
4140
+ 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
4141
+ forceMin?: number, forceMax?: number, neighbors?: number): void;
4142
+ drawPenFilled(): void;
4143
+ /**
4144
+ * close drawing: make sure you have saved any changes before calling this!
4145
+ * @example niivue.closeDrawing();
4146
+ * @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
4147
+ */
4148
+ closeDrawing(): void;
4149
+ /**
4150
+ * copy drawing bitmap from CPU to GPU storage and redraw the screen
4151
+ * @param isForceRedraw - refreshes scene immediately (default true)
4152
+ * @example niivue.refreshDrawing();
4153
+ * @see {@link https://niivue.github.io/niivue/features/cactus.html|live demo usage}
4154
+ */
4155
+ refreshDrawing(isForceRedraw?: boolean): void;
4156
+ r8Tex(texID: WebGLTexture | null, activeID: number, dims: number[], isInit?: boolean): WebGLTexture | null;
4157
+ rgbaTex(texID: WebGLTexture | null, activeID: number, dims: number[], isInit?: boolean): WebGLTexture | null;
4158
+ requestCORSIfNotSameOrigin(img: HTMLImageElement, url: string): void;
4159
+ loadPngAsTexture(pngUrl: string, textureNum: number): Promise<WebGLTexture | null>;
4160
+ loadFontTexture(fontUrl: string): Promise<WebGLTexture | null>;
4161
+ loadBmpTexture(bmpUrl: string): Promise<WebGLTexture | null>;
4162
+ /**
4163
+ * Load matcap for illumination model.
4164
+ * @param name - name of matcap to load ("Shiny", "Cortex", "Cream")
4165
+ * @example
4166
+ * niivue.loadMatCapTexture("Cortex");
4167
+ * @see {@link https://niivue.github.io/niivue/features/shiny.volumes.html|live demo usage}
4168
+ */
4169
+ loadMatCapTexture(bmpUrl: string): Promise<WebGLTexture | null>;
4170
+ initFontMets(): void;
4171
+ /**
4172
+ * Load typeface for colorbars, measurements and orientation text.
4173
+ * @param name - name of matcap to load ("Roboto", "Garamond", "Ubuntu")
4174
+ * @example
4175
+ * niivue.loadMatCapTexture("Cortex");
4176
+ * @see {@link https://niivue.github.io/niivue/features/selectfont.html|live demo usage}
4177
+ */
4178
+ loadFont(fontSheetUrl?: any, metricsUrl?: {
4179
+ atlas: {
4180
+ type: string;
4181
+ distanceRange: number;
4182
+ size: number;
4183
+ width: number;
4184
+ height: number;
4185
+ yOrigin: string;
4186
+ };
4187
+ metrics: {
4188
+ emSize: number;
4189
+ lineHeight: number;
4190
+ ascender: number;
4191
+ descender: number;
4192
+ underlineY: number;
4193
+ underlineThickness: number;
4194
+ };
4195
+ glyphs: ({
4196
+ unicode: number;
4197
+ advance: number;
4198
+ planeBounds?: undefined;
4199
+ atlasBounds?: undefined;
4200
+ } | {
4201
+ unicode: number;
4202
+ advance: number;
4203
+ planeBounds: {
4204
+ left: number;
4205
+ bottom: number;
4206
+ right: number;
4207
+ top: number;
4208
+ };
4209
+ atlasBounds: {
4210
+ left: number;
4211
+ bottom: number;
4212
+ right: number;
4213
+ top: number;
4214
+ };
4215
+ })[];
4216
+ kerning: never[];
4217
+ }): Promise<void>;
4218
+ loadDefaultMatCap(): Promise<WebGLTexture | null>;
4219
+ loadDefaultFont(): Promise<void>;
4220
+ initText(): Promise<void>;
4221
+ meshShaderNameToNumber(meshShaderName?: string): number | undefined;
4222
+ /**
4223
+ * 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).
4224
+ * @param id - id of mesh to change
4225
+ * @param meshShaderNameOrNumber - identify shader for usage
4226
+ * @example niivue.setMeshShader('toon');
4227
+ * @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
4228
+ */
4229
+ setMeshShader(id: number, meshShaderNameOrNumber?: number): void;
4230
+ /**
4231
+ *
4232
+ * @param fragmentShaderText - custom fragment shader.
4233
+ * @param name - title for new shader.
4234
+ * @returns created custom mesh shader
4235
+ */
4236
+ createCustomMeshShader(fragmentShaderText: string, name?: string): {
4237
+ Name: string;
4238
+ Frag: string;
4239
+ shader: Shader;
4240
+ };
4241
+ /**
4242
+ * Define a new GLSL shader program to influence mesh coloration
4243
+ * @param fragmentShaderText - custom fragment shader.
4244
+ * @param ame - title for new shader.
4245
+ * @returns index of the new shader (for setMeshShader)
4246
+ * @see {@link https://niivue.github.io/niivue/features/mesh.atlas.html|live demo usage}
4247
+ */
4248
+ setCustomMeshShader(fragmentShaderText?: string, name?: string): number;
4249
+ /**
4250
+ * retrieve all currently loaded meshes
4251
+ * @param sort - sort output alphabetically
4252
+ * @returns list of available mesh shader names
4253
+ * @example niivue.meshShaderNames();
4254
+ * @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
4255
+ */
4256
+ meshShaderNames(sort?: boolean): string[];
4257
+ initRenderShader(shader: Shader, gradientAmount?: number): void;
4258
+ init(): Promise<this>;
4259
+ gradientGL(hdr: NiftiHeader): void;
4260
+ /**
4261
+ * 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)
4262
+ * @example
4263
+ * niivue = new Niivue()
4264
+ * niivue.updateGLVolume()
4265
+ * @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
4266
+ */
4267
+ updateGLVolume(): void;
4268
+ /**
4269
+ * basic statistics for selected voxel-based image
4270
+ * @param layer - selects image to describe
4271
+ * @param masks - are optional binary images to filter voxles
4272
+ * @returns numeric values to describe image
4273
+ * @example niivue.getDescriptives(0);
4274
+ * @see {@link https://niivue.github.io/niivue/features/draw2.html|live demo usage}
4275
+ */
4276
+ getDescriptives(layer?: number, masks?: never[], drawingIsMask?: boolean): Descriptive;
4277
+ refreshLayers(overlayItem: NVImage, layer: number): void;
4278
+ /**
4279
+ * query all available color maps that can be applied to volumes
4280
+ * @param sort - whether or not to sort the returned array
4281
+ * @returns an array of colormap strings
4282
+ * @example
4283
+ * niivue = new Niivue()
4284
+ * colormaps = niivue.colormaps()
4285
+ * @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
4286
+ */
4287
+ colormaps(): string[];
4288
+ /**
4289
+ * create a new colormap
4290
+ * @param key - name of new colormap
4291
+ * @param colormap - properties (Red, Green, Blue, Alpha and Indices)
4292
+ * @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
4293
+ */
4294
+ addColormap(key: string, cmap: ColorMap): void;
4295
+ /**
4296
+ * update the colormap of an image given its ID
4297
+ * @param id - the ID of the NVImage
4298
+ * @param colormap - the name of the colormap to use
4299
+ * @example
4300
+ * niivue.setColormap(niivue.volumes[0].id,, 'red')
4301
+ * @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
4302
+ */
4303
+ setColormap(id: string, colormap: string): void;
4304
+ /**
4305
+ * darken crevices and brighten corners when 3D rendering drawings.
4306
+ * @param amount - amount of ambient occlusion (default 0.4)
4307
+ * @see {@link https://niivue.github.io/niivue/features/torso.html|live demo usage}
4308
+ */
4309
+ setRenderDrawAmbientOcclusion(ao: number): void;
4310
+ setColorMap(id: string, colormap: string): void;
4311
+ /**
4312
+ * use given color map for negative voxels in image
4313
+ * @param id - the ID of the NVImage
4314
+ * @param colormapNegative - the name of the colormap to use
4315
+ * @example
4316
+ * niivue = new Niivue()
4317
+ * niivue.setColormapNegative(niivue.volumes[1].id,"winter");
4318
+ * @see {@link https://niivue.github.io/niivue/features/mosaics2.html|live demo usage}
4319
+ */
4320
+ setColormapNegative(id: string, colormapNegative: string): void;
4321
+ /**
4322
+ * modulate intensity of one image based on intensity of another
4323
+ * @param idTarget - the ID of the NVImage to be biased
4324
+ * @param idModulation - the ID of the NVImage that controls bias (null to disable modulation)
4325
+ * @param modulateAlpha - does the modulation influence alpha transparency (values greater than 1).
4326
+ * @example niivue.setModulationImage(niivue.volumes[0].id, niivue.volumes[1].id);
4327
+ * @see {@link https://niivue.github.io/niivue/features/modulate.html|live demo scalar usage}
4328
+ * @see {@link https://niivue.github.io/niivue/features/modulateAfni.html|live demo usage}
4329
+ */
4330
+ setModulationImage(idTarget: string, idModulation: string, modulateAlpha?: number): void;
4331
+ /**
4332
+ * adjust screen gamma. Low values emphasize shadows but can appear flat, high gamma hides shadow details.
4333
+ * @param gamma - selects luminance, default is 1
4334
+ * @example niivue.setGamma(1.0);
4335
+ * @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
4336
+ */
4337
+ setGamma(gamma?: number): void;
4338
+ /** Load all volumes for image opened with `limitFrames4D`, the user can also click the `...` on a 4D timeline to load deferred volumes
4339
+ * @param id - the ID of the 4D NVImage
4340
+ **/
4341
+ loadDeferred4DVolumes(id: string): Promise<void>;
4342
+ /**
4343
+ * show desired 3D volume from 4D time series
4344
+ * @param id - the ID of the 4D NVImage
4345
+ * @param frame4D - frame to display (indexed from zero)
4346
+ * @example nv1.setFrame4D(nv1.volumes[0].id, 42);
4347
+ * @see {@link https://niivue.github.io/niivue/features/timeseries.html|live demo usage}
4348
+ */
4349
+ setFrame4D(id: string, frame4D: number): void;
4350
+ /**
4351
+ * determine active 3D volume from 4D time series
4352
+ * @param id - the ID of the 4D NVImage
4353
+ * @returns currently selected volume (indexed from 0)
4354
+ * @example nv1.getFrame4D(nv1.volumes[0].id);
4355
+ * @see {@link https://niivue.github.io/niivue/features/timeseries.html|live demo usage}
4356
+ */
4357
+ getFrame4D(id: string): number;
4358
+ colormapFromKey(name: string): ColorMap;
4359
+ colormap(lutName?: string, isInvert?: boolean): Uint8ClampedArray;
4360
+ createColormapTexture(texture?: WebGLTexture | null, nRow?: number, nCol?: number): WebGLTexture | null;
4361
+ addColormapList(nm?: string, mn?: number, mx?: number, alpha?: boolean, neg?: boolean, vis?: boolean, inv?: boolean): void;
4362
+ refreshColormaps(): this | undefined;
4363
+ sliceScale(forceVox?: boolean): SliceScale;
4364
+ tileIndex(x: number, y: number): number;
4365
+ inRenderTile(x: number, y: number): number;
4366
+ sliceScroll3D(posChange?: number): void;
4367
+ deleteThumbnail(): void;
4368
+ inGraphTile(x: number, y: number): boolean;
4369
+ mouseClick(x: number, y: number, posChange?: number, isDelta?: boolean): void;
4370
+ drawRuler(): void;
4371
+ drawRuler10cm(startXYendXY: number[]): void;
4372
+ screenXY2mm(x: number, y: number, forceSlice?: number): vec3;
4373
+ dragForPanZoom(startXYendXY: number[]): void;
4374
+ dragForCenterButton(startXYendXY: number[]): void;
4375
+ dragForSlicer3D(startXYendXY: number[]): void;
4376
+ drawMeasurementTool(startXYendXY: number[]): void;
4377
+ drawRect(leftTopWidthHeight: number[], lineColor?: number[]): void;
4378
+ drawCircle(leftTopWidthHeight: number[], circleColor?: number[], fillPercent?: number): void;
4379
+ drawSelectionBox(leftTopWidthHeight: number[]): void;
4380
+ effectiveCanvasHeight(): number;
4381
+ effectiveCanvasWidth(): number;
4382
+ getAllLabels(): NVLabel3D[];
4383
+ getBulletMarginWidth(): number;
4384
+ getLegendPanelWidth(): number;
4385
+ getLegendPanelHeight(): number;
4386
+ reserveColorbarPanel(): number[];
4387
+ drawColorbarCore(layer: number | undefined, leftTopWidthHeight: number[] | undefined, isNegativeColor: boolean | undefined, min: number | undefined, max: number | undefined, isAlphaThreshold: boolean): void;
4388
+ drawColorbar(): void;
4389
+ textWidth(scale: number, str: string): number;
4390
+ textHeight(scale: number, str: string): number;
4391
+ drawChar(xy: number[], scale: number, char: number): number;
4392
+ drawLoadingText(text: string): void;
4393
+ drawText(xy: number[], str: string, scale?: number, color?: number[] | null): void;
4394
+ drawTextRight(xy: number[], str: string, scale?: number, color?: number[] | null): void;
4395
+ drawTextLeft(xy: number[], str: string, scale?: number, color?: number[] | null): void;
4396
+ drawTextRightBelow(xy: number[], str: string, scale?: number, color?: number[] | null): void;
4397
+ drawTextBetween(startXYendXY: number[], str: string, scale?: number, color?: number[] | null): void;
4398
+ drawTextBelow(xy: number[], str: string, scale?: number, color?: number[] | null): void;
4399
+ updateInterpolation(layer: number, isForceLinear?: boolean): void;
4400
+ setAtlasOutline(isOutline: boolean): void;
4401
+ /**
4402
+ * select between nearest and linear interpolation for voxel based images
4403
+ * @param isNearest - whether nearest neighbor interpolation is used, else linear interpolation
4404
+ * @example niivue.setInterpolation(true);
4405
+ * @see {@link https://niivue.github.io/niivue/features/draw2.html|live demo usage}
4406
+ */
4407
+ setInterpolation(isNearest: boolean): void;
4408
+ calculateMvpMatrix2D(leftTopWidthHeight: number[], mn: vec3, mx: vec3, clipTolerance: number | undefined, clipDepth: number | undefined, azimuth: number | undefined, elevation: number | undefined, isRadiolgical: boolean): MvpMatrix2D;
4409
+ swizzleVec3MM(v3: vec3, axCorSag: SLICE_TYPE): vec3;
4410
+ screenFieldOfViewVox(axCorSag?: number): vec3;
4411
+ screenFieldOfViewMM(axCorSag?: number, forceSliceMM?: boolean): vec3;
4412
+ screenFieldOfViewExtendedVox(axCorSag?: number): MM;
4413
+ screenFieldOfViewExtendedMM(axCorSag?: number): MM;
4414
+ drawSliceOrientationText(leftTopWidthHeight: number[], axCorSag: SLICE_TYPE): void;
4415
+ xyMM2xyzMM(axCorSag: SLICE_TYPE, sliceFrac: number): number[];
4416
+ draw2D(leftTopWidthHeight: number[], axCorSag: SLICE_TYPE, customMM?: number): void;
4417
+ calculateMvpMatrix(_unused: unknown, leftTopWidthHeight: number[] | undefined, azimuth: number, elevation: number): mat4[];
4418
+ calculateModelMatrix(azimuth: number, elevation: number): mat4;
4419
+ calculateRayDirection(azimuth: number, elevation: number): vec3;
4420
+ sceneExtentsMinMax(isSliceMM?: boolean): vec3[];
4421
+ setPivot3D(): void;
4422
+ getMaxVols(): number;
4423
+ detectPartialllyLoaded4D(): boolean;
4424
+ drawGraph(): void;
4425
+ depthPicker(leftTopWidthHeight: number[], mvpMatrix: mat4): void;
4426
+ drawImage3D(mvpMatrix: mat4, azimuth: number, elevation: number): void;
4427
+ drawOrientationCube(leftTopWidthHeight: number[], azimuth?: number, elevation?: number): void;
4428
+ createOnLocationChange(axCorSag?: number): void;
4429
+ /**
4430
+ * Add a 3D Label
4431
+ * @param text - text of the label
4432
+ * @param style - label style
4433
+ * @param point - 3D point on the model
4434
+ */
4435
+ addLabel(text: string, style: NVLabel3DStyle, points?: number[] | number[][]): NVLabel3D;
4436
+ calculateScreenPoint(point: [number, number, number], mvpMatrix: mat4, leftTopWidthHeight: number[]): vec4;
4437
+ getLabelAtPoint(screenPoint: [number, number]): NVLabel3D | null;
4438
+ drawLabelLine(label: NVLabel3D, pos: vec2, mvpMatrix: mat4, leftTopWidthHeight: number[], secondPass?: boolean): void;
4439
+ draw3DLabel(label: NVLabel3D, pos: vec2, mvpMatrix: mat4, leftTopWidthHeight: number[], bulletMargin: number | undefined, legendWidth: number, secondPass?: boolean): void;
4440
+ draw3DLabels(mvpMatrix: mat4, leftTopWidthHeight: number[], secondPass?: boolean): void;
4441
+ draw3D(leftTopWidthHeight?: number[], mvpMatrix?: mat4 | null, modelMatrix?: mat4 | null, normalMatrix?: mat4 | null, azimuth?: number | null, elevation?: number): string | undefined;
4442
+ drawMesh3D(isDepthTest?: boolean, alpha?: number, m?: mat4, modelMtx?: mat4, normMtx?: mat4): void;
4443
+ drawCrosshairs3D(isDepthTest?: boolean, alpha?: number, mvpMtx?: mat4 | null, is2DView?: boolean, isSliceMM?: boolean): void;
4444
+ mm2frac(mm: vec3 | vec4, volIdx?: number, isForceSliceMM?: boolean): vec3;
4445
+ vox2frac(vox: vec3, volIdx?: number): vec3;
4446
+ frac2vox(frac: vec3, volIdx?: number): vec3;
4447
+ /**
4448
+ * move crosshair a fixed number of voxels (not mm)
4449
+ * @param x - translate left (-) or right (+)
4450
+ * @param y - translate posterior (-) or +anterior (+)
4451
+ * @param z - translate inferior (-) or superior (+)
4452
+ * @example niivue.moveCrosshairInVox(1, 0, 0)
4453
+ * @see {@link https://niivue.github.io/niivue/features/draw2.html|live demo usage}
4454
+ */
4455
+ moveCrosshairInVox(x: number, y: number, z: number): void;
4456
+ frac2mm(frac: vec3, volIdx?: number, isForceSliceMM?: boolean): vec4;
4457
+ screenXY2TextureFrac(x: number, y: number, i: number, restrict0to1?: boolean): vec3;
4458
+ canvasPos2frac(canvasPos: number[]): vec3;
4459
+ scaleSlice(w: number, h: number, widthPadPixels?: number, heightPadPixels?: number): number[];
4460
+ drawThumbnail(): void;
4461
+ drawLine(startXYendXY: number[], thickness?: number, lineColor?: number[]): void;
4462
+ draw3DLine(startXY: vec2, endXYZ: vec3, thickness?: number, lineColor?: number[]): void;
4463
+ drawDottedLine(startXYendXY: number[], thickness?: number, lineColor?: number[]): void;
4464
+ drawGraphLine(LTRB: number[], color?: number[], thickness?: number): void;
4465
+ drawCrossLinesMM(sliceIndex: number, axCorSag: SLICE_TYPE, axiMM: number[], corMM: number[], sagMM: number[]): void;
4466
+ drawCrossLines(sliceIndex: number, axCorSag: SLICE_TYPE, axiMM: number[], corMM: number[], sagMM: number[]): void;
4467
+ /**
4468
+ * display a lightbox or montage view
4469
+ * @param mosaicStr - specifies orientation (A,C,S) and location of slices.
4470
+ * @example niivue.setSliceMosaicString("A -10 0 20");
4471
+ * @see {@link https://niivue.github.io/niivue/features/mosaics.html|live demo usage}
4472
+ */
4473
+ drawMosaic(mosaicStr: string): void;
4474
+ drawSceneCore(): string | void;
4475
+ drawScene(): string | void;
4476
+ get gl(): WebGL2RenderingContext;
4477
+ set gl(gl: WebGL2RenderingContext | null);
4478
+ }
4479
+
4480
+ export { DEFAULT_OPTIONS, DRAG_MODE, type DocumentData, type ExportDocumentData, LabelLineTerminator, LabelTextAlignment, MULTIPLANAR_TYPE, NVController, NVDocument, NVImage, NVImageFromUrlOptions, NVLabel3D, NVLabel3DStyle, NVMesh, NVMeshFromUrlOptions, NVMeshLoaders, NVUtilities, Niivue, SLICE_TYPE, cmapper, ColorTables as colortables };