@niivue/niivue 0.40.0 → 0.41.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +59 -77
- package/build/index.js +591 -615
- package/build/index.js.map +1 -1
- package/build/index.min.js +1 -1
- package/package.json +38 -36
- package/src/colortables.ts +1 -1
- package/src/index.html +1 -1
- package/src/niivue/index.ts +176 -189
- package/src/niivue-object3D.ts +42 -13
- package/src/nvconnectome.ts +10 -8
- package/src/nvdocument.ts +7 -6
- package/src/nvimage/index.ts +6 -14
- package/src/nvimage/utils.ts +0 -8
- package/src/nvmesh-loaders.ts +175 -160
- package/src/nvmesh-types.ts +14 -14
- package/src/nvmesh.ts +113 -279
- package/src/shader-srcs.ts +135 -44
- package/src/types.ts +1 -0
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Subject, Subscription } from 'rxjs';
|
|
2
1
|
import { mat4, vec3, vec4, vec2 } from 'gl-matrix';
|
|
3
2
|
import * as nifti from 'nifti-reader-js';
|
|
4
3
|
import { WebSocketSubject } from 'rxjs/webSocket';
|
|
@@ -87,8 +86,8 @@ declare class NiivueObject3D {
|
|
|
87
86
|
fieldOfViewDeObliqueMM?: vec3;
|
|
88
87
|
mm?: vec4;
|
|
89
88
|
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;
|
|
89
|
+
static generateCrosshairs: (gl: WebGL2RenderingContext, id: number, xyzMM: vec4, xyzMin: vec3, xyzMax: vec3, radius: number, sides?: number, gap?: number) => NiivueObject3D;
|
|
90
|
+
static generateCrosshairsGeometry: (gl: WebGL2RenderingContext, xyzMM: vec4, xyzMin: vec3, xyzMax: vec3, radius: number, sides?: number, gap?: number) => Geometry;
|
|
92
91
|
static getFirstPerpVector: (v1: vec3) => vec3;
|
|
93
92
|
static subdivide: (verts: number[], faces: number[]) => void;
|
|
94
93
|
static weldVertices: (verts: number[], faces: number[]) => number[];
|
|
@@ -183,6 +182,7 @@ type NiftiHeader = {
|
|
|
183
182
|
intent_name: string;
|
|
184
183
|
magic: string;
|
|
185
184
|
};
|
|
185
|
+
type Volume = Record<string, any>;
|
|
186
186
|
type Point = {
|
|
187
187
|
comments: Array<{
|
|
188
188
|
text: string;
|
|
@@ -226,6 +226,7 @@ type ConnectomeOptions = {
|
|
|
226
226
|
edgeMin: number;
|
|
227
227
|
edgeMax: number;
|
|
228
228
|
edgeScale: number;
|
|
229
|
+
legendLineThickness?: number;
|
|
229
230
|
};
|
|
230
231
|
type Connectome = ConnectomeOptions & {
|
|
231
232
|
nodes: NVConnectomeNode[];
|
|
@@ -247,7 +248,7 @@ type LegacyConnectome = Partial<ConnectomeOptions> & {
|
|
|
247
248
|
|
|
248
249
|
type ValuesArray = Array<{
|
|
249
250
|
id: string;
|
|
250
|
-
vals:
|
|
251
|
+
vals: Float32Array;
|
|
251
252
|
global_min?: number;
|
|
252
253
|
global_max?: number;
|
|
253
254
|
cal_min?: number;
|
|
@@ -257,21 +258,21 @@ type TypedNumberArray = Float64Array | Float32Array | Uint32Array | Uint16Array
|
|
|
257
258
|
type AnyNumberArray = number[] | TypedNumberArray;
|
|
258
259
|
type DefaultMeshType = {
|
|
259
260
|
positions: Float32Array;
|
|
260
|
-
indices:
|
|
261
|
+
indices: Uint32Array;
|
|
261
262
|
colors?: Float32Array;
|
|
262
263
|
};
|
|
263
264
|
type TRACT = {
|
|
264
|
-
pts:
|
|
265
|
-
offsetPt0:
|
|
265
|
+
pts: Float32Array;
|
|
266
|
+
offsetPt0: Uint32Array;
|
|
266
267
|
dps: ValuesArray;
|
|
267
268
|
};
|
|
268
269
|
type TT = {
|
|
269
|
-
pts:
|
|
270
|
-
offsetPt0:
|
|
270
|
+
pts: Float32Array;
|
|
271
|
+
offsetPt0: Uint32Array;
|
|
271
272
|
};
|
|
272
273
|
type TRX = {
|
|
273
|
-
pts:
|
|
274
|
-
offsetPt0:
|
|
274
|
+
pts: Float32Array;
|
|
275
|
+
offsetPt0: Uint32Array;
|
|
275
276
|
dpg: ValuesArray;
|
|
276
277
|
dps: ValuesArray;
|
|
277
278
|
dpv: ValuesArray;
|
|
@@ -297,14 +298,14 @@ type ANNOT = Uint32Array | {
|
|
|
297
298
|
};
|
|
298
299
|
type MZ3 = Float32Array | {
|
|
299
300
|
positions: Float32Array | null;
|
|
300
|
-
indices:
|
|
301
|
+
indices: Uint32Array | null;
|
|
301
302
|
scalars: Float32Array;
|
|
302
303
|
colors: Float32Array | null;
|
|
303
304
|
};
|
|
304
305
|
type GII = {
|
|
305
306
|
scalars: Float32Array;
|
|
306
307
|
positions?: Float32Array;
|
|
307
|
-
indices?:
|
|
308
|
+
indices?: Uint32Array;
|
|
308
309
|
colormapLabel?: LUT;
|
|
309
310
|
anatomicalStructurePrimary: string;
|
|
310
311
|
};
|
|
@@ -313,9 +314,9 @@ type MGH = AnyNumberArray | {
|
|
|
313
314
|
colormapLabel: LUT;
|
|
314
315
|
};
|
|
315
316
|
type X3D = {
|
|
316
|
-
positions:
|
|
317
|
-
indices:
|
|
318
|
-
rgba255:
|
|
317
|
+
positions: Float32Array;
|
|
318
|
+
indices: Uint32Array;
|
|
319
|
+
rgba255: Uint8Array;
|
|
319
320
|
};
|
|
320
321
|
|
|
321
322
|
/** Enum for text alignment
|
|
@@ -346,7 +347,7 @@ type NVMeshLayer = {
|
|
|
346
347
|
frame4D: number;
|
|
347
348
|
nFrame4D: number;
|
|
348
349
|
values: number[];
|
|
349
|
-
|
|
350
|
+
outlineBorder?: number;
|
|
350
351
|
isTransparentBelowCalMin?: boolean;
|
|
351
352
|
alphaThreshold: boolean;
|
|
352
353
|
base64?: string;
|
|
@@ -357,17 +358,17 @@ declare class NVMeshFromUrlOptions {
|
|
|
357
358
|
gl: WebGL2RenderingContext | null;
|
|
358
359
|
name: string;
|
|
359
360
|
opacity: number;
|
|
360
|
-
rgba255:
|
|
361
|
+
rgba255: Uint8Array;
|
|
361
362
|
visible: boolean;
|
|
362
363
|
layers: NVMeshLayer[];
|
|
363
364
|
colorbarVisible: boolean;
|
|
364
|
-
constructor(url?: string, gl?: null, name?: string, opacity?: number, rgba255?:
|
|
365
|
+
constructor(url?: string, gl?: null, name?: string, opacity?: number, rgba255?: Uint8Array, visible?: boolean, layers?: never[], colorbarVisible?: boolean);
|
|
365
366
|
}
|
|
366
367
|
type BaseLoadParams = {
|
|
367
368
|
gl: WebGL2RenderingContext;
|
|
368
369
|
name: string;
|
|
369
370
|
opacity: number;
|
|
370
|
-
rgba255: number[];
|
|
371
|
+
rgba255: number[] | Uint8Array;
|
|
371
372
|
visible: boolean;
|
|
372
373
|
layers: NVMeshLayer[];
|
|
373
374
|
};
|
|
@@ -395,21 +396,21 @@ declare class NVMesh {
|
|
|
395
396
|
opacity: number;
|
|
396
397
|
visible: boolean;
|
|
397
398
|
meshShaderIndex: number;
|
|
398
|
-
offsetPt0:
|
|
399
|
+
offsetPt0: Uint32Array | null;
|
|
399
400
|
colormapInvert: boolean;
|
|
400
401
|
fiberGroupColormap: ColorMap | null;
|
|
401
402
|
indexBuffer: WebGLBuffer;
|
|
402
403
|
vertexBuffer: WebGLBuffer;
|
|
403
404
|
vao: WebGLVertexArrayObject;
|
|
404
405
|
vaoFiber: WebGLVertexArrayObject;
|
|
405
|
-
pts:
|
|
406
|
-
tris?:
|
|
406
|
+
pts: Float32Array;
|
|
407
|
+
tris?: Uint32Array;
|
|
407
408
|
layers: NVMeshLayer[];
|
|
408
409
|
type: MeshType;
|
|
409
410
|
data_type?: string;
|
|
410
|
-
rgba255:
|
|
411
|
+
rgba255: Uint8Array;
|
|
411
412
|
fiberLength?: number;
|
|
412
|
-
fiberLengths?:
|
|
413
|
+
fiberLengths?: Uint32Array;
|
|
413
414
|
fiberDither: number;
|
|
414
415
|
fiberColor: string;
|
|
415
416
|
fiberDecimationStride: number;
|
|
@@ -427,6 +428,7 @@ declare class NVMesh {
|
|
|
427
428
|
vertexCount: number;
|
|
428
429
|
nodeScale: number;
|
|
429
430
|
edgeScale: number;
|
|
431
|
+
legendLineThickness: number;
|
|
430
432
|
nodeColormap: string;
|
|
431
433
|
edgeColormap: string;
|
|
432
434
|
nodeColormapNegative?: string;
|
|
@@ -453,22 +455,17 @@ declare class NVMesh {
|
|
|
453
455
|
* @param colorbarVisible - does this mesh display a colorbar
|
|
454
456
|
* @param anatomicalStructurePrimary - region for mesh. Default is an empty string
|
|
455
457
|
*/
|
|
456
|
-
constructor(pts:
|
|
458
|
+
constructor(pts: Float32Array, tris: Uint32Array, name: string | undefined, rgba255: Uint8Array | 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);
|
|
459
|
+
initValuesArray(va: ValuesArray): ValuesArray;
|
|
457
460
|
linesToCylinders(gl: WebGL2RenderingContext, posClrF32: Float32Array, indices: number[]): void;
|
|
458
461
|
updateFibers(gl: WebGL2RenderingContext): void;
|
|
459
|
-
updateConnectome(gl: WebGL2RenderingContext): void;
|
|
460
462
|
indexNearestXYZmm(Xmm: number, Ymm: number, Zmm: number): number[];
|
|
461
463
|
updateMesh(gl: WebGL2RenderingContext): void;
|
|
462
464
|
reverseFaces(gl: WebGL2RenderingContext): void;
|
|
463
465
|
setLayerProperty(id: number, key: keyof NVMeshLayer, val: number | string | boolean, gl: WebGL2RenderingContext): void;
|
|
464
466
|
setProperty(key: keyof this, val: unknown, gl: WebGL2RenderingContext): void;
|
|
465
|
-
generatePosNormClr(pts:
|
|
466
|
-
static
|
|
467
|
-
points?: Point[];
|
|
468
|
-
data_type: string;
|
|
469
|
-
}, gl: WebGL2RenderingContext, name?: string, opacity?: number, visible?: boolean): NVMesh;
|
|
470
|
-
static loadConnectomeFromJSON(json: Record<string, unknown>, gl: WebGL2RenderingContext, name?: string, opacity?: number, visible?: boolean): NVMesh;
|
|
471
|
-
static readMesh(buffer: ArrayBuffer, name: string, gl: WebGL2RenderingContext, opacity?: number, rgba255?: number[], visible?: boolean): NVMesh;
|
|
467
|
+
generatePosNormClr(pts: Float32Array, tris: Uint32Array, rgba255: Uint8Array): Float32Array;
|
|
468
|
+
static readMesh(buffer: ArrayBuffer, name: string, gl: WebGL2RenderingContext, opacity?: number, rgba255?: Uint8Array, visible?: boolean): NVMesh;
|
|
472
469
|
static loadLayer(layer: NVMeshLayer, nvmesh: NVMesh): Promise<void>;
|
|
473
470
|
/**
|
|
474
471
|
* factory function to load and return a new NVMesh instance from a given URL
|
|
@@ -550,7 +547,6 @@ type ImageFromUrlOptions = {
|
|
|
550
547
|
cal_max?: number;
|
|
551
548
|
trustCalMinMax?: boolean;
|
|
552
549
|
percentileFrac?: number;
|
|
553
|
-
visible?: boolean;
|
|
554
550
|
useQFormNotSForm?: boolean;
|
|
555
551
|
alphaThreshold?: boolean;
|
|
556
552
|
colormapNegative?: string;
|
|
@@ -577,7 +573,6 @@ type ImageFromFileOptions = {
|
|
|
577
573
|
trustCalMinMax?: boolean;
|
|
578
574
|
percentileFrac?: number;
|
|
579
575
|
ignoreZeroVoxels?: boolean;
|
|
580
|
-
visible?: boolean;
|
|
581
576
|
useQFormNotSForm?: boolean;
|
|
582
577
|
colormapNegative?: string;
|
|
583
578
|
imageType?: ImageType;
|
|
@@ -594,7 +589,6 @@ type ImageFromBase64 = {
|
|
|
594
589
|
trustCalMinMax?: boolean;
|
|
595
590
|
percentileFrac?: number;
|
|
596
591
|
ignoreZeroVoxels?: boolean;
|
|
597
|
-
visible?: boolean;
|
|
598
592
|
};
|
|
599
593
|
type ImageMetadata = {
|
|
600
594
|
id: string;
|
|
@@ -609,7 +603,7 @@ type ImageMetadata = {
|
|
|
609
603
|
dt: number;
|
|
610
604
|
bpv: number;
|
|
611
605
|
};
|
|
612
|
-
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,
|
|
606
|
+
declare const NVImageFromUrlOptions: (url: string, urlImageData?: string, name?: string, colormap?: string, opacity?: number, cal_min?: number, cal_max?: number, trustCalMinMax?: boolean, percentileFrac?: number, ignoreZeroVoxels?: boolean, useQFormNotSForm?: boolean, colormapNegative?: string, frame4D?: number, imageType?: ImageType, cal_minNeg?: number, cal_maxNeg?: number, colorbarVisible?: boolean, alphaThreshold?: boolean, colormapLabel?: string[]) => ImageFromUrlOptions;
|
|
613
607
|
|
|
614
608
|
/**
|
|
615
609
|
* a NVImage encapsulates some images data and provides methods to query and operate on images
|
|
@@ -633,7 +627,6 @@ declare class NVImage {
|
|
|
633
627
|
cal_minNeg: number;
|
|
634
628
|
cal_maxNeg: number;
|
|
635
629
|
colorbarVisible: boolean;
|
|
636
|
-
visible: boolean;
|
|
637
630
|
modulationImage: number | null;
|
|
638
631
|
modulateAlpha: number;
|
|
639
632
|
series: any;
|
|
@@ -708,7 +701,6 @@ declare class NVImage {
|
|
|
708
701
|
* @param trustCalMinMax - whether or not to trust cal_min and cal_max from the nifti header (trusting results in faster loading)
|
|
709
702
|
* @param percentileFrac - the percentile to use for setting the robust range of the display values (smart intensity setting for images with large ranges)
|
|
710
703
|
* @param ignoreZeroVoxels - whether or not to ignore zero voxels in setting the robust range of display values
|
|
711
|
-
* @param visible - whether or not this image is to be visible
|
|
712
704
|
* @param useQFormNotSForm - give precedence to QForm (Quaternion) or SForm (Matrix)
|
|
713
705
|
* @param colormapNegative - a color map to use for symmetrical negative intensities
|
|
714
706
|
* @param frame4D - volume displayed, 0 indexed, must be less than nFrame4D
|
|
@@ -724,7 +716,7 @@ declare class NVImage {
|
|
|
724
716
|
* @param colorbarVisible - TODO
|
|
725
717
|
* @param colormapLabel - TODO
|
|
726
718
|
*/
|
|
727
|
-
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,
|
|
719
|
+
constructor(dataBuffer?: ArrayBuffer | ArrayBuffer[] | null, name?: string, colormap?: string, opacity?: number, pairedImgData?: ArrayBuffer | null, cal_min?: number, cal_max?: number, trustCalMinMax?: boolean, percentileFrac?: number, ignoreZeroVoxels?: boolean, useQFormNotSForm?: boolean, colormapNegative?: string, frame4D?: number, imageType?: ImageType, cal_minNeg?: number, cal_maxNeg?: number, colorbarVisible?: boolean, colormapLabel?: LUT | null);
|
|
728
720
|
computeObliqueAngle(mtx44: mat4): number;
|
|
729
721
|
calculateOblique(): void;
|
|
730
722
|
THD_daxes_to_NIFTI(xyzDelta: number[], xyzOrigin: number[], orientSpecific: number[]): void;
|
|
@@ -763,7 +755,7 @@ declare class NVImage {
|
|
|
763
755
|
* factory function to load and return a new NVImage instance from a given URL
|
|
764
756
|
* @returns NVImage instance
|
|
765
757
|
*/
|
|
766
|
-
static loadFromUrl({ url, urlImgData, headers, name, colormap, opacity, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels,
|
|
758
|
+
static loadFromUrl({ url, urlImgData, headers, name, colormap, opacity, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels, useQFormNotSForm, colormapNegative, frame4D, isManifest, limitFrames4D, imageType, colorbarVisible }?: Partial<Omit<ImageFromUrlOptions, 'url'>> & {
|
|
767
759
|
url?: string | Uint8Array | ArrayBuffer;
|
|
768
760
|
}): Promise<NVImage>;
|
|
769
761
|
static readFileAsync(file: File, bytesToLoad?: number): Promise<ArrayBuffer>;
|
|
@@ -771,7 +763,7 @@ declare class NVImage {
|
|
|
771
763
|
* factory function to load and return a new NVImage instance from a file in the browser
|
|
772
764
|
*/
|
|
773
765
|
static loadFromFile({ file, // file can be an array of file objects or a single file object
|
|
774
|
-
name, colormap, opacity, urlImgData, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels,
|
|
766
|
+
name, colormap, opacity, urlImgData, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels, useQFormNotSForm, colormapNegative, frame4D, limitFrames4D, imageType }: ImageFromFileOptions): Promise<NVImage>;
|
|
775
767
|
/**
|
|
776
768
|
* factory function to load and return a new NVImage instance from a base64 encoded string
|
|
777
769
|
*
|
|
@@ -779,7 +771,7 @@ declare class NVImage {
|
|
|
779
771
|
* @example
|
|
780
772
|
* myImage = NVImage.loadFromBase64('SomeBase64String')
|
|
781
773
|
*/
|
|
782
|
-
static loadFromBase64({ base64, name, colormap, opacity, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels
|
|
774
|
+
static loadFromBase64({ base64, name, colormap, opacity, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels }: ImageFromBase64): NVImage;
|
|
783
775
|
/**
|
|
784
776
|
* make a clone of a NVImage instance and return a new NVImage
|
|
785
777
|
* @returns NVImage instance
|
|
@@ -850,7 +842,6 @@ type FreeSurferConnectome = {
|
|
|
850
842
|
declare class NVConnectome extends NVMesh {
|
|
851
843
|
gl: WebGL2RenderingContext;
|
|
852
844
|
nodesChanged: EventTarget;
|
|
853
|
-
legendLineThickness?: number;
|
|
854
845
|
constructor(gl: WebGL2RenderingContext, connectome: LegacyConnectome);
|
|
855
846
|
static convertLegacyConnectome(json: LegacyConnectome): Connectome;
|
|
856
847
|
static convertFreeSurferConnectome(json: FreeSurferConnectome, colormap?: string): Connectome;
|
|
@@ -902,6 +893,7 @@ type NVConfigOptions = {
|
|
|
902
893
|
textHeight: number;
|
|
903
894
|
colorbarHeight: number;
|
|
904
895
|
crosshairWidth: number;
|
|
896
|
+
crosshairGap: number;
|
|
905
897
|
rulerWidth: number;
|
|
906
898
|
show3Dcrosshair: boolean;
|
|
907
899
|
backColor: number[];
|
|
@@ -918,7 +910,7 @@ type NVConfigOptions = {
|
|
|
918
910
|
longTouchTimeout: number;
|
|
919
911
|
keyDebounceTime: number;
|
|
920
912
|
isNearestInterpolation: boolean;
|
|
921
|
-
|
|
913
|
+
atlasOutline: number;
|
|
922
914
|
isRuler: boolean;
|
|
923
915
|
isColorbar: boolean;
|
|
924
916
|
isOrientCube: boolean;
|
|
@@ -1358,7 +1350,7 @@ declare class NVMeshLoaders {
|
|
|
1358
1350
|
static readTCK(buffer: ArrayBuffer): TCK;
|
|
1359
1351
|
static readTRK(buffer: ArrayBuffer): TRK;
|
|
1360
1352
|
static readTxtVTK(buffer: ArrayBuffer): VTK;
|
|
1361
|
-
static readLayer(name: string | undefined, buffer: ArrayBuffer, nvmesh: NVMesh, opacity?: number, colormap?: string, colormapNegative?: string, useNegativeCmap?: boolean, cal_min?: number | null, cal_max?: number | null,
|
|
1353
|
+
static readLayer(name: string | undefined, buffer: ArrayBuffer, nvmesh: NVMesh, opacity?: number, colormap?: string, colormapNegative?: string, useNegativeCmap?: boolean, cal_min?: number | null, cal_max?: number | null, outlineBorder?: number): void;
|
|
1362
1354
|
static readSMP(buffer: ArrayBuffer, n_vert: number): Float32Array;
|
|
1363
1355
|
static readSTC(buffer: ArrayBuffer, n_vert: number): Float32Array;
|
|
1364
1356
|
static readCURV(buffer: ArrayBuffer, n_vert: number): Float32Array;
|
|
@@ -1372,6 +1364,7 @@ declare class NVMeshLoaders {
|
|
|
1372
1364
|
static readICO(buffer: ArrayBuffer): DefaultMeshType;
|
|
1373
1365
|
static readGEO(buffer: ArrayBuffer, isFlipWinding?: boolean): DefaultMeshType;
|
|
1374
1366
|
static readOFF(buffer: ArrayBuffer): DefaultMeshType;
|
|
1367
|
+
static readOBJMNI(buffer: ArrayBuffer): DefaultMeshType;
|
|
1375
1368
|
static readOBJ(buffer: ArrayBuffer): DefaultMeshType;
|
|
1376
1369
|
static readFreeSurfer(buffer: ArrayBuffer): DefaultMeshType;
|
|
1377
1370
|
static readSRF(buffer: ArrayBuffer): DefaultMeshType;
|
|
@@ -1484,7 +1477,7 @@ type NiiVueOptions = {
|
|
|
1484
1477
|
loadingText?: string;
|
|
1485
1478
|
dragAndDropEnabled?: boolean;
|
|
1486
1479
|
isNearestInterpolation?: boolean;
|
|
1487
|
-
|
|
1480
|
+
atlasOutline?: number;
|
|
1488
1481
|
isRuler?: boolean;
|
|
1489
1482
|
isColorbar?: boolean;
|
|
1490
1483
|
isOrientCube?: boolean;
|
|
@@ -1529,7 +1522,6 @@ type UIData = {
|
|
|
1529
1522
|
dragClipPlaneStartDepthAziElev: number[];
|
|
1530
1523
|
lastTwoTouchDistance: number;
|
|
1531
1524
|
multiTouchGesture: boolean;
|
|
1532
|
-
loading$: Subject<unknown>;
|
|
1533
1525
|
dpr?: number;
|
|
1534
1526
|
};
|
|
1535
1527
|
type SaveImageOptions = {
|
|
@@ -1614,10 +1606,10 @@ declare class Niivue {
|
|
|
1614
1606
|
position?: vec3;
|
|
1615
1607
|
extentsMin?: vec3;
|
|
1616
1608
|
extentsMax?: vec3;
|
|
1609
|
+
private resizeObserver;
|
|
1617
1610
|
syncOpts: Record<string, unknown>;
|
|
1618
1611
|
readyForSync: boolean;
|
|
1619
1612
|
uiData: UIData;
|
|
1620
|
-
eventsToSubjects: Record<string, Subject<unknown>>;
|
|
1621
1613
|
back: NVImage | null;
|
|
1622
1614
|
overlays: NVImage[];
|
|
1623
1615
|
deferredVolumes: ImageFromUrlOptions[];
|
|
@@ -1829,6 +1821,7 @@ declare class Niivue {
|
|
|
1829
1821
|
textHeight: number;
|
|
1830
1822
|
colorbarHeight: number;
|
|
1831
1823
|
crosshairWidth: number;
|
|
1824
|
+
crosshairGap: number;
|
|
1832
1825
|
rulerWidth: number;
|
|
1833
1826
|
show3Dcrosshair: boolean;
|
|
1834
1827
|
backColor: number[];
|
|
@@ -1845,7 +1838,7 @@ declare class Niivue {
|
|
|
1845
1838
|
longTouchTimeout: number;
|
|
1846
1839
|
keyDebounceTime: number;
|
|
1847
1840
|
isNearestInterpolation: boolean;
|
|
1848
|
-
|
|
1841
|
+
atlasOutline: number;
|
|
1849
1842
|
isRuler: boolean;
|
|
1850
1843
|
isColorbar: boolean;
|
|
1851
1844
|
isOrientCube: boolean;
|
|
@@ -1909,7 +1902,6 @@ declare class Niivue {
|
|
|
1909
1902
|
initialized: boolean;
|
|
1910
1903
|
currentDrawUndoBitmap: number;
|
|
1911
1904
|
loadingText: string;
|
|
1912
|
-
subscriptions: Array<Record<string, Subscription>>;
|
|
1913
1905
|
/**
|
|
1914
1906
|
* @param options - options object to set modifiable Niivue properties
|
|
1915
1907
|
*/
|
|
@@ -1938,28 +1930,6 @@ declare class Niivue {
|
|
|
1938
1930
|
* @see {@link https://niivue.github.io/niivue/features/multiplanar.html|live demo usage}
|
|
1939
1931
|
*/
|
|
1940
1932
|
attachTo(id: string, isAntiAlias?: null): Promise<this>;
|
|
1941
|
-
/**
|
|
1942
|
-
* register a callback function to run when known Niivue events happen
|
|
1943
|
-
* @param event - the name of the event to watch for. Event names are shown in the type column
|
|
1944
|
-
* @param callback - the function to call when the event happens
|
|
1945
|
-
* @example
|
|
1946
|
-
* niivue = new Niivue()
|
|
1947
|
-
*
|
|
1948
|
-
* // 'location' update event is fired when the crosshair changes position via user input
|
|
1949
|
-
* function doSomethingWithLocationData(data)\{
|
|
1950
|
-
* // data has the shape \{mm: [N, N, N], vox: [N, N, N], frac: [N, N, N], values: this.volumes.map(v =\> \{return val\})\}
|
|
1951
|
-
* //...
|
|
1952
|
-
* \}
|
|
1953
|
-
*/
|
|
1954
|
-
on(event: string, callback: (data: unknown) => void): void;
|
|
1955
|
-
/**
|
|
1956
|
-
* off unsubscribes events and subjects (the opposite of on)
|
|
1957
|
-
* @param event - the name of the event to watch for. Event names are shown in the type column
|
|
1958
|
-
* @example
|
|
1959
|
-
* niivue = new Niivue()
|
|
1960
|
-
* niivue.off('location')
|
|
1961
|
-
*/
|
|
1962
|
-
off(event: string): void;
|
|
1963
1933
|
/**
|
|
1964
1934
|
* attach the Niivue instance to a canvas element directly
|
|
1965
1935
|
* @param canvas - the canvas element reference
|
|
@@ -2245,6 +2215,17 @@ declare class Niivue {
|
|
|
2245
2215
|
* @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
|
|
2246
2216
|
*/
|
|
2247
2217
|
setMeshProperty(id: number, key: keyof NVMesh, val: number): void;
|
|
2218
|
+
/**
|
|
2219
|
+
* returns the index of the mesh vertex that is closest to the provided coordinates
|
|
2220
|
+
* @param id - identity of mesh to change
|
|
2221
|
+
* @param Xmm - location in left/right dimension
|
|
2222
|
+
* @param Ymm - location in posterior/anterior dimension
|
|
2223
|
+
* @param Zmm - location in foot/head dimension
|
|
2224
|
+
* @returns the an array where ret[0] is the mesh index and ret[1] is distance from vertex to coordinates
|
|
2225
|
+
* @example niivue.indexNearestXYZmm(niivue.meshes[0].id, -22, 42, 13)
|
|
2226
|
+
* @see {@link https://niivue.github.io/niivue/features/clipplanes.html | live demo usage}
|
|
2227
|
+
*/
|
|
2228
|
+
indexNearestXYZmm(mesh: number, Xmm: number, Ymm: number, Zmm: number): number[];
|
|
2248
2229
|
/**
|
|
2249
2230
|
* reverse triangle winding of mesh (swap front and back faces)
|
|
2250
2231
|
* @param id - identity of mesh to change
|
|
@@ -2578,6 +2559,7 @@ declare class Niivue {
|
|
|
2578
2559
|
node: NVConnectomeNode;
|
|
2579
2560
|
};
|
|
2580
2561
|
}): void;
|
|
2562
|
+
loadConnectomeAsMesh(json: Connectome | LegacyConnectome | FreeSurferConnectome): NVMesh;
|
|
2581
2563
|
/**
|
|
2582
2564
|
* load a connectome specified by json
|
|
2583
2565
|
* @param connectome - model
|
|
@@ -2786,7 +2768,7 @@ declare class Niivue {
|
|
|
2786
2768
|
/**
|
|
2787
2769
|
* modulate intensity of one image based on intensity of another
|
|
2788
2770
|
* @param idTarget - the ID of the NVImage to be biased
|
|
2789
|
-
* @param idModulation - the ID of the NVImage that controls bias (
|
|
2771
|
+
* @param idModulation - the ID of the NVImage that controls bias (empty string to disable modulation)
|
|
2790
2772
|
* @param modulateAlpha - does the modulation influence alpha transparency (values greater than 1).
|
|
2791
2773
|
* @example niivue.setModulationImage(niivue.volumes[0].id, niivue.volumes[1].id);
|
|
2792
2774
|
* @see {@link https://niivue.github.io/niivue/features/modulate.html|live demo scalar usage}
|
|
@@ -2862,7 +2844,7 @@ declare class Niivue {
|
|
|
2862
2844
|
drawTextBetween(startXYendXY: number[], str: string, scale?: number, color?: number[] | null): void;
|
|
2863
2845
|
drawTextBelow(xy: number[], str: string, scale?: number, color?: number[] | null): void;
|
|
2864
2846
|
updateInterpolation(layer: number, isForceLinear?: boolean): void;
|
|
2865
|
-
setAtlasOutline(isOutline:
|
|
2847
|
+
setAtlasOutline(isOutline: number): void;
|
|
2866
2848
|
/**
|
|
2867
2849
|
* select between nearest and linear interpolation for voxel based images
|
|
2868
2850
|
* @param isNearest - whether nearest neighbor interpolation is used, else linear interpolation
|
|
@@ -2942,4 +2924,4 @@ declare class Niivue {
|
|
|
2942
2924
|
set gl(gl: WebGL2RenderingContext | null);
|
|
2943
2925
|
}
|
|
2944
2926
|
|
|
2945
|
-
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 };
|
|
2927
|
+
export { type Connectome, type ConnectomeOptions, DEFAULT_OPTIONS, DRAG_MODE, type DocumentData, type ExportDocumentData, LabelLineTerminator, LabelTextAlignment, type LegacyConnectome, type LegacyNodes, MULTIPLANAR_TYPE, type NVConnectomeEdge, type NVConnectomeNode, NVController, NVDocument, NVImage, NVImageFromUrlOptions, NVLabel3D, NVLabel3DStyle, NVMesh, NVMeshFromUrlOptions, NVMeshLoaders, NVUtilities, type NiftiHeader, Niivue, type Point, SLICE_TYPE, type Volume, cmapper, ColorTables as colortables };
|