@niivue/niivue 0.41.0 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +917 -917
- package/build/index.js +1474 -770
- package/build/index.js.map +1 -1
- package/build/index.min.js +1 -1
- package/package.json +34 -35
- package/src/niivue/index.ts +972 -433
- package/src/niivue-object3D.ts +42 -13
- package/src/nvconnectome.ts +10 -8
- package/src/nvcontroller.ts +1 -0
- package/src/nvdocument.ts +15 -2
- package/src/nvimage/index.ts +372 -128
- package/src/nvimage/utils.ts +36 -1
- package/src/nvlabel.ts +2 -0
- package/src/nvmesh-loaders.ts +83 -117
- package/src/nvmesh-types.ts +12 -12
- package/src/nvmesh.ts +73 -244
- package/src/nvutilities.ts +1 -0
- package/src/shader-srcs.ts +114 -13
- package/src/types.ts +17 -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[];
|
|
@@ -110,6 +109,7 @@ declare enum LabelLineTerminator {
|
|
|
110
109
|
}
|
|
111
110
|
/**
|
|
112
111
|
* Class representing label style.
|
|
112
|
+
* @ignore
|
|
113
113
|
*/
|
|
114
114
|
declare class NVLabel3DStyle {
|
|
115
115
|
textColor: number[];
|
|
@@ -134,6 +134,7 @@ declare class NVLabel3DStyle {
|
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* Label class
|
|
137
|
+
* @ignore
|
|
137
138
|
*/
|
|
138
139
|
declare class NVLabel3D {
|
|
139
140
|
text: string;
|
|
@@ -147,626 +148,291 @@ declare class NVLabel3D {
|
|
|
147
148
|
constructor(text: string, style: NVLabel3DStyle, points?: number[] | number[][]);
|
|
148
149
|
}
|
|
149
150
|
|
|
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
151
|
/**
|
|
198
|
-
*
|
|
152
|
+
* Enum for NIfTI datatype codes
|
|
153
|
+
* // https://nifti.nimh.nih.gov/pub/dist/src/niftilib/nifti1.h
|
|
199
154
|
*/
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
155
|
+
declare enum NiiDataType {
|
|
156
|
+
DT_NONE = 0,
|
|
157
|
+
DT_BINARY = 1,
|
|
158
|
+
DT_UINT8 = 2,
|
|
159
|
+
DT_INT16 = 4,
|
|
160
|
+
DT_INT32 = 8,
|
|
161
|
+
DT_FLOAT32 = 16,
|
|
162
|
+
DT_COMPLEX64 = 32,
|
|
163
|
+
DT_FLOAT64 = 64,
|
|
164
|
+
DT_RGB24 = 128,
|
|
165
|
+
DT_INT8 = 256,
|
|
166
|
+
DT_UINT16 = 512,
|
|
167
|
+
DT_UINT32 = 768,
|
|
168
|
+
DT_INT64 = 1024,
|
|
169
|
+
DT_UINT64 = 1280,
|
|
170
|
+
DT_FLOAT128 = 1536,
|
|
171
|
+
DT_COMPLEX128 = 1792,
|
|
172
|
+
DT_COMPLEX256 = 2048,
|
|
173
|
+
DT_RGBA32 = 2304
|
|
174
|
+
}
|
|
209
175
|
/**
|
|
210
|
-
*
|
|
176
|
+
* Enum for supported image types (e.g. NII, NRRD, DICOM)
|
|
211
177
|
*/
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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
|
-
global_min?: number;
|
|
252
|
-
global_max?: number;
|
|
178
|
+
declare enum ImageType {
|
|
179
|
+
UNKNOWN = 0,
|
|
180
|
+
NII = 1,
|
|
181
|
+
DCM = 2,
|
|
182
|
+
DCM_MANIFEST = 3,
|
|
183
|
+
MIH = 4,
|
|
184
|
+
MIF = 5,
|
|
185
|
+
NHDR = 6,
|
|
186
|
+
NRRD = 7,
|
|
187
|
+
MHD = 8,
|
|
188
|
+
MHA = 9,
|
|
189
|
+
MGH = 10,
|
|
190
|
+
MGZ = 11,
|
|
191
|
+
V = 12,
|
|
192
|
+
V16 = 13,
|
|
193
|
+
VMR = 14,
|
|
194
|
+
HEAD = 15,
|
|
195
|
+
DCM_FOLDER = 16
|
|
196
|
+
}
|
|
197
|
+
type ImageFromUrlOptions = {
|
|
198
|
+
url: string;
|
|
199
|
+
urlImageData?: string;
|
|
200
|
+
headers?: Record<string, string>;
|
|
201
|
+
name?: string;
|
|
202
|
+
colorMap?: string;
|
|
203
|
+
colormap?: string;
|
|
204
|
+
opacity?: number;
|
|
253
205
|
cal_min?: number;
|
|
254
206
|
cal_max?: number;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
};
|
|
272
|
-
type TRX = {
|
|
273
|
-
pts: number[];
|
|
274
|
-
offsetPt0: number[];
|
|
275
|
-
dpg: ValuesArray;
|
|
276
|
-
dps: ValuesArray;
|
|
277
|
-
dpv: ValuesArray;
|
|
278
|
-
header: unknown;
|
|
279
|
-
};
|
|
280
|
-
type TRK = {
|
|
281
|
-
pts: Float32Array;
|
|
282
|
-
offsetPt0: Uint32Array;
|
|
283
|
-
dps: ValuesArray;
|
|
284
|
-
dpv: ValuesArray;
|
|
285
|
-
};
|
|
286
|
-
type TCK = {
|
|
287
|
-
pts: Float32Array;
|
|
288
|
-
offsetPt0: Uint32Array;
|
|
289
|
-
};
|
|
290
|
-
type VTK = DefaultMeshType | {
|
|
291
|
-
pts: Float32Array;
|
|
292
|
-
offsetPt0: Uint32Array;
|
|
293
|
-
};
|
|
294
|
-
type ANNOT = Uint32Array | {
|
|
295
|
-
scalars: Float32Array;
|
|
296
|
-
colormapLabel: LUT;
|
|
297
|
-
};
|
|
298
|
-
type MZ3 = Float32Array | {
|
|
299
|
-
positions: Float32Array | null;
|
|
300
|
-
indices: Int32Array | null;
|
|
301
|
-
scalars: Float32Array;
|
|
302
|
-
colors: Float32Array | null;
|
|
207
|
+
trustCalMinMax?: boolean;
|
|
208
|
+
percentileFrac?: number;
|
|
209
|
+
useQFormNotSForm?: boolean;
|
|
210
|
+
alphaThreshold?: boolean;
|
|
211
|
+
colormapNegative?: string;
|
|
212
|
+
cal_minNeg?: number;
|
|
213
|
+
cal_maxNeg?: number;
|
|
214
|
+
colorbarVisible?: boolean;
|
|
215
|
+
ignoreZeroVoxels?: boolean;
|
|
216
|
+
imageType?: ImageType;
|
|
217
|
+
frame4D?: number;
|
|
218
|
+
colormapLabel?: string[];
|
|
219
|
+
pairedImgData?: null;
|
|
220
|
+
limitFrames4D?: number;
|
|
221
|
+
isManifest?: boolean;
|
|
222
|
+
urlImgData?: string;
|
|
303
223
|
};
|
|
304
|
-
type
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
224
|
+
type ImageFromFileOptions = {
|
|
225
|
+
file: File | File[];
|
|
226
|
+
name?: string;
|
|
227
|
+
colormap?: string;
|
|
228
|
+
opacity?: number;
|
|
229
|
+
urlImgData?: File | null;
|
|
230
|
+
cal_min?: number;
|
|
231
|
+
cal_max?: number;
|
|
232
|
+
trustCalMinMax?: boolean;
|
|
233
|
+
percentileFrac?: number;
|
|
234
|
+
ignoreZeroVoxels?: boolean;
|
|
235
|
+
useQFormNotSForm?: boolean;
|
|
236
|
+
colormapNegative?: string;
|
|
237
|
+
imageType?: ImageType;
|
|
238
|
+
frame4D?: number;
|
|
239
|
+
limitFrames4D?: number;
|
|
310
240
|
};
|
|
311
|
-
type
|
|
312
|
-
|
|
313
|
-
|
|
241
|
+
type ImageFromBase64 = {
|
|
242
|
+
base64: string;
|
|
243
|
+
name?: string;
|
|
244
|
+
colormap?: string;
|
|
245
|
+
opacity?: number;
|
|
246
|
+
cal_min?: number;
|
|
247
|
+
cal_max?: number;
|
|
248
|
+
trustCalMinMax?: boolean;
|
|
249
|
+
percentileFrac?: number;
|
|
250
|
+
ignoreZeroVoxels?: boolean;
|
|
314
251
|
};
|
|
315
|
-
type
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
252
|
+
type ImageMetadata = {
|
|
253
|
+
id: string;
|
|
254
|
+
datatypeCode: number;
|
|
255
|
+
nx: number;
|
|
256
|
+
ny: number;
|
|
257
|
+
nz: number;
|
|
258
|
+
nt: number;
|
|
259
|
+
dx: number;
|
|
260
|
+
dy: number;
|
|
261
|
+
dz: number;
|
|
262
|
+
dt: number;
|
|
263
|
+
bpv: number;
|
|
319
264
|
};
|
|
265
|
+
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;
|
|
320
266
|
|
|
321
|
-
|
|
267
|
+
type TypedVoxelArray = Float32Array | Uint8Array | Int16Array | Float64Array | Uint16Array;
|
|
268
|
+
/**
|
|
269
|
+
* a NVImage encapsulates some images data and provides methods to query and operate on images
|
|
322
270
|
*/
|
|
323
|
-
declare
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
FIBER = "fiber"
|
|
327
|
-
}
|
|
328
|
-
type NVMeshLayer = {
|
|
329
|
-
name?: string;
|
|
330
|
-
key?: string;
|
|
271
|
+
declare class NVImage {
|
|
272
|
+
name: string;
|
|
273
|
+
id: string;
|
|
331
274
|
url?: string;
|
|
332
275
|
headers?: Record<string, string>;
|
|
333
|
-
|
|
334
|
-
|
|
276
|
+
_colormap: string;
|
|
277
|
+
_opacity: number;
|
|
278
|
+
percentileFrac: number;
|
|
279
|
+
ignoreZeroVoxels: boolean;
|
|
280
|
+
trustCalMinMax: boolean;
|
|
335
281
|
colormapNegative: string;
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
cal_min: number;
|
|
342
|
-
cal_max: number;
|
|
282
|
+
colormapLabel: LUT | null;
|
|
283
|
+
colormapInvert?: boolean;
|
|
284
|
+
nFrame4D?: number;
|
|
285
|
+
frame4D: number;
|
|
286
|
+
nTotalFrame4D?: number;
|
|
343
287
|
cal_minNeg: number;
|
|
344
288
|
cal_maxNeg: number;
|
|
345
|
-
isAdditiveBlend: boolean;
|
|
346
|
-
frame4D: number;
|
|
347
|
-
nFrame4D: number;
|
|
348
|
-
values: number[];
|
|
349
|
-
outlineBorder?: number;
|
|
350
|
-
isTransparentBelowCalMin?: boolean;
|
|
351
|
-
alphaThreshold: boolean;
|
|
352
|
-
base64?: string;
|
|
353
|
-
colorbarVisible?: boolean;
|
|
354
|
-
};
|
|
355
|
-
declare class NVMeshFromUrlOptions {
|
|
356
|
-
url: string;
|
|
357
|
-
gl: WebGL2RenderingContext | null;
|
|
358
|
-
name: string;
|
|
359
|
-
opacity: number;
|
|
360
|
-
rgba255: number[];
|
|
361
|
-
visible: boolean;
|
|
362
|
-
layers: NVMeshLayer[];
|
|
363
|
-
colorbarVisible: boolean;
|
|
364
|
-
constructor(url?: string, gl?: null, name?: string, opacity?: number, rgba255?: number[], visible?: boolean, layers?: never[], colorbarVisible?: boolean);
|
|
365
|
-
}
|
|
366
|
-
type BaseLoadParams = {
|
|
367
|
-
gl: WebGL2RenderingContext;
|
|
368
|
-
name: string;
|
|
369
|
-
opacity: number;
|
|
370
|
-
rgba255: number[];
|
|
371
|
-
visible: boolean;
|
|
372
|
-
layers: NVMeshLayer[];
|
|
373
|
-
};
|
|
374
|
-
type LoadFromUrlParams = Partial<BaseLoadParams> & {
|
|
375
|
-
url: string;
|
|
376
|
-
headers?: Record<string, string>;
|
|
377
|
-
};
|
|
378
|
-
type LoadFromFileParams = BaseLoadParams & {
|
|
379
|
-
file: Blob;
|
|
380
|
-
};
|
|
381
|
-
type LoadFromBase64Params = BaseLoadParams & {
|
|
382
|
-
base64: string;
|
|
383
|
-
};
|
|
384
|
-
/**
|
|
385
|
-
* a NVMesh encapsulates some mesh data and provides methods to query and operate on meshes
|
|
386
|
-
*/
|
|
387
|
-
declare class NVMesh {
|
|
388
|
-
id: string;
|
|
389
|
-
name: string;
|
|
390
|
-
anatomicalStructurePrimary: string;
|
|
391
289
|
colorbarVisible: boolean;
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
edgeMin?: number;
|
|
437
|
-
edgeMax?: number;
|
|
438
|
-
nodes?: LegacyNodes | NVConnectomeNode[];
|
|
439
|
-
edges?: number[] | NVConnectomeEdge[];
|
|
440
|
-
points?: Point[];
|
|
290
|
+
modulationImage: number | null;
|
|
291
|
+
modulateAlpha: number;
|
|
292
|
+
series: any;
|
|
293
|
+
nVox3D?: number;
|
|
294
|
+
oblique_angle?: number;
|
|
295
|
+
maxShearDeg?: number;
|
|
296
|
+
useQFormNotSForm: boolean;
|
|
297
|
+
alphaThreshold?: number;
|
|
298
|
+
pixDims?: number[];
|
|
299
|
+
matRAS?: mat4;
|
|
300
|
+
pixDimsRAS?: number[];
|
|
301
|
+
obliqueRAS?: mat4;
|
|
302
|
+
dimsRAS?: number[];
|
|
303
|
+
permRAS?: number[];
|
|
304
|
+
img2RASstep?: number[];
|
|
305
|
+
img2RASstart?: number[];
|
|
306
|
+
toRAS?: mat4;
|
|
307
|
+
toRASvox?: mat4;
|
|
308
|
+
frac2mm?: mat4;
|
|
309
|
+
frac2mmOrtho?: mat4;
|
|
310
|
+
extentsMinOrtho?: number[];
|
|
311
|
+
extentsMaxOrtho?: number[];
|
|
312
|
+
mm2ortho?: mat4;
|
|
313
|
+
hdr: nifti.NIFTI1 | nifti.NIFTI2 | null;
|
|
314
|
+
imageType?: ImageType;
|
|
315
|
+
img?: TypedVoxelArray;
|
|
316
|
+
imaginary?: Float32Array;
|
|
317
|
+
fileObject?: File | File[];
|
|
318
|
+
dims?: number[];
|
|
319
|
+
onColormapChange: (img: NVImage) => void;
|
|
320
|
+
onOpacityChange: (img: NVImage) => void;
|
|
321
|
+
mm000?: vec3;
|
|
322
|
+
mm100?: vec3;
|
|
323
|
+
mm010?: vec3;
|
|
324
|
+
mm001?: vec3;
|
|
325
|
+
cal_min?: number;
|
|
326
|
+
cal_max?: number;
|
|
327
|
+
robust_min?: number;
|
|
328
|
+
robust_max?: number;
|
|
329
|
+
global_min?: number;
|
|
330
|
+
global_max?: number;
|
|
331
|
+
urlImgData?: string;
|
|
332
|
+
isManifest?: boolean;
|
|
333
|
+
limitFrames4D?: number;
|
|
441
334
|
/**
|
|
442
|
-
*
|
|
443
|
-
* @param
|
|
335
|
+
*
|
|
336
|
+
* @param dataBuffer - an array buffer of image data to load (there are also methods that abstract this more. See loadFromUrl, and loadFromFile)
|
|
444
337
|
* @param name - a name for this image. Default is an empty string
|
|
445
|
-
* @param
|
|
446
|
-
* @param opacity - the opacity for this
|
|
447
|
-
* @param
|
|
448
|
-
* @param
|
|
449
|
-
* @param
|
|
450
|
-
* @param
|
|
451
|
-
* @param
|
|
452
|
-
* @param
|
|
453
|
-
* @param
|
|
454
|
-
* @param
|
|
338
|
+
* @param colormap - a color map to use. default is gray
|
|
339
|
+
* @param opacity - the opacity for this image. default is 1
|
|
340
|
+
* @param pairedImgData - Allows loading formats where header and image are separate files (e.g. nifti.hdr, nifti.img)
|
|
341
|
+
* @param cal_min - minimum intensity for color brightness/contrast
|
|
342
|
+
* @param cal_max - maximum intensity for color brightness/contrast
|
|
343
|
+
* @param trustCalMinMax - whether or not to trust cal_min and cal_max from the nifti header (trusting results in faster loading)
|
|
344
|
+
* @param percentileFrac - the percentile to use for setting the robust range of the display values (smart intensity setting for images with large ranges)
|
|
345
|
+
* @param ignoreZeroVoxels - whether or not to ignore zero voxels in setting the robust range of display values
|
|
346
|
+
* @param useQFormNotSForm - give precedence to QForm (Quaternion) or SForm (Matrix)
|
|
347
|
+
* @param colormapNegative - a color map to use for symmetrical negative intensities
|
|
348
|
+
* @param frame4D - volume displayed, 0 indexed, must be less than nFrame4D
|
|
349
|
+
*
|
|
350
|
+
* FIXME the following params are documented but not included in the actual constructor
|
|
351
|
+
* @param onColormapChange - callback for color map change
|
|
352
|
+
* @param onOpacityChange -callback for color map change
|
|
353
|
+
*
|
|
354
|
+
* TODO the following parameters were not documented
|
|
355
|
+
* @param imageType - TODO
|
|
356
|
+
* @param cal_minNeg - TODO
|
|
357
|
+
* @param cal_maxNeg - TODO
|
|
358
|
+
* @param colorbarVisible - TODO
|
|
359
|
+
* @param colormapLabel - TODO
|
|
455
360
|
*/
|
|
456
|
-
constructor(
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
361
|
+
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);
|
|
362
|
+
computeObliqueAngle(mtx44: mat4): number;
|
|
363
|
+
calculateOblique(): void;
|
|
364
|
+
THD_daxes_to_NIFTI(xyzDelta: number[], xyzOrigin: number[], orientSpecific: number[]): void;
|
|
365
|
+
SetPixDimFromSForm(): void;
|
|
366
|
+
readDICOM(buf: ArrayBuffer | ArrayBuffer[]): ArrayBuffer;
|
|
367
|
+
readECAT(buffer: ArrayBuffer): ArrayBuffer;
|
|
368
|
+
readV16(buffer: ArrayBuffer): ArrayBuffer;
|
|
369
|
+
readVMR(buffer: ArrayBuffer): ArrayBuffer;
|
|
370
|
+
readMGH(buffer: ArrayBuffer): ArrayBuffer;
|
|
371
|
+
readHEAD(dataBuffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
|
|
372
|
+
readMHA(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
|
|
373
|
+
readMIF(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
|
|
374
|
+
readNRRD(dataBuffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
|
|
375
|
+
calculateRAS(): void;
|
|
376
|
+
img2RAS(): TypedVoxelArray;
|
|
377
|
+
vox2mm(XYZ: number[], mtx: mat4): vec3;
|
|
378
|
+
mm2vox(mm: number[], frac?: boolean): Float32Array | vec3;
|
|
379
|
+
arrayEquals(a: unknown[], b: unknown[]): boolean;
|
|
380
|
+
setColormap(cm: string): void;
|
|
381
|
+
setColormapLabel(cm: ColorMap): void;
|
|
382
|
+
setColormapLabelFromUrl(url: string): Promise<void>;
|
|
383
|
+
get colormap(): string;
|
|
384
|
+
get colorMap(): string;
|
|
385
|
+
set colormap(cm: string);
|
|
386
|
+
set colorMap(cm: string);
|
|
387
|
+
get opacity(): number;
|
|
388
|
+
set opacity(opacity: number);
|
|
389
|
+
calMinMax(): number[];
|
|
390
|
+
intensityRaw2Scaled(raw: number): number;
|
|
391
|
+
intensityScaled2Raw(scaled: number): number;
|
|
392
|
+
saveToUint8Array(fnm: string, drawing8?: Uint8Array | null): Uint8Array;
|
|
393
|
+
saveToDisk(fnm?: string, drawing8?: Uint8Array | null): Uint8Array;
|
|
394
|
+
static fetchDicomData(url: string, headers?: Record<string, string>): Promise<ArrayBuffer[]>;
|
|
395
|
+
static fetchPartial(url: string, bytesToLoad: number, headers?: Record<string, string>): Promise<Response>;
|
|
473
396
|
/**
|
|
474
|
-
* factory function to load and return a new
|
|
397
|
+
* factory function to load and return a new NVImage instance from a given URL
|
|
398
|
+
* @returns NVImage instance
|
|
475
399
|
*/
|
|
476
|
-
static loadFromUrl({ url,
|
|
477
|
-
|
|
400
|
+
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'>> & {
|
|
401
|
+
url?: string | Uint8Array | ArrayBuffer;
|
|
402
|
+
}): Promise<NVImage>;
|
|
403
|
+
static readFileAsync(file: File, bytesToLoad?: number): Promise<ArrayBuffer>;
|
|
478
404
|
/**
|
|
479
|
-
* factory function to load and return a new
|
|
405
|
+
* factory function to load and return a new NVImage instance from a file in the browser
|
|
406
|
+
*/
|
|
407
|
+
static loadFromFile({ file, // file can be an array of file objects or a single file object
|
|
408
|
+
name, colormap, opacity, urlImgData, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels, useQFormNotSForm, colormapNegative, frame4D, limitFrames4D, imageType }: ImageFromFileOptions): Promise<NVImage>;
|
|
409
|
+
/**
|
|
410
|
+
* factory function to load and return a new NVImage instance from a base64 encoded string
|
|
480
411
|
*
|
|
481
|
-
* @returns
|
|
412
|
+
* @returns NVImage instance
|
|
413
|
+
* @example
|
|
414
|
+
* myImage = NVImage.loadFromBase64('SomeBase64String')
|
|
482
415
|
*/
|
|
483
|
-
static
|
|
416
|
+
static createNiftiArray(dims?: number[], pixDims?: number[], affine?: number[], datatypeCode?: number, // DT_UINT8
|
|
417
|
+
img?: Uint8Array): Uint8Array;
|
|
418
|
+
static createNiftiHeader(dims?: number[], pixDims?: number[], affine?: number[], datatypeCode?: number): nifti.NIFTI1;
|
|
484
419
|
/**
|
|
485
|
-
*
|
|
420
|
+
* read a 3D slab of voxels from a volume
|
|
421
|
+
* @param voxStart - first row, column and slice (RAS order) for selection
|
|
422
|
+
* @param voxEnd - final row, column and slice (RAS order) for selection
|
|
423
|
+
* @param dataType - array data type. Options: 'same' (default), 'uint8', 'float32'
|
|
424
|
+
* @returns the an array where ret[0] is the voxel values and ret[1] is dimension of selection
|
|
425
|
+
* @see {@link https://niivue.github.io/niivue/features/slab_selection.html | live demo usage}
|
|
486
426
|
*/
|
|
487
|
-
|
|
488
|
-
static readGII(buffer: ArrayBuffer): GII;
|
|
489
|
-
static readX3D(buffer: ArrayBuffer): X3D;
|
|
490
|
-
static readNII(buffer: ArrayBuffer, n_vert?: number): Uint8Array | Float32Array | Int32Array | Int16Array;
|
|
491
|
-
static readNII2(buffer: ArrayBuffer, n_vert?: number): Uint8Array | Float32Array | Int32Array | Int16Array;
|
|
492
|
-
static readMGH(buffer: ArrayBuffer): MGH;
|
|
493
|
-
static readSTL(buffer: ArrayBuffer): DefaultMeshType;
|
|
494
|
-
static readTxtSTL(buffer: ArrayBuffer): DefaultMeshType;
|
|
495
|
-
static readSRF(buffer: ArrayBuffer): DefaultMeshType;
|
|
496
|
-
static readFreeSurfer(buffer: ArrayBuffer): DefaultMeshType;
|
|
497
|
-
static readOBJ(buffer: ArrayBuffer): DefaultMeshType;
|
|
498
|
-
static readOFF(buffer: ArrayBuffer): DefaultMeshType;
|
|
499
|
-
static readGEO(buffer: ArrayBuffer, isFlipWinding?: boolean): DefaultMeshType;
|
|
500
|
-
static readICO(buffer: ArrayBuffer): DefaultMeshType;
|
|
501
|
-
static readPLY(buffer: ArrayBuffer): DefaultMeshType;
|
|
502
|
-
static readMZ3(buffer: ArrayBuffer, n_vert?: number): MZ3;
|
|
503
|
-
static readVTK(buffer: ArrayBuffer): VTK;
|
|
504
|
-
static readASC(buffer: ArrayBuffer): DefaultMeshType;
|
|
505
|
-
static readNV(buffer: ArrayBuffer): DefaultMeshType;
|
|
506
|
-
static readANNOT(buffer: ArrayBuffer, n_vert: number, isReadColortables?: boolean): ANNOT;
|
|
507
|
-
static readCURV(buffer: ArrayBuffer, n_vert: number): Float32Array;
|
|
508
|
-
static readSTC(buffer: ArrayBuffer, n_vert: number): Float32Array;
|
|
509
|
-
static readSMP(buffer: ArrayBuffer, n_vert: number): Float32Array;
|
|
510
|
-
static readTxtVTK(buffer: ArrayBuffer): VTK;
|
|
511
|
-
static readTRK(buffer: ArrayBuffer): TRK;
|
|
512
|
-
static readTCK(buffer: ArrayBuffer): TCK;
|
|
513
|
-
static readTSF(buffer: ArrayBuffer): Float32Array;
|
|
514
|
-
static readTT(buffer: ArrayBuffer): TT;
|
|
515
|
-
static readTRX(buffer: ArrayBuffer): TRX;
|
|
516
|
-
static readTRACT(buffer: ArrayBuffer): TRACT;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
* Enum for supported image types (e.g. NII, NRRD, DICOM)
|
|
521
|
-
*/
|
|
522
|
-
declare enum ImageType {
|
|
523
|
-
UNKNOWN = 0,
|
|
524
|
-
NII = 1,
|
|
525
|
-
DCM = 2,
|
|
526
|
-
DCM_MANIFEST = 3,
|
|
527
|
-
MIH = 4,
|
|
528
|
-
MIF = 5,
|
|
529
|
-
NHDR = 6,
|
|
530
|
-
NRRD = 7,
|
|
531
|
-
MHD = 8,
|
|
532
|
-
MHA = 9,
|
|
533
|
-
MGH = 10,
|
|
534
|
-
MGZ = 11,
|
|
535
|
-
V = 12,
|
|
536
|
-
V16 = 13,
|
|
537
|
-
VMR = 14,
|
|
538
|
-
HEAD = 15,
|
|
539
|
-
DCM_FOLDER = 16
|
|
540
|
-
}
|
|
541
|
-
type ImageFromUrlOptions = {
|
|
542
|
-
url: string;
|
|
543
|
-
urlImageData?: string;
|
|
544
|
-
headers?: Record<string, string>;
|
|
545
|
-
name?: string;
|
|
546
|
-
colorMap?: string;
|
|
547
|
-
colormap?: string;
|
|
548
|
-
opacity?: number;
|
|
549
|
-
cal_min?: number;
|
|
550
|
-
cal_max?: number;
|
|
551
|
-
trustCalMinMax?: boolean;
|
|
552
|
-
percentileFrac?: number;
|
|
553
|
-
useQFormNotSForm?: boolean;
|
|
554
|
-
alphaThreshold?: boolean;
|
|
555
|
-
colormapNegative?: string;
|
|
556
|
-
cal_minNeg?: number;
|
|
557
|
-
cal_maxNeg?: number;
|
|
558
|
-
colorbarVisible?: boolean;
|
|
559
|
-
ignoreZeroVoxels?: boolean;
|
|
560
|
-
imageType?: ImageType;
|
|
561
|
-
frame4D?: number;
|
|
562
|
-
colormapLabel?: string[];
|
|
563
|
-
pairedImgData?: null;
|
|
564
|
-
limitFrames4D?: number;
|
|
565
|
-
isManifest?: boolean;
|
|
566
|
-
urlImgData?: string;
|
|
567
|
-
};
|
|
568
|
-
type ImageFromFileOptions = {
|
|
569
|
-
file: File | File[];
|
|
570
|
-
name?: string;
|
|
571
|
-
colormap?: string;
|
|
572
|
-
opacity?: number;
|
|
573
|
-
urlImgData?: File | null;
|
|
574
|
-
cal_min?: number;
|
|
575
|
-
cal_max?: number;
|
|
576
|
-
trustCalMinMax?: boolean;
|
|
577
|
-
percentileFrac?: number;
|
|
578
|
-
ignoreZeroVoxels?: boolean;
|
|
579
|
-
useQFormNotSForm?: boolean;
|
|
580
|
-
colormapNegative?: string;
|
|
581
|
-
imageType?: ImageType;
|
|
582
|
-
frame4D?: number;
|
|
583
|
-
limitFrames4D?: number;
|
|
584
|
-
};
|
|
585
|
-
type ImageFromBase64 = {
|
|
586
|
-
base64: string;
|
|
587
|
-
name?: string;
|
|
588
|
-
colormap?: string;
|
|
589
|
-
opacity?: number;
|
|
590
|
-
cal_min?: number;
|
|
591
|
-
cal_max?: number;
|
|
592
|
-
trustCalMinMax?: boolean;
|
|
593
|
-
percentileFrac?: number;
|
|
594
|
-
ignoreZeroVoxels?: boolean;
|
|
595
|
-
};
|
|
596
|
-
type ImageMetadata = {
|
|
597
|
-
id: string;
|
|
598
|
-
datatypeCode: number;
|
|
599
|
-
nx: number;
|
|
600
|
-
ny: number;
|
|
601
|
-
nz: number;
|
|
602
|
-
nt: number;
|
|
603
|
-
dx: number;
|
|
604
|
-
dy: number;
|
|
605
|
-
dz: number;
|
|
606
|
-
dt: number;
|
|
607
|
-
bpv: number;
|
|
608
|
-
};
|
|
609
|
-
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;
|
|
610
|
-
|
|
611
|
-
/**
|
|
612
|
-
* a NVImage encapsulates some images data and provides methods to query and operate on images
|
|
613
|
-
*/
|
|
614
|
-
declare class NVImage {
|
|
615
|
-
name: string;
|
|
616
|
-
id: string;
|
|
617
|
-
url?: string;
|
|
618
|
-
headers?: Record<string, string>;
|
|
619
|
-
_colormap: string;
|
|
620
|
-
_opacity: number;
|
|
621
|
-
percentileFrac: number;
|
|
622
|
-
ignoreZeroVoxels: boolean;
|
|
623
|
-
trustCalMinMax: boolean;
|
|
624
|
-
colormapNegative: string;
|
|
625
|
-
colormapLabel: LUT | null;
|
|
626
|
-
colormapInvert?: boolean;
|
|
627
|
-
nFrame4D?: number;
|
|
628
|
-
frame4D: number;
|
|
629
|
-
nTotalFrame4D?: number;
|
|
630
|
-
cal_minNeg: number;
|
|
631
|
-
cal_maxNeg: number;
|
|
632
|
-
colorbarVisible: boolean;
|
|
633
|
-
modulationImage: number | null;
|
|
634
|
-
modulateAlpha: number;
|
|
635
|
-
series: any;
|
|
636
|
-
nVox3D?: number;
|
|
637
|
-
oblique_angle?: number;
|
|
638
|
-
maxShearDeg?: number;
|
|
639
|
-
useQFormNotSForm: boolean;
|
|
640
|
-
alphaThreshold?: number;
|
|
641
|
-
pixDims?: number[];
|
|
642
|
-
matRAS?: mat4;
|
|
643
|
-
pixDimsRAS?: number[];
|
|
644
|
-
obliqueRAS?: mat4;
|
|
645
|
-
dimsRAS?: number[];
|
|
646
|
-
permRAS?: number[];
|
|
647
|
-
toRAS?: mat4;
|
|
648
|
-
toRASvox?: mat4;
|
|
649
|
-
frac2mm?: mat4;
|
|
650
|
-
frac2mmOrtho?: mat4;
|
|
651
|
-
extentsMinOrtho?: number[];
|
|
652
|
-
extentsMaxOrtho?: number[];
|
|
653
|
-
mm2ortho?: mat4;
|
|
654
|
-
hdr: nifti.NIFTI1 | nifti.NIFTI2 | null;
|
|
655
|
-
imageType?: ImageType;
|
|
656
|
-
img?: Uint8Array | Int16Array | Float32Array | Float64Array | Uint16Array;
|
|
657
|
-
imaginary?: Float32Array;
|
|
658
|
-
fileObject?: File | File[];
|
|
659
|
-
dims?: number[];
|
|
660
|
-
onColormapChange: (img: NVImage) => void;
|
|
661
|
-
onOpacityChange: (img: NVImage) => void;
|
|
662
|
-
mm000?: vec3;
|
|
663
|
-
mm100?: vec3;
|
|
664
|
-
mm010?: vec3;
|
|
665
|
-
mm001?: vec3;
|
|
666
|
-
cal_min?: number;
|
|
667
|
-
cal_max?: number;
|
|
668
|
-
robust_min?: number;
|
|
669
|
-
robust_max?: number;
|
|
670
|
-
global_min?: number;
|
|
671
|
-
global_max?: number;
|
|
672
|
-
urlImgData?: string;
|
|
673
|
-
isManifest?: boolean;
|
|
674
|
-
limitFrames4D?: number;
|
|
675
|
-
DT_NONE: number;
|
|
676
|
-
DT_UNKNOWN: number;
|
|
677
|
-
DT_BINARY: number;
|
|
678
|
-
DT_UNSIGNED_CHAR: number;
|
|
679
|
-
DT_SIGNED_SHORT: number;
|
|
680
|
-
DT_SIGNED_INT: number;
|
|
681
|
-
DT_FLOAT: number;
|
|
682
|
-
DT_COMPLEX: number;
|
|
683
|
-
DT_DOUBLE: number;
|
|
684
|
-
DT_RGB: number;
|
|
685
|
-
DT_ALL: number;
|
|
686
|
-
DT_INT8: number;
|
|
687
|
-
DT_UINT16: number;
|
|
688
|
-
DT_UINT32: number;
|
|
689
|
-
DT_INT64: number;
|
|
690
|
-
DT_UINT64: number;
|
|
691
|
-
DT_FLOAT128: number;
|
|
692
|
-
DT_COMPLEX128: number;
|
|
693
|
-
DT_COMPLEX256: number;
|
|
694
|
-
DT_RGBA32: number;
|
|
695
|
-
/**
|
|
696
|
-
*
|
|
697
|
-
* @param dataBuffer - an array buffer of image data to load (there are also methods that abstract this more. See loadFromUrl, and loadFromFile)
|
|
698
|
-
* @param name - a name for this image. Default is an empty string
|
|
699
|
-
* @param colormap - a color map to use. default is gray
|
|
700
|
-
* @param opacity - the opacity for this image. default is 1
|
|
701
|
-
* @param pairedImgData - Allows loading formats where header and image are separate files (e.g. nifti.hdr, nifti.img)
|
|
702
|
-
* @param cal_min - minimum intensity for color brightness/contrast
|
|
703
|
-
* @param cal_max - maximum intensity for color brightness/contrast
|
|
704
|
-
* @param trustCalMinMax - whether or not to trust cal_min and cal_max from the nifti header (trusting results in faster loading)
|
|
705
|
-
* @param percentileFrac - the percentile to use for setting the robust range of the display values (smart intensity setting for images with large ranges)
|
|
706
|
-
* @param ignoreZeroVoxels - whether or not to ignore zero voxels in setting the robust range of display values
|
|
707
|
-
* @param useQFormNotSForm - give precedence to QForm (Quaternion) or SForm (Matrix)
|
|
708
|
-
* @param colormapNegative - a color map to use for symmetrical negative intensities
|
|
709
|
-
* @param frame4D - volume displayed, 0 indexed, must be less than nFrame4D
|
|
710
|
-
*
|
|
711
|
-
* FIXME the following params are documented but not included in the actual constructor
|
|
712
|
-
* @param onColormapChange - callback for color map change
|
|
713
|
-
* @param onOpacityChange -callback for color map change
|
|
714
|
-
*
|
|
715
|
-
* TODO the following parameters were not documented
|
|
716
|
-
* @param imageType - TODO
|
|
717
|
-
* @param cal_minNeg - TODO
|
|
718
|
-
* @param cal_maxNeg - TODO
|
|
719
|
-
* @param colorbarVisible - TODO
|
|
720
|
-
* @param colormapLabel - TODO
|
|
721
|
-
*/
|
|
722
|
-
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);
|
|
723
|
-
computeObliqueAngle(mtx44: mat4): number;
|
|
724
|
-
calculateOblique(): void;
|
|
725
|
-
THD_daxes_to_NIFTI(xyzDelta: number[], xyzOrigin: number[], orientSpecific: number[]): void;
|
|
726
|
-
SetPixDimFromSForm(): void;
|
|
727
|
-
readDICOM(buf: ArrayBuffer | ArrayBuffer[]): ArrayBuffer;
|
|
728
|
-
readECAT(buffer: ArrayBuffer): ArrayBuffer;
|
|
729
|
-
readV16(buffer: ArrayBuffer): ArrayBuffer;
|
|
730
|
-
readVMR(buffer: ArrayBuffer): ArrayBuffer;
|
|
731
|
-
readMGH(buffer: ArrayBuffer): ArrayBuffer;
|
|
732
|
-
readHEAD(dataBuffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
|
|
733
|
-
readMHA(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
|
|
734
|
-
readMIF(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
|
|
735
|
-
readNRRD(dataBuffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
|
|
736
|
-
calculateRAS(): void;
|
|
737
|
-
img2RAS(): Float32Array | Uint8Array | Int16Array | Float64Array | Uint16Array;
|
|
738
|
-
vox2mm(XYZ: number[], mtx: mat4): vec3;
|
|
739
|
-
mm2vox(mm: number[], frac?: boolean): Float32Array | vec3;
|
|
740
|
-
arrayEquals(a: unknown[], b: unknown[]): boolean;
|
|
741
|
-
setColormap(cm: string): void;
|
|
742
|
-
setColormapLabel(cm: ColorMap): void;
|
|
743
|
-
setColormapLabelFromUrl(url: string): Promise<void>;
|
|
744
|
-
get colormap(): string;
|
|
745
|
-
get colorMap(): string;
|
|
746
|
-
set colormap(cm: string);
|
|
747
|
-
set colorMap(cm: string);
|
|
748
|
-
get opacity(): number;
|
|
749
|
-
set opacity(opacity: number);
|
|
750
|
-
calMinMax(): number[];
|
|
751
|
-
intensityRaw2Scaled(raw: number): number;
|
|
752
|
-
intensityScaled2Raw(scaled: number): number;
|
|
753
|
-
saveToUint8Array(fnm: string, drawing8?: Uint8Array | null): Uint8Array;
|
|
754
|
-
saveToDisk(fnm?: string, drawing8?: Uint8Array | null): Uint8Array;
|
|
755
|
-
static fetchDicomData(url: string, headers?: Record<string, string>): Promise<ArrayBuffer[]>;
|
|
756
|
-
static fetchPartial(url: string, bytesToLoad: number, headers?: Record<string, string>): Promise<Response>;
|
|
757
|
-
/**
|
|
758
|
-
* factory function to load and return a new NVImage instance from a given URL
|
|
759
|
-
* @returns NVImage instance
|
|
760
|
-
*/
|
|
761
|
-
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'>> & {
|
|
762
|
-
url?: string | Uint8Array | ArrayBuffer;
|
|
763
|
-
}): Promise<NVImage>;
|
|
764
|
-
static readFileAsync(file: File, bytesToLoad?: number): Promise<ArrayBuffer>;
|
|
427
|
+
getVolumeData(voxStart?: number[], voxEnd?: number[], dataType?: string): [TypedVoxelArray, number[]];
|
|
765
428
|
/**
|
|
766
|
-
*
|
|
429
|
+
* write a 3D slab of voxels from a volume
|
|
430
|
+
* @param voxStart - first row, column and slice (RAS order) for selection
|
|
431
|
+
* @param voxEnd - final row, column and slice (RAS order) for selection
|
|
432
|
+
* @param img - array of voxel values to insert (RAS order)
|
|
433
|
+
* @see {@link https://niivue.github.io/niivue/features/slab_selection.html | live demo usage}
|
|
767
434
|
*/
|
|
768
|
-
|
|
769
|
-
name, colormap, opacity, urlImgData, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels, useQFormNotSForm, colormapNegative, frame4D, limitFrames4D, imageType }: ImageFromFileOptions): Promise<NVImage>;
|
|
435
|
+
setVolumeData(voxStart?: number[], voxEnd?: number[], img?: TypedVoxelArray): void;
|
|
770
436
|
/**
|
|
771
437
|
* factory function to load and return a new NVImage instance from a base64 encoded string
|
|
772
438
|
*
|
|
@@ -845,7 +511,6 @@ type FreeSurferConnectome = {
|
|
|
845
511
|
declare class NVConnectome extends NVMesh {
|
|
846
512
|
gl: WebGL2RenderingContext;
|
|
847
513
|
nodesChanged: EventTarget;
|
|
848
|
-
legendLineThickness?: number;
|
|
849
514
|
constructor(gl: WebGL2RenderingContext, connectome: LegacyConnectome);
|
|
850
515
|
static convertLegacyConnectome(json: LegacyConnectome): Connectome;
|
|
851
516
|
static convertFreeSurferConnectome(json: FreeSurferConnectome, colormap?: string): Connectome;
|
|
@@ -868,6 +533,7 @@ declare class NVConnectome extends NVMesh {
|
|
|
868
533
|
|
|
869
534
|
/**
|
|
870
535
|
* Slice Type
|
|
536
|
+
* @ignore
|
|
871
537
|
*/
|
|
872
538
|
declare enum SLICE_TYPE {
|
|
873
539
|
AXIAL = 0,
|
|
@@ -878,6 +544,7 @@ declare enum SLICE_TYPE {
|
|
|
878
544
|
}
|
|
879
545
|
/**
|
|
880
546
|
* Multi-planar layout
|
|
547
|
+
* @ignore
|
|
881
548
|
*/
|
|
882
549
|
declare enum MULTIPLANAR_TYPE {
|
|
883
550
|
AUTO = 0,
|
|
@@ -885,6 +552,10 @@ declare enum MULTIPLANAR_TYPE {
|
|
|
885
552
|
GRID = 2,
|
|
886
553
|
ROW = 3
|
|
887
554
|
}
|
|
555
|
+
/**
|
|
556
|
+
* Drag mode
|
|
557
|
+
* @ignore
|
|
558
|
+
*/
|
|
888
559
|
declare enum DRAG_MODE {
|
|
889
560
|
none = 0,
|
|
890
561
|
contrast = 1,
|
|
@@ -893,10 +564,14 @@ declare enum DRAG_MODE {
|
|
|
893
564
|
slicer3D = 4,
|
|
894
565
|
callbackOnly = 5
|
|
895
566
|
}
|
|
567
|
+
/**
|
|
568
|
+
* NVConfigOptions
|
|
569
|
+
*/
|
|
896
570
|
type NVConfigOptions = {
|
|
897
571
|
textHeight: number;
|
|
898
572
|
colorbarHeight: number;
|
|
899
573
|
crosshairWidth: number;
|
|
574
|
+
crosshairGap: number;
|
|
900
575
|
rulerWidth: number;
|
|
901
576
|
show3Dcrosshair: boolean;
|
|
902
577
|
backColor: number[];
|
|
@@ -975,132 +650,513 @@ type Scene = {
|
|
|
975
650
|
_elevation?: number;
|
|
976
651
|
_azimuth?: number;
|
|
977
652
|
};
|
|
978
|
-
type DocumentData = {
|
|
979
|
-
title: string;
|
|
980
|
-
imageOptionsArray: ImageFromUrlOptions[];
|
|
981
|
-
meshOptionsArray: unknown[];
|
|
982
|
-
opts: NVConfigOptions;
|
|
983
|
-
previewImageDataURL: string;
|
|
984
|
-
labels: NVLabel3D[];
|
|
985
|
-
encodedImageBlobs: string[];
|
|
986
|
-
encodedDrawingBlob: string;
|
|
987
|
-
meshesString?: string;
|
|
988
|
-
sceneData?: SceneData;
|
|
989
|
-
connectomes?: string[];
|
|
653
|
+
type DocumentData = {
|
|
654
|
+
title: string;
|
|
655
|
+
imageOptionsArray: ImageFromUrlOptions[];
|
|
656
|
+
meshOptionsArray: unknown[];
|
|
657
|
+
opts: NVConfigOptions;
|
|
658
|
+
previewImageDataURL: string;
|
|
659
|
+
labels: NVLabel3D[];
|
|
660
|
+
encodedImageBlobs: string[];
|
|
661
|
+
encodedDrawingBlob: string;
|
|
662
|
+
meshesString?: string;
|
|
663
|
+
sceneData?: SceneData;
|
|
664
|
+
connectomes?: string[];
|
|
665
|
+
};
|
|
666
|
+
type ExportDocumentData = {
|
|
667
|
+
encodedImageBlobs: string[];
|
|
668
|
+
encodedDrawingBlob: string;
|
|
669
|
+
previewImageDataURL: string;
|
|
670
|
+
imageOptionsMap: Map<string, number>;
|
|
671
|
+
imageOptionsArray: ImageFromUrlOptions[];
|
|
672
|
+
sceneData: Partial<SceneData>;
|
|
673
|
+
opts: NVConfigOptions;
|
|
674
|
+
meshesString: string;
|
|
675
|
+
labels: NVLabel3D[];
|
|
676
|
+
connectomes: string[];
|
|
677
|
+
};
|
|
678
|
+
/**
|
|
679
|
+
* Creates and instance of NVDocument
|
|
680
|
+
* @ignore
|
|
681
|
+
*/
|
|
682
|
+
declare class NVDocument {
|
|
683
|
+
data: DocumentData;
|
|
684
|
+
scene: Scene;
|
|
685
|
+
volumes: NVImage[];
|
|
686
|
+
meshDataObjects?: Array<NVMesh | NVConnectome>;
|
|
687
|
+
meshes: Array<NVMesh | NVConnectome>;
|
|
688
|
+
drawBitmap: Uint8Array | null;
|
|
689
|
+
imageOptionsMap: Map<any, any>;
|
|
690
|
+
meshOptionsMap: Map<any, any>;
|
|
691
|
+
constructor();
|
|
692
|
+
/**
|
|
693
|
+
* Title of the document
|
|
694
|
+
*/
|
|
695
|
+
get title(): string;
|
|
696
|
+
/**
|
|
697
|
+
* Gets preview image blob
|
|
698
|
+
* @returns dataURL of preview image
|
|
699
|
+
*/
|
|
700
|
+
get previewImageDataURL(): string;
|
|
701
|
+
/**
|
|
702
|
+
* Sets preview image blob
|
|
703
|
+
* @param dataURL - encoded preview image
|
|
704
|
+
*/
|
|
705
|
+
set previewImageDataURL(dataURL: string);
|
|
706
|
+
/**
|
|
707
|
+
* @param title - title of document
|
|
708
|
+
*/
|
|
709
|
+
set title(title: string);
|
|
710
|
+
get imageOptionsArray(): ImageFromUrlOptions[];
|
|
711
|
+
/**
|
|
712
|
+
* Gets the base 64 encoded blobs of associated images
|
|
713
|
+
*/
|
|
714
|
+
get encodedImageBlobs(): string[];
|
|
715
|
+
/**
|
|
716
|
+
* Gets the base 64 encoded blob of the associated drawing
|
|
717
|
+
* TODO the return type was marked as string[] here, was that an error?
|
|
718
|
+
*/
|
|
719
|
+
get encodedDrawingBlob(): string;
|
|
720
|
+
/**
|
|
721
|
+
* Gets the options of the {@link Niivue} instance
|
|
722
|
+
*/
|
|
723
|
+
get opts(): NVConfigOptions;
|
|
724
|
+
/**
|
|
725
|
+
* Sets the options of the {@link Niivue} instance
|
|
726
|
+
*/
|
|
727
|
+
set opts(opts: NVConfigOptions);
|
|
728
|
+
/**
|
|
729
|
+
* Gets the 3D labels of the {@link Niivue} instance
|
|
730
|
+
*/
|
|
731
|
+
get labels(): NVLabel3D[];
|
|
732
|
+
/**
|
|
733
|
+
* Sets the 3D labels of the {@link Niivue} instance
|
|
734
|
+
*/
|
|
735
|
+
set labels(labels: NVLabel3D[]);
|
|
736
|
+
/**
|
|
737
|
+
* Checks if document has an image by id
|
|
738
|
+
*/
|
|
739
|
+
hasImage(image: NVImage): boolean;
|
|
740
|
+
/**
|
|
741
|
+
* Checks if document has an image by url
|
|
742
|
+
*/
|
|
743
|
+
hasImageFromUrl(url: string): boolean;
|
|
744
|
+
/**
|
|
745
|
+
* Adds an image and the options an image was created with
|
|
746
|
+
*/
|
|
747
|
+
addImageOptions(image: NVImage, imageOptions: ImageFromUrlOptions): void;
|
|
748
|
+
/**
|
|
749
|
+
* Removes image from the document as well as its options
|
|
750
|
+
*/
|
|
751
|
+
removeImage(image: NVImage): void;
|
|
752
|
+
/**
|
|
753
|
+
* Returns the options for the image if it was added by url
|
|
754
|
+
*/
|
|
755
|
+
getImageOptions(image: NVImage): ImageFromUrlOptions | null;
|
|
756
|
+
/**
|
|
757
|
+
* Converts NVDocument to JSON
|
|
758
|
+
*/
|
|
759
|
+
json(): ExportDocumentData;
|
|
760
|
+
/**
|
|
761
|
+
* Downloads a JSON file with options, scene, images, meshes and drawing of {@link Niivue} instance
|
|
762
|
+
*/
|
|
763
|
+
download(fileName: string): void;
|
|
764
|
+
/**
|
|
765
|
+
* Deserialize mesh data objects
|
|
766
|
+
*/
|
|
767
|
+
static deserializeMeshDataObjects(document: NVDocument): void;
|
|
768
|
+
/**
|
|
769
|
+
* Factory method to return an instance of NVDocument from a URL
|
|
770
|
+
*/
|
|
771
|
+
static loadFromUrl(url: string): Promise<NVDocument>;
|
|
772
|
+
/**
|
|
773
|
+
* Factory method to return an instance of NVDocument from a File object
|
|
774
|
+
*/
|
|
775
|
+
static loadFromFile(file: Blob): Promise<NVDocument>;
|
|
776
|
+
/**
|
|
777
|
+
* Factory method to return an instance of NVDocument from JSON
|
|
778
|
+
*/
|
|
779
|
+
static loadFromJSON(data: DocumentData): NVDocument;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
type NiftiHeader = {
|
|
783
|
+
littleEndian: boolean;
|
|
784
|
+
dim_info: number;
|
|
785
|
+
dims: number[];
|
|
786
|
+
pixDims: number[];
|
|
787
|
+
intent_p1: number;
|
|
788
|
+
intent_p2: number;
|
|
789
|
+
intent_p3: number;
|
|
790
|
+
intent_code: number;
|
|
791
|
+
datatypeCode: number;
|
|
792
|
+
numBitsPerVoxel: number;
|
|
793
|
+
slice_start: number;
|
|
794
|
+
vox_offset: number;
|
|
795
|
+
scl_slope: number;
|
|
796
|
+
scl_inter: number;
|
|
797
|
+
slice_end: number;
|
|
798
|
+
slice_code: number;
|
|
799
|
+
xyzt_units: number;
|
|
800
|
+
cal_max: number;
|
|
801
|
+
cal_min: number;
|
|
802
|
+
slice_duration: number;
|
|
803
|
+
toffset: number;
|
|
804
|
+
description: string;
|
|
805
|
+
aux_file: string;
|
|
806
|
+
qform_code: number;
|
|
807
|
+
sform_code: number;
|
|
808
|
+
quatern_b: number;
|
|
809
|
+
quatern_c: number;
|
|
810
|
+
quatern_d: number;
|
|
811
|
+
qoffset_x: number;
|
|
812
|
+
qoffset_y: number;
|
|
813
|
+
qoffset_z: number;
|
|
814
|
+
affine: number[][];
|
|
815
|
+
intent_name: string;
|
|
816
|
+
magic: string;
|
|
817
|
+
};
|
|
818
|
+
type Volume = Record<string, any>;
|
|
819
|
+
type Point = {
|
|
820
|
+
comments: Array<{
|
|
821
|
+
text: string;
|
|
822
|
+
prefilled?: string;
|
|
823
|
+
}>;
|
|
824
|
+
coordinates: {
|
|
825
|
+
x: number;
|
|
826
|
+
y: number;
|
|
827
|
+
z: number;
|
|
828
|
+
};
|
|
829
|
+
};
|
|
830
|
+
/**
|
|
831
|
+
* Representes the vertices of a connectome
|
|
832
|
+
* @ignore
|
|
833
|
+
*/
|
|
834
|
+
type NVConnectomeNode = {
|
|
835
|
+
name: string;
|
|
836
|
+
x: number;
|
|
837
|
+
y: number;
|
|
838
|
+
z: number;
|
|
839
|
+
colorValue: number;
|
|
840
|
+
sizeValue: number;
|
|
841
|
+
label?: NVLabel3D;
|
|
842
|
+
};
|
|
843
|
+
/**
|
|
844
|
+
* Represents edges between connectome nodes
|
|
845
|
+
* @ignore
|
|
846
|
+
*/
|
|
847
|
+
type NVConnectomeEdge = {
|
|
848
|
+
first: number;
|
|
849
|
+
second: number;
|
|
850
|
+
colorValue: number;
|
|
851
|
+
};
|
|
852
|
+
type ConnectomeOptions = {
|
|
853
|
+
name: string;
|
|
854
|
+
nodeColormap: string;
|
|
855
|
+
nodeColormapNegative: string;
|
|
856
|
+
nodeMinColor: number;
|
|
857
|
+
nodeMaxColor: number;
|
|
858
|
+
nodeScale: number;
|
|
859
|
+
edgeColormap: string;
|
|
860
|
+
edgeColormapNegative: string;
|
|
861
|
+
edgeMin: number;
|
|
862
|
+
edgeMax: number;
|
|
863
|
+
edgeScale: number;
|
|
864
|
+
legendLineThickness?: number;
|
|
865
|
+
};
|
|
866
|
+
type Connectome = ConnectomeOptions & {
|
|
867
|
+
nodes: NVConnectomeNode[];
|
|
868
|
+
edges: NVConnectomeEdge[];
|
|
869
|
+
};
|
|
870
|
+
type LegacyNodes = {
|
|
871
|
+
names: string[];
|
|
872
|
+
prefilled: unknown[];
|
|
873
|
+
X: number[];
|
|
874
|
+
Y: number[];
|
|
875
|
+
Z: number[];
|
|
876
|
+
Color: number[];
|
|
877
|
+
Size: number[];
|
|
878
|
+
};
|
|
879
|
+
type LegacyConnectome = Partial<ConnectomeOptions> & {
|
|
880
|
+
nodes: LegacyNodes;
|
|
881
|
+
edges: number[];
|
|
882
|
+
};
|
|
883
|
+
type DragReleaseParams = {
|
|
884
|
+
fracStart: vec3;
|
|
885
|
+
fracEnd: vec3;
|
|
886
|
+
voxStart: vec3;
|
|
887
|
+
voxEnd: vec3;
|
|
888
|
+
mmStart: vec4;
|
|
889
|
+
mmEnd: vec4;
|
|
890
|
+
mmLength: number;
|
|
891
|
+
tileIdx: number;
|
|
892
|
+
axCorSag: SLICE_TYPE;
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
type ValuesArray = Array<{
|
|
896
|
+
id: string;
|
|
897
|
+
vals: Float32Array;
|
|
898
|
+
global_min?: number;
|
|
899
|
+
global_max?: number;
|
|
900
|
+
cal_min?: number;
|
|
901
|
+
cal_max?: number;
|
|
902
|
+
}>;
|
|
903
|
+
type TypedNumberArray = Float64Array | Float32Array | Uint32Array | Uint16Array | Uint8Array | Int32Array | Int16Array | Int8Array;
|
|
904
|
+
type AnyNumberArray = number[] | TypedNumberArray;
|
|
905
|
+
type DefaultMeshType = {
|
|
906
|
+
positions: Float32Array;
|
|
907
|
+
indices: Uint32Array;
|
|
908
|
+
colors?: Float32Array;
|
|
909
|
+
};
|
|
910
|
+
type TRACT = {
|
|
911
|
+
pts: Float32Array;
|
|
912
|
+
offsetPt0: Uint32Array;
|
|
913
|
+
dps: ValuesArray;
|
|
914
|
+
};
|
|
915
|
+
type TT = {
|
|
916
|
+
pts: Float32Array;
|
|
917
|
+
offsetPt0: Uint32Array;
|
|
918
|
+
};
|
|
919
|
+
type TRX = {
|
|
920
|
+
pts: Float32Array;
|
|
921
|
+
offsetPt0: Uint32Array;
|
|
922
|
+
dpg: ValuesArray;
|
|
923
|
+
dps: ValuesArray;
|
|
924
|
+
dpv: ValuesArray;
|
|
925
|
+
header: unknown;
|
|
926
|
+
};
|
|
927
|
+
type TRK = {
|
|
928
|
+
pts: Float32Array;
|
|
929
|
+
offsetPt0: Uint32Array;
|
|
930
|
+
dps: ValuesArray;
|
|
931
|
+
dpv: ValuesArray;
|
|
932
|
+
};
|
|
933
|
+
type TCK = {
|
|
934
|
+
pts: Float32Array;
|
|
935
|
+
offsetPt0: Uint32Array;
|
|
936
|
+
};
|
|
937
|
+
type VTK = DefaultMeshType | {
|
|
938
|
+
pts: Float32Array;
|
|
939
|
+
offsetPt0: Uint32Array;
|
|
940
|
+
};
|
|
941
|
+
type ANNOT = Uint32Array | {
|
|
942
|
+
scalars: Float32Array;
|
|
943
|
+
colormapLabel: LUT;
|
|
944
|
+
};
|
|
945
|
+
type MZ3 = Float32Array | {
|
|
946
|
+
positions: Float32Array | null;
|
|
947
|
+
indices: Uint32Array | null;
|
|
948
|
+
scalars: Float32Array;
|
|
949
|
+
colors: Float32Array | null;
|
|
950
|
+
};
|
|
951
|
+
type GII = {
|
|
952
|
+
scalars: Float32Array;
|
|
953
|
+
positions?: Float32Array;
|
|
954
|
+
indices?: Uint32Array;
|
|
955
|
+
colormapLabel?: LUT;
|
|
956
|
+
anatomicalStructurePrimary: string;
|
|
957
|
+
};
|
|
958
|
+
type MGH = AnyNumberArray | {
|
|
959
|
+
scalars: AnyNumberArray;
|
|
960
|
+
colormapLabel: LUT;
|
|
961
|
+
};
|
|
962
|
+
type X3D = {
|
|
963
|
+
positions: Float32Array;
|
|
964
|
+
indices: Uint32Array;
|
|
965
|
+
rgba255: Uint8Array;
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
/** Enum for text alignment
|
|
969
|
+
*/
|
|
970
|
+
declare enum MeshType {
|
|
971
|
+
MESH = "mesh",
|
|
972
|
+
CONNECTOME = "connectome",
|
|
973
|
+
FIBER = "fiber"
|
|
974
|
+
}
|
|
975
|
+
type NVMeshLayer = {
|
|
976
|
+
name?: string;
|
|
977
|
+
key?: string;
|
|
978
|
+
url?: string;
|
|
979
|
+
headers?: Record<string, string>;
|
|
980
|
+
opacity: number;
|
|
981
|
+
colormap: string;
|
|
982
|
+
colormapNegative: string;
|
|
983
|
+
colormapInvert: boolean;
|
|
984
|
+
colormapLabel?: ColorMap | LUT;
|
|
985
|
+
useNegativeCmap: boolean;
|
|
986
|
+
global_min: number;
|
|
987
|
+
global_max: number;
|
|
988
|
+
cal_min: number;
|
|
989
|
+
cal_max: number;
|
|
990
|
+
cal_minNeg: number;
|
|
991
|
+
cal_maxNeg: number;
|
|
992
|
+
isAdditiveBlend: boolean;
|
|
993
|
+
frame4D: number;
|
|
994
|
+
nFrame4D: number;
|
|
995
|
+
values: number[];
|
|
996
|
+
outlineBorder?: number;
|
|
997
|
+
isTransparentBelowCalMin?: boolean;
|
|
998
|
+
alphaThreshold: boolean;
|
|
999
|
+
base64?: string;
|
|
1000
|
+
colorbarVisible?: boolean;
|
|
1001
|
+
};
|
|
1002
|
+
declare class NVMeshFromUrlOptions {
|
|
1003
|
+
url: string;
|
|
1004
|
+
gl: WebGL2RenderingContext | null;
|
|
1005
|
+
name: string;
|
|
1006
|
+
opacity: number;
|
|
1007
|
+
rgba255: Uint8Array;
|
|
1008
|
+
visible: boolean;
|
|
1009
|
+
layers: NVMeshLayer[];
|
|
1010
|
+
colorbarVisible: boolean;
|
|
1011
|
+
constructor(url?: string, gl?: null, name?: string, opacity?: number, rgba255?: Uint8Array, visible?: boolean, layers?: never[], colorbarVisible?: boolean);
|
|
1012
|
+
}
|
|
1013
|
+
type BaseLoadParams = {
|
|
1014
|
+
gl: WebGL2RenderingContext;
|
|
1015
|
+
name: string;
|
|
1016
|
+
opacity: number;
|
|
1017
|
+
rgba255: number[] | Uint8Array;
|
|
1018
|
+
visible: boolean;
|
|
1019
|
+
layers: NVMeshLayer[];
|
|
1020
|
+
};
|
|
1021
|
+
type LoadFromUrlParams = Partial<BaseLoadParams> & {
|
|
1022
|
+
url: string;
|
|
1023
|
+
headers?: Record<string, string>;
|
|
1024
|
+
};
|
|
1025
|
+
type LoadFromFileParams = BaseLoadParams & {
|
|
1026
|
+
file: Blob;
|
|
990
1027
|
};
|
|
991
|
-
type
|
|
992
|
-
|
|
993
|
-
encodedDrawingBlob: string;
|
|
994
|
-
previewImageDataURL: string;
|
|
995
|
-
imageOptionsMap: Map<string, number>;
|
|
996
|
-
imageOptionsArray: ImageFromUrlOptions[];
|
|
997
|
-
sceneData: Partial<SceneData>;
|
|
998
|
-
opts: NVConfigOptions;
|
|
999
|
-
meshesString: string;
|
|
1000
|
-
labels: NVLabel3D[];
|
|
1001
|
-
connectomes: string[];
|
|
1028
|
+
type LoadFromBase64Params = BaseLoadParams & {
|
|
1029
|
+
base64: string;
|
|
1002
1030
|
};
|
|
1003
1031
|
/**
|
|
1004
|
-
*
|
|
1032
|
+
* a NVMesh encapsulates some mesh data and provides methods to query and operate on meshes
|
|
1005
1033
|
*/
|
|
1006
|
-
declare class
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
* Checks if document has an image by id
|
|
1062
|
-
*/
|
|
1063
|
-
hasImage(image: NVImage): boolean;
|
|
1064
|
-
/**
|
|
1065
|
-
* Checks if document has an image by url
|
|
1066
|
-
*/
|
|
1067
|
-
hasImageFromUrl(url: string): boolean;
|
|
1068
|
-
/**
|
|
1069
|
-
* Adds an image and the options an image was created with
|
|
1070
|
-
*/
|
|
1071
|
-
addImageOptions(image: NVImage, imageOptions: ImageFromUrlOptions): void;
|
|
1072
|
-
/**
|
|
1073
|
-
* Removes image from the document as well as its options
|
|
1074
|
-
*/
|
|
1075
|
-
removeImage(image: NVImage): void;
|
|
1076
|
-
/**
|
|
1077
|
-
* Returns the options for the image if it was added by url
|
|
1078
|
-
*/
|
|
1079
|
-
getImageOptions(image: NVImage): ImageFromUrlOptions | null;
|
|
1080
|
-
/**
|
|
1081
|
-
* Converts NVDocument to JSON
|
|
1082
|
-
*/
|
|
1083
|
-
json(): ExportDocumentData;
|
|
1084
|
-
/**
|
|
1085
|
-
* Downloads a JSON file with options, scene, images, meshes and drawing of {@link Niivue} instance
|
|
1086
|
-
*/
|
|
1087
|
-
download(fileName: string): void;
|
|
1034
|
+
declare class NVMesh {
|
|
1035
|
+
id: string;
|
|
1036
|
+
name: string;
|
|
1037
|
+
anatomicalStructurePrimary: string;
|
|
1038
|
+
colorbarVisible: boolean;
|
|
1039
|
+
furthestVertexFromOrigin: number;
|
|
1040
|
+
extentsMin: number | number[];
|
|
1041
|
+
extentsMax: number | number[];
|
|
1042
|
+
opacity: number;
|
|
1043
|
+
visible: boolean;
|
|
1044
|
+
meshShaderIndex: number;
|
|
1045
|
+
offsetPt0: Uint32Array | null;
|
|
1046
|
+
colormapInvert: boolean;
|
|
1047
|
+
fiberGroupColormap: ColorMap | null;
|
|
1048
|
+
indexBuffer: WebGLBuffer;
|
|
1049
|
+
vertexBuffer: WebGLBuffer;
|
|
1050
|
+
vao: WebGLVertexArrayObject;
|
|
1051
|
+
vaoFiber: WebGLVertexArrayObject;
|
|
1052
|
+
pts: Float32Array;
|
|
1053
|
+
tris?: Uint32Array;
|
|
1054
|
+
layers: NVMeshLayer[];
|
|
1055
|
+
type: MeshType;
|
|
1056
|
+
data_type?: string;
|
|
1057
|
+
rgba255: Uint8Array;
|
|
1058
|
+
fiberLength?: number;
|
|
1059
|
+
fiberLengths?: Uint32Array;
|
|
1060
|
+
fiberDither: number;
|
|
1061
|
+
fiberColor: string;
|
|
1062
|
+
fiberDecimationStride: number;
|
|
1063
|
+
fiberSides: number;
|
|
1064
|
+
fiberRadius: number;
|
|
1065
|
+
f32PerVertex: number;
|
|
1066
|
+
fiberMask?: unknown[];
|
|
1067
|
+
colormap?: ColorMap | LegacyConnectome | string | null;
|
|
1068
|
+
dpg?: ValuesArray | null;
|
|
1069
|
+
dps?: ValuesArray | null;
|
|
1070
|
+
dpv?: ValuesArray | null;
|
|
1071
|
+
hasConnectome: boolean;
|
|
1072
|
+
connectome?: LegacyConnectome | string;
|
|
1073
|
+
indexCount?: number;
|
|
1074
|
+
vertexCount: number;
|
|
1075
|
+
nodeScale: number;
|
|
1076
|
+
edgeScale: number;
|
|
1077
|
+
legendLineThickness: number;
|
|
1078
|
+
nodeColormap: string;
|
|
1079
|
+
edgeColormap: string;
|
|
1080
|
+
nodeColormapNegative?: string;
|
|
1081
|
+
edgeColormapNegative?: string;
|
|
1082
|
+
nodeMinColor?: number;
|
|
1083
|
+
nodeMaxColor?: number;
|
|
1084
|
+
edgeMin?: number;
|
|
1085
|
+
edgeMax?: number;
|
|
1086
|
+
nodes?: LegacyNodes | NVConnectomeNode[];
|
|
1087
|
+
edges?: number[] | NVConnectomeEdge[];
|
|
1088
|
+
points?: Point[];
|
|
1088
1089
|
/**
|
|
1089
|
-
*
|
|
1090
|
+
* @param pts - a 3xN array of vertex positions (X,Y,Z coordinates).
|
|
1091
|
+
* @param tris - a 3xN array of triangle indices (I,J,K; indexed from zero). Each triangle generated from three vertices.
|
|
1092
|
+
* @param name - a name for this image. Default is an empty string
|
|
1093
|
+
* @param rgba255 - the base color of the mesh. RGBA values from 0 to 255. Default is white
|
|
1094
|
+
* @param opacity - the opacity for this mesh. default is 1
|
|
1095
|
+
* @param visible - whether or not this image is to be visible
|
|
1096
|
+
* @param gl - WebGL rendering context
|
|
1097
|
+
* @param connectome - specify connectome edges and nodes. Default is null (not a connectome).
|
|
1098
|
+
* @param dpg - Data per group for tractography, see TRK format. Default is null (not tractograpgy)
|
|
1099
|
+
* @param dps - Data per streamline for tractography, see TRK format. Default is null (not tractograpgy)
|
|
1100
|
+
* @param dpv - Data per vertex for tractography, see TRK format. Default is null (not tractograpgy)
|
|
1101
|
+
* @param colorbarVisible - does this mesh display a colorbar
|
|
1102
|
+
* @param anatomicalStructurePrimary - region for mesh. Default is an empty string
|
|
1090
1103
|
*/
|
|
1091
|
-
|
|
1104
|
+
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);
|
|
1105
|
+
initValuesArray(va: ValuesArray): ValuesArray;
|
|
1106
|
+
linesToCylinders(gl: WebGL2RenderingContext, posClrF32: Float32Array, indices: number[]): void;
|
|
1107
|
+
updateFibers(gl: WebGL2RenderingContext): void;
|
|
1108
|
+
indexNearestXYZmm(Xmm: number, Ymm: number, Zmm: number): number[];
|
|
1109
|
+
updateMesh(gl: WebGL2RenderingContext): void;
|
|
1110
|
+
reverseFaces(gl: WebGL2RenderingContext): void;
|
|
1111
|
+
setLayerProperty(id: number, key: keyof NVMeshLayer, val: number | string | boolean, gl: WebGL2RenderingContext): void;
|
|
1112
|
+
setProperty(key: keyof this, val: unknown, gl: WebGL2RenderingContext): void;
|
|
1113
|
+
generatePosNormClr(pts: Float32Array, tris: Uint32Array, rgba255: Uint8Array): Float32Array;
|
|
1114
|
+
static readMesh(buffer: ArrayBuffer, name: string, gl: WebGL2RenderingContext, opacity?: number, rgba255?: Uint8Array, visible?: boolean): NVMesh;
|
|
1115
|
+
static loadLayer(layer: NVMeshLayer, nvmesh: NVMesh): Promise<void>;
|
|
1092
1116
|
/**
|
|
1093
|
-
*
|
|
1117
|
+
* factory function to load and return a new NVMesh instance from a given URL
|
|
1094
1118
|
*/
|
|
1095
|
-
static loadFromUrl(url
|
|
1119
|
+
static loadFromUrl({ url, headers, gl, name, opacity, rgba255, visible, layers }?: Partial<LoadFromUrlParams>): Promise<NVMesh>;
|
|
1120
|
+
static readFileAsync(file: Blob): Promise<ArrayBuffer>;
|
|
1096
1121
|
/**
|
|
1097
|
-
*
|
|
1122
|
+
* factory function to load and return a new NVMesh instance from a file in the browser
|
|
1123
|
+
*
|
|
1124
|
+
* @returns NVMesh instance
|
|
1098
1125
|
*/
|
|
1099
|
-
static loadFromFile(file
|
|
1126
|
+
static loadFromFile({ file, gl, name, opacity, rgba255, visible, layers }?: Partial<LoadFromFileParams>): Promise<NVMesh>;
|
|
1100
1127
|
/**
|
|
1101
|
-
*
|
|
1128
|
+
* load and return a new NVMesh instance from a base64 encoded string
|
|
1102
1129
|
*/
|
|
1103
|
-
|
|
1130
|
+
loadFromBase64({ base64, gl, name, opacity, rgba255, visible, layers }?: Partial<LoadFromBase64Params>): Promise<NVMesh>;
|
|
1131
|
+
static readGII(buffer: ArrayBuffer): GII;
|
|
1132
|
+
static readX3D(buffer: ArrayBuffer): X3D;
|
|
1133
|
+
static readNII(buffer: ArrayBuffer, n_vert?: number): Uint8Array | Float32Array | Int32Array | Int16Array;
|
|
1134
|
+
static readNII2(buffer: ArrayBuffer, n_vert?: number): Uint8Array | Float32Array | Int32Array | Int16Array;
|
|
1135
|
+
static readMGH(buffer: ArrayBuffer): MGH;
|
|
1136
|
+
static readSTL(buffer: ArrayBuffer): DefaultMeshType;
|
|
1137
|
+
static readTxtSTL(buffer: ArrayBuffer): DefaultMeshType;
|
|
1138
|
+
static readSRF(buffer: ArrayBuffer): DefaultMeshType;
|
|
1139
|
+
static readFreeSurfer(buffer: ArrayBuffer): DefaultMeshType;
|
|
1140
|
+
static readOBJ(buffer: ArrayBuffer): DefaultMeshType;
|
|
1141
|
+
static readOFF(buffer: ArrayBuffer): DefaultMeshType;
|
|
1142
|
+
static readGEO(buffer: ArrayBuffer, isFlipWinding?: boolean): DefaultMeshType;
|
|
1143
|
+
static readICO(buffer: ArrayBuffer): DefaultMeshType;
|
|
1144
|
+
static readPLY(buffer: ArrayBuffer): DefaultMeshType;
|
|
1145
|
+
static readMZ3(buffer: ArrayBuffer, n_vert?: number): MZ3;
|
|
1146
|
+
static readVTK(buffer: ArrayBuffer): VTK;
|
|
1147
|
+
static readASC(buffer: ArrayBuffer): DefaultMeshType;
|
|
1148
|
+
static readNV(buffer: ArrayBuffer): DefaultMeshType;
|
|
1149
|
+
static readANNOT(buffer: ArrayBuffer, n_vert: number, isReadColortables?: boolean): ANNOT;
|
|
1150
|
+
static readCURV(buffer: ArrayBuffer, n_vert: number): Float32Array;
|
|
1151
|
+
static readSTC(buffer: ArrayBuffer, n_vert: number): Float32Array;
|
|
1152
|
+
static readSMP(buffer: ArrayBuffer, n_vert: number): Float32Array;
|
|
1153
|
+
static readTxtVTK(buffer: ArrayBuffer): VTK;
|
|
1154
|
+
static readTRK(buffer: ArrayBuffer): TRK;
|
|
1155
|
+
static readTCK(buffer: ArrayBuffer): TCK;
|
|
1156
|
+
static readTSF(buffer: ArrayBuffer): Float32Array;
|
|
1157
|
+
static readTT(buffer: ArrayBuffer): TT;
|
|
1158
|
+
static readTRX(buffer: ArrayBuffer): TRX;
|
|
1159
|
+
static readTRACT(buffer: ArrayBuffer): TRACT;
|
|
1104
1160
|
}
|
|
1105
1161
|
|
|
1106
1162
|
/**
|
|
@@ -1222,6 +1278,7 @@ declare class SessionBus {
|
|
|
1222
1278
|
|
|
1223
1279
|
/**
|
|
1224
1280
|
* NVController is for synchronizing both remote and local instances of Niivue
|
|
1281
|
+
* @ignore
|
|
1225
1282
|
*/
|
|
1226
1283
|
declare class NVController {
|
|
1227
1284
|
niivue: Niivue;
|
|
@@ -1311,6 +1368,7 @@ declare class NVController {
|
|
|
1311
1368
|
|
|
1312
1369
|
/**
|
|
1313
1370
|
* Namespace for utility functions
|
|
1371
|
+
* @ignore
|
|
1314
1372
|
*/
|
|
1315
1373
|
declare class NVUtilities {
|
|
1316
1374
|
static arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
|
|
@@ -1344,6 +1402,7 @@ declare class NVUtilities {
|
|
|
1344
1402
|
|
|
1345
1403
|
/**
|
|
1346
1404
|
* Class to load different mesh formats
|
|
1405
|
+
* @ignore
|
|
1347
1406
|
*/
|
|
1348
1407
|
declare class NVMeshLoaders {
|
|
1349
1408
|
static readTRACT(buffer: ArrayBuffer): TRACT;
|
|
@@ -1380,17 +1439,6 @@ declare class NVMeshLoaders {
|
|
|
1380
1439
|
static readGII(buffer: ArrayBuffer, n_vert?: number): GII;
|
|
1381
1440
|
}
|
|
1382
1441
|
|
|
1383
|
-
type DragReleaseParams = {
|
|
1384
|
-
fracStart: vec3;
|
|
1385
|
-
fracEnd: vec3;
|
|
1386
|
-
voxStart: vec3;
|
|
1387
|
-
voxEnd: vec3;
|
|
1388
|
-
mmStart: vec4;
|
|
1389
|
-
mmEnd: vec4;
|
|
1390
|
-
mmLength: number;
|
|
1391
|
-
tileIdx: number;
|
|
1392
|
-
axCorSag: SLICE_TYPE;
|
|
1393
|
-
};
|
|
1394
1442
|
type ColormapListEntry = {
|
|
1395
1443
|
name: string;
|
|
1396
1444
|
min: number;
|
|
@@ -1453,55 +1501,6 @@ type MM = {
|
|
|
1453
1501
|
rotation: mat4;
|
|
1454
1502
|
fovMM: vec3;
|
|
1455
1503
|
};
|
|
1456
|
-
/**
|
|
1457
|
-
* Niivue exposes many properties. It's always good to call `updateGLVolume` after altering one of these settings.
|
|
1458
|
-
*/
|
|
1459
|
-
type NiiVueOptions = {
|
|
1460
|
-
textHeight?: number;
|
|
1461
|
-
colorbarHeight?: number;
|
|
1462
|
-
colorbarMargin?: number;
|
|
1463
|
-
crosshairWidth?: number;
|
|
1464
|
-
rulerWidth?: number;
|
|
1465
|
-
backColor?: number[];
|
|
1466
|
-
crosshairColor?: number[];
|
|
1467
|
-
fontColor?: number[];
|
|
1468
|
-
selectionBoxColor?: number[];
|
|
1469
|
-
clipPlaneColor?: number[];
|
|
1470
|
-
rulerColor?: number[];
|
|
1471
|
-
show3Dcrosshair?: boolean;
|
|
1472
|
-
trustCalMinMax?: boolean;
|
|
1473
|
-
clipPlaneHotKey?: string;
|
|
1474
|
-
viewModeHotKey?: string;
|
|
1475
|
-
keyDebounceTime?: number;
|
|
1476
|
-
doubleTouchTimeout?: number;
|
|
1477
|
-
longTouchTimeout?: number;
|
|
1478
|
-
isRadiologicalConvention?: boolean;
|
|
1479
|
-
logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'fatal' | 'silent';
|
|
1480
|
-
loadingText?: string;
|
|
1481
|
-
dragAndDropEnabled?: boolean;
|
|
1482
|
-
isNearestInterpolation?: boolean;
|
|
1483
|
-
atlasOutline?: number;
|
|
1484
|
-
isRuler?: boolean;
|
|
1485
|
-
isColorbar?: boolean;
|
|
1486
|
-
isOrientCube?: boolean;
|
|
1487
|
-
multiplanarPadPixels?: number;
|
|
1488
|
-
multiplanarForceRender?: boolean;
|
|
1489
|
-
meshThicknessOn2D?: number;
|
|
1490
|
-
dragMode?: DRAG_MODE;
|
|
1491
|
-
isDepthPickMesh?: boolean;
|
|
1492
|
-
isCornerOrientationText?: boolean;
|
|
1493
|
-
sagittalNoseLeft?: boolean;
|
|
1494
|
-
isSliceMM?: boolean;
|
|
1495
|
-
isV1SliceShader?: boolean;
|
|
1496
|
-
isHighResolutionCapable?: boolean;
|
|
1497
|
-
isForceMouseClickToVoxelCenters?: boolean;
|
|
1498
|
-
drawingEnabled?: boolean;
|
|
1499
|
-
penValue?: number;
|
|
1500
|
-
floodFillNeighbors?: number;
|
|
1501
|
-
maxDrawUndoBitmaps?: number;
|
|
1502
|
-
thumbnail?: string;
|
|
1503
|
-
meshXRay?: number;
|
|
1504
|
-
};
|
|
1505
1504
|
type UIData = {
|
|
1506
1505
|
mousedown: boolean;
|
|
1507
1506
|
touchdown: boolean;
|
|
@@ -1525,7 +1524,6 @@ type UIData = {
|
|
|
1525
1524
|
dragClipPlaneStartDepthAziElev: number[];
|
|
1526
1525
|
lastTwoTouchDistance: number;
|
|
1527
1526
|
multiTouchGesture: boolean;
|
|
1528
|
-
loading$: Subject<unknown>;
|
|
1529
1527
|
dpr?: number;
|
|
1530
1528
|
};
|
|
1531
1529
|
type SaveImageOptions = {
|
|
@@ -1538,7 +1536,7 @@ type SaveImageOptions = {
|
|
|
1538
1536
|
* loading and rendering NIFTI image data in a WebGL 2.0 context.
|
|
1539
1537
|
*
|
|
1540
1538
|
* @example
|
|
1541
|
-
* let niivue = new Niivue(
|
|
1539
|
+
* let niivue = new Niivue({crosshairColor: [0,1,0,0.5], textHeight: 0.5}) // a see-through green crosshair, and larger text labels
|
|
1542
1540
|
*/
|
|
1543
1541
|
declare class Niivue {
|
|
1544
1542
|
canvas: HTMLCanvasElement | null;
|
|
@@ -1614,7 +1612,6 @@ declare class Niivue {
|
|
|
1614
1612
|
syncOpts: Record<string, unknown>;
|
|
1615
1613
|
readyForSync: boolean;
|
|
1616
1614
|
uiData: UIData;
|
|
1617
|
-
eventsToSubjects: Record<string, Subject<unknown>>;
|
|
1618
1615
|
back: NVImage | null;
|
|
1619
1616
|
overlays: NVImage[];
|
|
1620
1617
|
deferredVolumes: ImageFromUrlOptions[];
|
|
@@ -1666,128 +1663,128 @@ declare class Niivue {
|
|
|
1666
1663
|
/**
|
|
1667
1664
|
* callback function to run when the right mouse button is released after dragging
|
|
1668
1665
|
* @example
|
|
1669
|
-
* niivue.onDragRelease = ()
|
|
1666
|
+
* niivue.onDragRelease = () => {
|
|
1670
1667
|
* console.log('drag ended')
|
|
1671
|
-
*
|
|
1668
|
+
* }
|
|
1672
1669
|
*/
|
|
1673
1670
|
onDragRelease: (params: DragReleaseParams) => void;
|
|
1674
1671
|
/**
|
|
1675
1672
|
* callback function to run when the left mouse button is released
|
|
1676
1673
|
* @example
|
|
1677
|
-
* niivue.onMouseUp = ()
|
|
1674
|
+
* niivue.onMouseUp = () => {
|
|
1678
1675
|
* console.log('mouse up')
|
|
1679
|
-
*
|
|
1676
|
+
* }
|
|
1680
1677
|
*/
|
|
1681
1678
|
onMouseUp: (data: Partial<UIData>) => void;
|
|
1682
1679
|
/**
|
|
1683
1680
|
* callback function to run when the crosshair location changes
|
|
1684
1681
|
* @example
|
|
1685
|
-
* niivue.onLocationChange = (data)
|
|
1682
|
+
* niivue.onLocationChange = (data) => {
|
|
1686
1683
|
* console.log('location changed')
|
|
1687
1684
|
* console.log('mm: ', data.mm)
|
|
1688
1685
|
* console.log('vox: ', data.vox)
|
|
1689
1686
|
* console.log('frac: ', data.frac)
|
|
1690
1687
|
* console.log('values: ', data.values)
|
|
1691
|
-
*
|
|
1688
|
+
* }
|
|
1692
1689
|
*/
|
|
1693
1690
|
onLocationChange: (location: unknown) => void;
|
|
1694
1691
|
/**
|
|
1695
1692
|
* callback function to run when the user changes the intensity range with the selection box action (right click)
|
|
1696
1693
|
* @example
|
|
1697
|
-
* niivue.onIntensityChange = (volume)
|
|
1694
|
+
* niivue.onIntensityChange = (volume) => {
|
|
1698
1695
|
* console.log('intensity changed')
|
|
1699
1696
|
* console.log('volume: ', volume)
|
|
1700
|
-
*
|
|
1697
|
+
* }
|
|
1701
1698
|
*/
|
|
1702
1699
|
onIntensityChange: (volume: NVImage) => void;
|
|
1703
1700
|
/**
|
|
1704
1701
|
* callback function to run when a new volume is loaded
|
|
1705
1702
|
* @example
|
|
1706
|
-
* niivue.onImageLoaded = (volume)
|
|
1703
|
+
* niivue.onImageLoaded = (volume) => {
|
|
1707
1704
|
* console.log('volume loaded')
|
|
1708
1705
|
* console.log('volume: ', volume)
|
|
1709
|
-
*
|
|
1706
|
+
* }
|
|
1710
1707
|
*/
|
|
1711
1708
|
onImageLoaded: (volume: NVImage) => void;
|
|
1712
1709
|
/**
|
|
1713
1710
|
* callback function to run when a new mesh is loaded
|
|
1714
1711
|
* @example
|
|
1715
|
-
* niivue.onMeshLoaded = (mesh)
|
|
1712
|
+
* niivue.onMeshLoaded = (mesh) => {
|
|
1716
1713
|
* console.log('mesh loaded')
|
|
1717
1714
|
* console.log('mesh: ', mesh)
|
|
1718
|
-
*
|
|
1715
|
+
* }
|
|
1719
1716
|
*/
|
|
1720
1717
|
onMeshLoaded: (mesh: NVMesh) => void;
|
|
1721
1718
|
/**
|
|
1722
1719
|
* callback function to run when the user changes the volume when a 4D image is loaded
|
|
1723
1720
|
* @example
|
|
1724
|
-
* niivue.onFrameChange = (volume, frameNumber)
|
|
1721
|
+
* niivue.onFrameChange = (volume, frameNumber) => {
|
|
1725
1722
|
* console.log('frame changed')
|
|
1726
1723
|
* console.log('volume: ', volume)
|
|
1727
1724
|
* console.log('frameNumber: ', frameNumber)
|
|
1728
|
-
*
|
|
1725
|
+
* }
|
|
1729
1726
|
*/
|
|
1730
1727
|
onFrameChange: (volume: NVImage, index: number) => void;
|
|
1731
1728
|
/**
|
|
1732
1729
|
* callback function to run when niivue reports an error
|
|
1733
1730
|
* @example
|
|
1734
|
-
* niivue.onError = (error)
|
|
1731
|
+
* niivue.onError = (error) => {
|
|
1735
1732
|
* console.log('error: ', error)
|
|
1736
|
-
*
|
|
1733
|
+
* }
|
|
1737
1734
|
*/
|
|
1738
1735
|
onError: () => void;
|
|
1739
1736
|
onColormapChange: () => void;
|
|
1740
1737
|
/**
|
|
1741
1738
|
* callback function to run when niivue reports detailed info
|
|
1742
1739
|
* @example
|
|
1743
|
-
* niivue.onInfo = (info)
|
|
1740
|
+
* niivue.onInfo = (info) => {
|
|
1744
1741
|
* console.log('info: ', info)
|
|
1745
|
-
*
|
|
1742
|
+
* }
|
|
1746
1743
|
*/
|
|
1747
1744
|
onInfo: () => void;
|
|
1748
1745
|
/**
|
|
1749
1746
|
* callback function to run when niivue reports a warning
|
|
1750
1747
|
* @example
|
|
1751
|
-
* niivue.onWarn = (warn)
|
|
1748
|
+
* niivue.onWarn = (warn) => {
|
|
1752
1749
|
* console.log('warn: ', warn)
|
|
1753
|
-
*
|
|
1750
|
+
* }
|
|
1754
1751
|
*/
|
|
1755
1752
|
onWarn: () => void;
|
|
1756
1753
|
/**
|
|
1757
1754
|
* callback function to run when niivue reports a debug message
|
|
1758
1755
|
* @example
|
|
1759
|
-
* niivue.onDebug = (debug)
|
|
1756
|
+
* niivue.onDebug = (debug) => {
|
|
1760
1757
|
* console.log('debug: ', debug)
|
|
1761
|
-
*
|
|
1758
|
+
* }
|
|
1762
1759
|
*/
|
|
1763
1760
|
onDebug: () => void;
|
|
1764
1761
|
/**
|
|
1765
1762
|
* callback function to run when a volume is added from a url
|
|
1766
1763
|
* @example
|
|
1767
|
-
* niivue.onVolumeAddedFromUrl = (imageOptions, volume)
|
|
1764
|
+
* niivue.onVolumeAddedFromUrl = (imageOptions, volume) => {
|
|
1768
1765
|
* console.log('volume added from url')
|
|
1769
1766
|
* console.log('imageOptions: ', imageOptions)
|
|
1770
1767
|
* console.log('volume: ', volume)
|
|
1771
|
-
*
|
|
1768
|
+
* }
|
|
1772
1769
|
*/
|
|
1773
1770
|
onVolumeAddedFromUrl: (imageOptions: ImageFromUrlOptions, volume: NVImage) => void;
|
|
1774
1771
|
onVolumeWithUrlRemoved: (url: string) => void;
|
|
1775
1772
|
/**
|
|
1776
1773
|
* callback function to run when updateGLVolume is called (most users will not need to use
|
|
1777
1774
|
* @example
|
|
1778
|
-
* niivue.onVolumeUpdated = ()
|
|
1775
|
+
* niivue.onVolumeUpdated = () => {
|
|
1779
1776
|
* console.log('volume updated')
|
|
1780
|
-
*
|
|
1777
|
+
* }
|
|
1781
1778
|
*/
|
|
1782
1779
|
onVolumeUpdated: () => void;
|
|
1783
1780
|
/**
|
|
1784
1781
|
* callback function to run when a mesh is added from a url
|
|
1785
1782
|
* @example
|
|
1786
|
-
* niivue.onMeshAddedFromUrl = (meshOptions, mesh)
|
|
1783
|
+
* niivue.onMeshAddedFromUrl = (meshOptions, mesh) => {
|
|
1787
1784
|
* console.log('mesh added from url')
|
|
1788
1785
|
* console.log('meshOptions: ', meshOptions)
|
|
1789
1786
|
* console.log('mesh: ', mesh)
|
|
1790
|
-
*
|
|
1787
|
+
* }
|
|
1791
1788
|
*/
|
|
1792
1789
|
onMeshAddedFromUrl: (meshOptions: LoadFromUrlParams, mesh: NVMesh) => void;
|
|
1793
1790
|
onMeshAdded: () => void;
|
|
@@ -1796,18 +1793,18 @@ declare class Niivue {
|
|
|
1796
1793
|
/**
|
|
1797
1794
|
* callback function to run when the user changes the rotation of the 3D rendering
|
|
1798
1795
|
* @example
|
|
1799
|
-
* niivue.onAzimuthElevationChange = (azimuth, elevation)
|
|
1796
|
+
* niivue.onAzimuthElevationChange = (azimuth, elevation) => {
|
|
1800
1797
|
* console.log('azimuth: ', azimuth)
|
|
1801
1798
|
* console.log('elevation: ', elevation)
|
|
1802
|
-
*
|
|
1799
|
+
* }
|
|
1803
1800
|
*/
|
|
1804
1801
|
onAzimuthElevationChange: (azimuth: number, elevation: number) => void;
|
|
1805
1802
|
/**
|
|
1806
1803
|
* callback function to run when the user changes the clip plane
|
|
1807
1804
|
* @example
|
|
1808
|
-
* niivue.onClipPlaneChange = (clipPlane)
|
|
1805
|
+
* niivue.onClipPlaneChange = (clipPlane) => {
|
|
1809
1806
|
* console.log('clipPlane: ', clipPlane)
|
|
1810
|
-
*
|
|
1807
|
+
* }
|
|
1811
1808
|
*/
|
|
1812
1809
|
onClipPlaneChange: (clipPlane: number[]) => void;
|
|
1813
1810
|
onCustomMeshShaderAdded: (fragmentShaderText: string, name: string) => void;
|
|
@@ -1816,9 +1813,9 @@ declare class Niivue {
|
|
|
1816
1813
|
/**
|
|
1817
1814
|
* callback function to run when the user loads a new NiiVue document
|
|
1818
1815
|
* @example
|
|
1819
|
-
* niivue.onDocumentLoaded = (document)
|
|
1816
|
+
* niivue.onDocumentLoaded = (document) => {
|
|
1820
1817
|
* console.log('document: ', document)
|
|
1821
|
-
*
|
|
1818
|
+
* }
|
|
1822
1819
|
*/
|
|
1823
1820
|
onDocumentLoaded: (document: NVDocument) => void;
|
|
1824
1821
|
document: NVDocument;
|
|
@@ -1826,6 +1823,7 @@ declare class Niivue {
|
|
|
1826
1823
|
textHeight: number;
|
|
1827
1824
|
colorbarHeight: number;
|
|
1828
1825
|
crosshairWidth: number;
|
|
1826
|
+
crosshairGap: number;
|
|
1829
1827
|
rulerWidth: number;
|
|
1830
1828
|
show3Dcrosshair: boolean;
|
|
1831
1829
|
backColor: number[];
|
|
@@ -1906,11 +1904,10 @@ declare class Niivue {
|
|
|
1906
1904
|
initialized: boolean;
|
|
1907
1905
|
currentDrawUndoBitmap: number;
|
|
1908
1906
|
loadingText: string;
|
|
1909
|
-
subscriptions: Array<Record<string, Subscription>>;
|
|
1910
1907
|
/**
|
|
1911
|
-
* @param options
|
|
1908
|
+
* @param options - options object to set modifiable Niivue properties
|
|
1912
1909
|
*/
|
|
1913
|
-
constructor(options?: Partial<
|
|
1910
|
+
constructor(options?: Partial<NVConfigOptions>);
|
|
1914
1911
|
get volumes(): NVImage[];
|
|
1915
1912
|
set volumes(volumes: NVImage[]);
|
|
1916
1913
|
get meshes(): NVMesh[];
|
|
@@ -1923,7 +1920,7 @@ declare class Niivue {
|
|
|
1923
1920
|
* save webgl2 canvas as png format bitmap
|
|
1924
1921
|
* @param filename - filename for screen capture
|
|
1925
1922
|
* @example niivue.saveScene('test.png');
|
|
1926
|
-
* @see {@link https://niivue.github.io/niivue/features/ui.html|live demo usage}
|
|
1923
|
+
* @see {@link https://niivue.github.io/niivue/features/ui.html | live demo usage}
|
|
1927
1924
|
*/
|
|
1928
1925
|
saveScene(filename?: string): Promise<void>;
|
|
1929
1926
|
/**
|
|
@@ -1932,31 +1929,9 @@ declare class Niivue {
|
|
|
1932
1929
|
* @param isAntiAlias - determines if anti-aliasing is requested (if not specified, AA usage depends on hardware)
|
|
1933
1930
|
* @example niivue = new Niivue().attachTo('gl')
|
|
1934
1931
|
* @example niivue.attachTo('gl')
|
|
1935
|
-
* @see {@link https://niivue.github.io/niivue/features/multiplanar.html|live demo usage}
|
|
1932
|
+
* @see {@link https://niivue.github.io/niivue/features/basic.multiplanar.html | live demo usage}
|
|
1936
1933
|
*/
|
|
1937
1934
|
attachTo(id: string, isAntiAlias?: null): Promise<this>;
|
|
1938
|
-
/**
|
|
1939
|
-
* register a callback function to run when known Niivue events happen
|
|
1940
|
-
* @param event - the name of the event to watch for. Event names are shown in the type column
|
|
1941
|
-
* @param callback - the function to call when the event happens
|
|
1942
|
-
* @example
|
|
1943
|
-
* niivue = new Niivue()
|
|
1944
|
-
*
|
|
1945
|
-
* // 'location' update event is fired when the crosshair changes position via user input
|
|
1946
|
-
* function doSomethingWithLocationData(data)\{
|
|
1947
|
-
* // data has the shape \{mm: [N, N, N], vox: [N, N, N], frac: [N, N, N], values: this.volumes.map(v =\> \{return val\})\}
|
|
1948
|
-
* //...
|
|
1949
|
-
* \}
|
|
1950
|
-
*/
|
|
1951
|
-
on(event: string, callback: (data: unknown) => void): void;
|
|
1952
|
-
/**
|
|
1953
|
-
* off unsubscribes events and subjects (the opposite of on)
|
|
1954
|
-
* @param event - the name of the event to watch for. Event names are shown in the type column
|
|
1955
|
-
* @example
|
|
1956
|
-
* niivue = new Niivue()
|
|
1957
|
-
* niivue.off('location')
|
|
1958
|
-
*/
|
|
1959
|
-
off(event: string): void;
|
|
1960
1935
|
/**
|
|
1961
1936
|
* attach the Niivue instance to a canvas element directly
|
|
1962
1937
|
* @param canvas - the canvas element reference
|
|
@@ -1973,7 +1948,7 @@ declare class Niivue {
|
|
|
1973
1948
|
* niivue2 = new Niivue()
|
|
1974
1949
|
* niivue2.syncWith(niivue1)
|
|
1975
1950
|
* @deprecated use broadcastTo instead
|
|
1976
|
-
* @see {@link https://niivue.github.io/niivue/features/sync.mesh.html|live demo usage}
|
|
1951
|
+
* @see {@link https://niivue.github.io/niivue/features/sync.mesh.html | live demo usage}
|
|
1977
1952
|
*/
|
|
1978
1953
|
syncWith(otherNV: Niivue, syncOpts?: {
|
|
1979
1954
|
'2d': boolean;
|
|
@@ -1988,7 +1963,7 @@ declare class Niivue {
|
|
|
1988
1963
|
* niivue3 = new Niivue()
|
|
1989
1964
|
* niivue1.broadcastTo(niivue2)
|
|
1990
1965
|
* niivue1.broadcastTo([niivue2, niivue3])
|
|
1991
|
-
* @see {@link https://niivue.github.io/niivue/features/sync.mesh.html|live demo usage}
|
|
1966
|
+
* @see {@link https://niivue.github.io/niivue/features/sync.mesh.html | live demo usage}
|
|
1992
1967
|
*/
|
|
1993
1968
|
broadcastTo(otherNV: Niivue | Niivue[], syncOpts?: {
|
|
1994
1969
|
'2d': boolean;
|
|
@@ -2065,7 +2040,7 @@ declare class Niivue {
|
|
|
2065
2040
|
getFileExt(fullname: string, upperCase?: boolean): string;
|
|
2066
2041
|
/**
|
|
2067
2042
|
* Add an image and notify subscribers
|
|
2068
|
-
* @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
|
|
2043
|
+
* @see {@link https://niivue.github.io/niivue/features/document.3d.html | live demo usage}
|
|
2069
2044
|
*/
|
|
2070
2045
|
addVolumeFromUrl(imageOptions: ImageFromUrlOptions): Promise<NVImage>;
|
|
2071
2046
|
/**
|
|
@@ -2075,7 +2050,7 @@ declare class Niivue {
|
|
|
2075
2050
|
/**
|
|
2076
2051
|
* Remove volume by url
|
|
2077
2052
|
* @param url - Volume added by url to remove
|
|
2078
|
-
* @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
|
|
2053
|
+
* @see {@link https://niivue.github.io/niivue/features/document.3d.html | live demo usage}
|
|
2079
2054
|
*/
|
|
2080
2055
|
removeVolumeByUrl(url: string): void;
|
|
2081
2056
|
readDirectory(directory: FileSystemDirectoryEntry): FileSystemEntry[];
|
|
@@ -2089,28 +2064,28 @@ declare class Niivue {
|
|
|
2089
2064
|
* insert a gap between slices of a mutliplanar view.
|
|
2090
2065
|
* @param pixels - spacing between tiles of multiplanar view
|
|
2091
2066
|
* @example niivue.setMultiplanarPadPixels(4)
|
|
2092
|
-
* @see {@link https://niivue.github.io/niivue/features/atlas.html|live demo usage}
|
|
2067
|
+
* @see {@link https://niivue.github.io/niivue/features/atlas.html | live demo usage}
|
|
2093
2068
|
*/
|
|
2094
2069
|
setMultiplanarPadPixels(pixels: number): void;
|
|
2095
2070
|
/**
|
|
2096
2071
|
* control placement of 2D slices.
|
|
2097
2072
|
* @param layout - AUTO: 0, COLUMN: 1, GRID: 2, ROW: 3,
|
|
2098
2073
|
* @example niivue.setMultiplanarLayout(2)
|
|
2099
|
-
* @see {@link https://niivue.github.io/niivue/features/layout.html|live demo usage}
|
|
2074
|
+
* @see {@link https://niivue.github.io/niivue/features/layout.html | live demo usage}
|
|
2100
2075
|
*/
|
|
2101
2076
|
setMultiplanarLayout(layout: number): void;
|
|
2102
2077
|
/**
|
|
2103
2078
|
* determine if text appears at corner (true) or sides of 2D slice.
|
|
2104
2079
|
* @param isCornerOrientationText - controls position of text
|
|
2105
2080
|
* @example niivue.setCornerOrientationText(true)
|
|
2106
|
-
* @see {@link https://niivue.github.io/niivue/features/worldspace2.html|live demo usage}
|
|
2081
|
+
* @see {@link https://niivue.github.io/niivue/features/worldspace2.html | live demo usage}
|
|
2107
2082
|
*/
|
|
2108
2083
|
setCornerOrientationText(isCornerOrientationText: boolean): void;
|
|
2109
2084
|
/**
|
|
2110
2085
|
* control whether 2D slices use radiological or neurological convention.
|
|
2111
2086
|
* @param isRadiologicalConvention - new display convention
|
|
2112
|
-
* @example niivue.
|
|
2113
|
-
* @see {@link https://niivue.github.io/niivue/features/worldspace.html|live demo usage}
|
|
2087
|
+
* @example niivue.setRadiologicalConvention(true)
|
|
2088
|
+
* @see {@link https://niivue.github.io/niivue/features/worldspace.html | live demo usage}
|
|
2114
2089
|
*/
|
|
2115
2090
|
setRadiologicalConvention(isRadiologicalConvention: boolean): void;
|
|
2116
2091
|
/**
|
|
@@ -2118,35 +2093,35 @@ declare class Niivue {
|
|
|
2118
2093
|
* @param options - @see NiiVueOptions
|
|
2119
2094
|
* @param resetBriCon - also reset contrast (default false).
|
|
2120
2095
|
* @example niivue.nv1.setDefaults(opts, true);
|
|
2121
|
-
* @see {@link https://niivue.github.io/niivue/features/connectome.html|live demo usage}
|
|
2096
|
+
* @see {@link https://niivue.github.io/niivue/features/connectome.html | live demo usage}
|
|
2122
2097
|
*/
|
|
2123
|
-
setDefaults(options?: Partial<
|
|
2098
|
+
setDefaults(options?: Partial<NVConfigOptions>, resetBriCon?: boolean): void;
|
|
2124
2099
|
/**
|
|
2125
2100
|
* Limit visibility of mesh in front of a 2D image. Requires world-space mode.
|
|
2126
2101
|
* @param meshThicknessOn2D - distance from voxels for clipping mesh. Use Infinity to show entire mesh or 0.0 to hide mesh.
|
|
2127
2102
|
* @example niivue.setMeshThicknessOn2D(42)
|
|
2128
|
-
* @see {@link https://niivue.github.io/niivue/features/worldspace2.html|live demo usage}
|
|
2103
|
+
* @see {@link https://niivue.github.io/niivue/features/worldspace2.html | live demo usage}
|
|
2129
2104
|
*/
|
|
2130
2105
|
setMeshThicknessOn2D(meshThicknessOn2D: number): void;
|
|
2131
2106
|
/**
|
|
2132
2107
|
* Create a custom multi-slice mosaic (aka lightbox, montage) view.
|
|
2133
2108
|
* @param str - description of mosaic.
|
|
2134
2109
|
* @example niivue.setSliceMosaicString("A 0 20 C 30 S 42")
|
|
2135
|
-
* @see {@link https://niivue.github.io/niivue/features/mosaics.html|live demo usage}
|
|
2110
|
+
* @see {@link https://niivue.github.io/niivue/features/mosaics.html | live demo usage}
|
|
2136
2111
|
*/
|
|
2137
2112
|
setSliceMosaicString(str: string): void;
|
|
2138
2113
|
/**
|
|
2139
2114
|
* control 2D slice view mode.
|
|
2140
2115
|
* @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.
|
|
2141
2116
|
* @example niivue.setSliceMM(true)
|
|
2142
|
-
* @see {@link https://niivue.github.io/niivue/features/worldspace2.html|live demo usage}
|
|
2117
|
+
* @see {@link https://niivue.github.io/niivue/features/worldspace2.html | live demo usage}
|
|
2143
2118
|
*/
|
|
2144
2119
|
setSliceMM(isSliceMM: boolean): void;
|
|
2145
2120
|
/**
|
|
2146
2121
|
* control whether voxel overlays are combined using additive (emission) or traditional (transmission) blending.
|
|
2147
2122
|
* @param isAdditiveBlend - emission (true) or transmission (false) mixing
|
|
2148
2123
|
* @example niivue.isAdditiveBlend(true)
|
|
2149
|
-
* @see {@link https://niivue.github.io/niivue/features/additive.voxels.html|live demo usage}
|
|
2124
|
+
* @see {@link https://niivue.github.io/niivue/features/additive.voxels.html | live demo usage}
|
|
2150
2125
|
*/
|
|
2151
2126
|
setAdditiveBlend(isAdditiveBlend: boolean): void;
|
|
2152
2127
|
/**
|
|
@@ -2159,7 +2134,7 @@ declare class Niivue {
|
|
|
2159
2134
|
* Force WebGL canvas to use high resolution display, regardless of browser defaults.
|
|
2160
2135
|
* @param isHighResolutionCapable - allow high-DPI display
|
|
2161
2136
|
* @example niivue.setHighResolutionCapable(true);
|
|
2162
|
-
* @see {@link https://niivue.github.io/niivue/features/sync.mesh.html|live demo usage}
|
|
2137
|
+
* @see {@link https://niivue.github.io/niivue/features/sync.mesh.html | live demo usage}
|
|
2163
2138
|
*/
|
|
2164
2139
|
setHighResolutionCapable(isHighResolutionCapable: boolean): void;
|
|
2165
2140
|
/**
|
|
@@ -2167,8 +2142,8 @@ declare class Niivue {
|
|
|
2167
2142
|
* @param volume - the new volume to add to the canvas
|
|
2168
2143
|
* @example
|
|
2169
2144
|
* niivue = new Niivue()
|
|
2170
|
-
* niivue.addVolume(NVImage.loadFromUrl(
|
|
2171
|
-
* @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
|
|
2145
|
+
* niivue.addVolume(NVImage.loadFromUrl({url:'../someURL.nii.gz'}))
|
|
2146
|
+
* @see {@link https://niivue.github.io/niivue/features/document.3d.html | live demo usage}
|
|
2172
2147
|
*/
|
|
2173
2148
|
addVolume(volume: NVImage): void;
|
|
2174
2149
|
/**
|
|
@@ -2176,8 +2151,8 @@ declare class Niivue {
|
|
|
2176
2151
|
* @param mesh - the new mesh to add to the canvas
|
|
2177
2152
|
* @example
|
|
2178
2153
|
* niivue = new Niivue()
|
|
2179
|
-
* niivue.addMesh(NVMesh.loadFromUrl(
|
|
2180
|
-
* @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
|
|
2154
|
+
* niivue.addMesh(NVMesh.loadFromUrl({url:'../someURL.gii'}))
|
|
2155
|
+
* @see {@link https://niivue.github.io/niivue/features/document.3d.html | live demo usage}
|
|
2181
2156
|
*/
|
|
2182
2157
|
addMesh(mesh: NVMesh): void;
|
|
2183
2158
|
/**
|
|
@@ -2193,7 +2168,7 @@ declare class Niivue {
|
|
|
2193
2168
|
/**
|
|
2194
2169
|
* Restore drawing to previous state
|
|
2195
2170
|
* @example niivue.drawUndo();
|
|
2196
|
-
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
|
|
2171
|
+
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html | live demo usage}
|
|
2197
2172
|
*/
|
|
2198
2173
|
drawUndo(): void;
|
|
2199
2174
|
loadDrawing(drawingBitmap: NVImage): boolean;
|
|
@@ -2203,7 +2178,7 @@ declare class Niivue {
|
|
|
2203
2178
|
* @param filename - of NIfTI format drawing
|
|
2204
2179
|
* @param isBinarize - if true will force drawing voxels to be either 0 or 1.
|
|
2205
2180
|
* @example niivue.loadDrawingFromUrl("../images/lesion.nii.gz");
|
|
2206
|
-
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
|
|
2181
|
+
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html | live demo usage}
|
|
2207
2182
|
*/
|
|
2208
2183
|
loadDrawingFromUrl(fnm: string, isBinarize?: boolean): Promise<boolean>;
|
|
2209
2184
|
findOtsu(mlevel?: number): number[];
|
|
@@ -2211,7 +2186,7 @@ declare class Niivue {
|
|
|
2211
2186
|
* remove dark voxels in air
|
|
2212
2187
|
* @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.
|
|
2213
2188
|
* @example niivue.drawOtsu(3);
|
|
2214
|
-
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
|
|
2189
|
+
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html | live demo usage}
|
|
2215
2190
|
*/
|
|
2216
2191
|
drawOtsu(levels?: number): void;
|
|
2217
2192
|
/**
|
|
@@ -2219,7 +2194,7 @@ declare class Niivue {
|
|
|
2219
2194
|
* @param level - (1-5) larger values for more preserved voxels
|
|
2220
2195
|
* @param volIndex - volume to dehaze
|
|
2221
2196
|
* @example niivue.removeHaze(3, 0);
|
|
2222
|
-
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
|
|
2197
|
+
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html | live demo usage}
|
|
2223
2198
|
*/
|
|
2224
2199
|
removeHaze(level?: number, volIndex?: number): void;
|
|
2225
2200
|
/**
|
|
@@ -2228,8 +2203,8 @@ declare class Niivue {
|
|
|
2228
2203
|
* @param isSaveDrawing - determines whether drawing or background image is saved
|
|
2229
2204
|
* @param volumeByIndex - determines layer to save (0 for background)
|
|
2230
2205
|
* @param volumeByIndex - determines layer to save (0 for background)
|
|
2231
|
-
* @example niivue.saveImage(
|
|
2232
|
-
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
|
|
2206
|
+
* @example niivue.saveImage({ filename: "myimage.nii.gz", isSaveDrawing: true });
|
|
2207
|
+
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html | live demo usage}
|
|
2233
2208
|
*/
|
|
2234
2209
|
saveImage(options?: SaveImageOptions): Uint8Array | boolean;
|
|
2235
2210
|
getMeshIndexByID(id: string | number): number;
|
|
@@ -2239,7 +2214,7 @@ declare class Niivue {
|
|
|
2239
2214
|
* @param key - attribute to change
|
|
2240
2215
|
* @param value - for attribute
|
|
2241
2216
|
* @example niivue.setMeshProperty(niivue.meshes[0].id, 'fiberLength', 42)
|
|
2242
|
-
* @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
|
|
2217
|
+
* @see {@link https://niivue.github.io/niivue/features/meshes.html | live demo usage}
|
|
2243
2218
|
*/
|
|
2244
2219
|
setMeshProperty(id: number, key: keyof NVMesh, val: number): void;
|
|
2245
2220
|
/**
|
|
@@ -2257,7 +2232,7 @@ declare class Niivue {
|
|
|
2257
2232
|
* reverse triangle winding of mesh (swap front and back faces)
|
|
2258
2233
|
* @param id - identity of mesh to change
|
|
2259
2234
|
* @example niivue.reverseFaces(niivue.meshes[0].id)
|
|
2260
|
-
* @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
|
|
2235
|
+
* @see {@link https://niivue.github.io/niivue/features/meshes.html | live demo usage}
|
|
2261
2236
|
*/
|
|
2262
2237
|
reverseFaces(mesh: number): void;
|
|
2263
2238
|
/**
|
|
@@ -2267,7 +2242,7 @@ declare class Niivue {
|
|
|
2267
2242
|
* @param key - attribute to change
|
|
2268
2243
|
* @param value - for attribute
|
|
2269
2244
|
* @example niivue.setMeshLayerProperty(niivue.meshes[0].id, 0, 'frame4D', 22)
|
|
2270
|
-
* @see {@link https://niivue.github.io/niivue/features/mesh.4D.html|live demo usage}
|
|
2245
|
+
* @see {@link https://niivue.github.io/niivue/features/mesh.4D.html | live demo usage}
|
|
2271
2246
|
*/
|
|
2272
2247
|
setMeshLayerProperty(mesh: number, layer: number, key: keyof NVMeshLayer, val: number): void;
|
|
2273
2248
|
/**
|
|
@@ -2279,7 +2254,7 @@ declare class Niivue {
|
|
|
2279
2254
|
/**
|
|
2280
2255
|
* set rotation of 3D render view
|
|
2281
2256
|
* @example niivue.setRenderAzimuthElevation(45, 15)
|
|
2282
|
-
* @see {@link https://niivue.github.io/niivue/features/mask.html|live demo usage}
|
|
2257
|
+
* @see {@link https://niivue.github.io/niivue/features/mask.html | live demo usage}
|
|
2283
2258
|
*/
|
|
2284
2259
|
setRenderAzimuthElevation(a: number, e: number): void;
|
|
2285
2260
|
/**
|
|
@@ -2307,7 +2282,7 @@ declare class Niivue {
|
|
|
2307
2282
|
* @example
|
|
2308
2283
|
* niivue = new Niivue()
|
|
2309
2284
|
* niivue.removeVolume(this.volumes[3])
|
|
2310
|
-
* @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
|
|
2285
|
+
* @see {@link https://niivue.github.io/niivue/features/document.3d.html | live demo usage}
|
|
2311
2286
|
*/
|
|
2312
2287
|
removeVolume(volume: NVImage): void;
|
|
2313
2288
|
/**
|
|
@@ -2321,7 +2296,7 @@ declare class Niivue {
|
|
|
2321
2296
|
* @example
|
|
2322
2297
|
* niivue = new Niivue()
|
|
2323
2298
|
* niivue.removeMesh(this.meshes[3])
|
|
2324
|
-
* @see {@link https://niivue.github.io/niivue/features/multiuser.meshes.html|live demo usage}
|
|
2299
|
+
* @see {@link https://niivue.github.io/niivue/features/multiuser.meshes.html | live demo usage}
|
|
2325
2300
|
*/
|
|
2326
2301
|
removeMesh(mesh: NVMesh): void;
|
|
2327
2302
|
/**
|
|
@@ -2381,7 +2356,7 @@ declare class Niivue {
|
|
|
2381
2356
|
* @example
|
|
2382
2357
|
* niivue = new Niivue()
|
|
2383
2358
|
* niivue.setClipPlane([42, 42])
|
|
2384
|
-
* @see {@link https://niivue.github.io/niivue/features/mask.html|live demo usage}
|
|
2359
|
+
* @see {@link https://niivue.github.io/niivue/features/mask.html | live demo usage}
|
|
2385
2360
|
*/
|
|
2386
2361
|
setClipPlane(depthAzimuthElevation: number[]): void;
|
|
2387
2362
|
/**
|
|
@@ -2390,13 +2365,13 @@ declare class Niivue {
|
|
|
2390
2365
|
* @example
|
|
2391
2366
|
* niivue = new Niivue()
|
|
2392
2367
|
* niivue.setCrosshairColor([0, 1, 0, 0.5]) // set crosshair to transparent green
|
|
2393
|
-
* @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
|
|
2368
|
+
* @see {@link https://niivue.github.io/niivue/features/colormaps.html | live demo usage}
|
|
2394
2369
|
*/
|
|
2395
2370
|
setCrosshairColor(color: number[]): void;
|
|
2396
2371
|
/**
|
|
2397
2372
|
* set thickness of crosshair
|
|
2398
2373
|
* @example niivue.crosshairWidth(2)
|
|
2399
|
-
* @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
|
|
2374
|
+
* @see {@link https://niivue.github.io/niivue/features/colormaps.html | live demo usage}
|
|
2400
2375
|
*/
|
|
2401
2376
|
setCrosshairWidth(crosshairWidth: number): void;
|
|
2402
2377
|
setDrawColormap(name: string): void;
|
|
@@ -2404,7 +2379,7 @@ declare class Niivue {
|
|
|
2404
2379
|
* does dragging over a 2D slice create a drawing?
|
|
2405
2380
|
* @param trueOrFalse - enabled (true) or not (false)
|
|
2406
2381
|
* @example niivue.setDrawingEnabled(true)
|
|
2407
|
-
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
|
|
2382
|
+
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html | live demo usage}
|
|
2408
2383
|
*/
|
|
2409
2384
|
setDrawingEnabled(trueOrFalse: boolean): void;
|
|
2410
2385
|
/**
|
|
@@ -2412,14 +2387,14 @@ declare class Niivue {
|
|
|
2412
2387
|
* @param penValue - sets the color of the pen
|
|
2413
2388
|
* @param isFilledPen - determines if dragging creates flood-filled shape
|
|
2414
2389
|
* @example niivue.setPenValue(1, true)
|
|
2415
|
-
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
|
|
2390
|
+
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html | live demo usage}
|
|
2416
2391
|
*/
|
|
2417
2392
|
setPenValue(penValue: number, isFilledPen?: boolean): void;
|
|
2418
2393
|
/**
|
|
2419
2394
|
* control whether drawing is transparent (0), opaque (1) or translucent (between 0 and 1).
|
|
2420
2395
|
* @param opacity - translucency of drawing
|
|
2421
2396
|
* @example niivue.setDrawOpacity(0.7)
|
|
2422
|
-
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
|
|
2397
|
+
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html | live demo usage}
|
|
2423
2398
|
*/
|
|
2424
2399
|
setDrawOpacity(opacity: number): void;
|
|
2425
2400
|
/**
|
|
@@ -2428,7 +2403,7 @@ declare class Niivue {
|
|
|
2428
2403
|
* @example
|
|
2429
2404
|
* niivue = new Niivue()
|
|
2430
2405
|
* niivue.setSelectionBoxColor([0, 1, 0, 0.5]) // set to transparent green
|
|
2431
|
-
* @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
|
|
2406
|
+
* @see {@link https://niivue.github.io/niivue/features/colormaps.html | live demo usage}
|
|
2432
2407
|
*/
|
|
2433
2408
|
setSelectionBoxColor(color: number[]): void;
|
|
2434
2409
|
sliceScroll2D(posChange: number, x: number, y: number, isDelta?: boolean): void;
|
|
@@ -2438,7 +2413,7 @@ declare class Niivue {
|
|
|
2438
2413
|
* @example
|
|
2439
2414
|
* niivue = new Niivue()
|
|
2440
2415
|
* niivue.setSliceType(Niivue.sliceTypeMultiplanar)
|
|
2441
|
-
* @see {@link https://niivue.github.io/niivue/features/basic.multiplanar.html|live demo usage}
|
|
2416
|
+
* @see {@link https://niivue.github.io/niivue/features/basic.multiplanar.html | live demo usage}
|
|
2442
2417
|
*/
|
|
2443
2418
|
setSliceType(st: SLICE_TYPE): this;
|
|
2444
2419
|
/**
|
|
@@ -2448,7 +2423,7 @@ declare class Niivue {
|
|
|
2448
2423
|
* @example
|
|
2449
2424
|
* niivue = new Niivue()
|
|
2450
2425
|
* niivue.setOpacity(0, 0.5) // make the first volume transparent
|
|
2451
|
-
* @see {@link https://niivue.github.io/niivue/features/atlas.html|live demo usage}
|
|
2426
|
+
* @see {@link https://niivue.github.io/niivue/features/atlas.html | live demo usage}
|
|
2452
2427
|
*/
|
|
2453
2428
|
setOpacity(volIdx: number, newOpacity: number): void;
|
|
2454
2429
|
/**
|
|
@@ -2456,7 +2431,7 @@ declare class Niivue {
|
|
|
2456
2431
|
* @param scale - the new scale value
|
|
2457
2432
|
* @example
|
|
2458
2433
|
* niivue.setScale(2) // zoom some
|
|
2459
|
-
* @see {@link https://niivue.github.io/niivue/features/shiny.volumes.html|live demo usage}
|
|
2434
|
+
* @see {@link https://niivue.github.io/niivue/features/shiny.volumes.html | live demo usage}
|
|
2460
2435
|
*/
|
|
2461
2436
|
setScale(scale: number): void;
|
|
2462
2437
|
/**
|
|
@@ -2464,7 +2439,7 @@ declare class Niivue {
|
|
|
2464
2439
|
* @param color - the new color. expects an array of RGBA values. values can range from 0 to 1
|
|
2465
2440
|
* @example
|
|
2466
2441
|
* niivue.setClipPlaneColor([1, 1, 1, 0.5]) // white, transparent
|
|
2467
|
-
* @see {@link https://niivue.github.io/niivue/features/clipplanes.html|live demo usage}
|
|
2442
|
+
* @see {@link https://niivue.github.io/niivue/features/clipplanes.html | live demo usage}
|
|
2468
2443
|
*/
|
|
2469
2444
|
setClipPlaneColor(color: number[]): void;
|
|
2470
2445
|
/**
|
|
@@ -2472,7 +2447,7 @@ declare class Niivue {
|
|
|
2472
2447
|
* @param gradientAmount - amount of matcap (0..1), default 0 (matte, surface normal does not influence color)
|
|
2473
2448
|
* @example
|
|
2474
2449
|
* niivue.setVolumeRenderIllumination(0.6);
|
|
2475
|
-
* @see {@link https://niivue.github.io/niivue/features/shiny.volumes.html|live demo usage}
|
|
2450
|
+
* @see {@link https://niivue.github.io/niivue/features/shiny.volumes.html | live demo usage}
|
|
2476
2451
|
*/
|
|
2477
2452
|
setVolumeRenderIllumination(gradientAmount?: number): Promise<void>;
|
|
2478
2453
|
overlayRGBA(volume: NVImage): Uint8ClampedArray;
|
|
@@ -2494,7 +2469,7 @@ declare class Niivue {
|
|
|
2494
2469
|
/**
|
|
2495
2470
|
* Loads an NVDocument
|
|
2496
2471
|
* @returns Niivue instance
|
|
2497
|
-
* @see {@link https://niivue.github.io/niivue/features/document.load.html|live demo usage}
|
|
2472
|
+
* @see {@link https://niivue.github.io/niivue/features/document.load.html | live demo usage}
|
|
2498
2473
|
*/
|
|
2499
2474
|
loadDocument(document: NVDocument): this;
|
|
2500
2475
|
/**
|
|
@@ -2503,8 +2478,8 @@ declare class Niivue {
|
|
|
2503
2478
|
* @param esm - bundled version of NiiVue
|
|
2504
2479
|
* @example
|
|
2505
2480
|
* const javascript = this.generateLoadDocumentJavaScript("gl1");
|
|
2506
|
-
* const html =
|
|
2507
|
-
|
|
2481
|
+
* const html = `<html><body><canvas id="gl1"></canvas><script type="module" async>
|
|
2482
|
+
${javascript}</script></body></html>`;
|
|
2508
2483
|
*/
|
|
2509
2484
|
generateLoadDocumentJavaScript(canvasId: string, esm: string): string;
|
|
2510
2485
|
/**
|
|
@@ -2513,8 +2488,8 @@ declare class Niivue {
|
|
|
2513
2488
|
* @param esm - bundled version of NiiVue
|
|
2514
2489
|
* @returns HTML with javascript of the current scene
|
|
2515
2490
|
* @example
|
|
2516
|
-
* const template =
|
|
2517
|
-
* %%javascript%%</script></body></html
|
|
2491
|
+
* const template = `<html><body><canvas id="gl1"></canvas><script type="module" async>
|
|
2492
|
+
* %%javascript%%</script></body></html>`;
|
|
2518
2493
|
* nv1.generateHTML("page.html", esm);
|
|
2519
2494
|
*/
|
|
2520
2495
|
generateHTML(canvasId: string | undefined, esm: string): string;
|
|
@@ -2534,7 +2509,7 @@ declare class Niivue {
|
|
|
2534
2509
|
* @param fileName - the name of the document storing the scene
|
|
2535
2510
|
* @example
|
|
2536
2511
|
* niivue.saveDocument("niivue.basic.nvd")
|
|
2537
|
-
* @see {@link https://niivue.github.io/niivue/features/document.3d.html|live demo usage}
|
|
2512
|
+
* @see {@link https://niivue.github.io/niivue/features/document.3d.html | live demo usage}
|
|
2538
2513
|
*/
|
|
2539
2514
|
saveDocument(fileName?: string): Promise<void>;
|
|
2540
2515
|
/**
|
|
@@ -2543,13 +2518,13 @@ declare class Niivue {
|
|
|
2543
2518
|
* @returns returns the Niivue instance
|
|
2544
2519
|
* @example
|
|
2545
2520
|
* niivue = new Niivue()
|
|
2546
|
-
* niivue.loadVolumes([
|
|
2547
|
-
* @see {@link https://niivue.github.io/niivue/features/mask.html|live demo usage}
|
|
2521
|
+
* niivue.loadVolumes([{url: 'someImage.nii.gz}, {url: 'anotherImage.nii.gz'}])
|
|
2522
|
+
* @see {@link https://niivue.github.io/niivue/features/mask.html | live demo usage}
|
|
2548
2523
|
*/
|
|
2549
2524
|
loadVolumes(volumeList: ImageFromUrlOptions[]): Promise<this>;
|
|
2550
2525
|
/**
|
|
2551
2526
|
* Add mesh and notify subscribers
|
|
2552
|
-
* @see {@link https://niivue.github.io/niivue/features/multiuser.meshes.html|live demo usage}
|
|
2527
|
+
* @see {@link https://niivue.github.io/niivue/features/multiuser.meshes.html | live demo usage}
|
|
2553
2528
|
*/
|
|
2554
2529
|
addMeshFromUrl(meshOptions: LoadFromUrlParams): Promise<NVMesh>;
|
|
2555
2530
|
/**
|
|
@@ -2558,27 +2533,27 @@ declare class Niivue {
|
|
|
2558
2533
|
* @returns Niivue instance
|
|
2559
2534
|
* @example
|
|
2560
2535
|
* niivue = new Niivue()
|
|
2561
|
-
* niivue.loadMeshes([
|
|
2562
|
-
* @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
|
|
2536
|
+
* niivue.loadMeshes([{url: 'someMesh.gii'}])
|
|
2537
|
+
* @see {@link https://niivue.github.io/niivue/features/meshes.html | live demo usage}
|
|
2563
2538
|
*/
|
|
2564
2539
|
loadMeshes(meshList: LoadFromUrlParams[]): Promise<this>;
|
|
2565
2540
|
/**
|
|
2566
2541
|
* load a connectome specified by url
|
|
2567
2542
|
* @returns Niivue instance
|
|
2568
|
-
* @see {@link https://niivue.github.io/niivue/features/connectome.html|live demo usage}
|
|
2543
|
+
* @see {@link https://niivue.github.io/niivue/features/connectome.html | live demo usage}
|
|
2569
2544
|
*/
|
|
2570
2545
|
loadConnectomeFromUrl(url: string, headers?: {}): Promise<this>;
|
|
2571
2546
|
/**
|
|
2572
2547
|
* load a connectome specified by url
|
|
2573
2548
|
* @returns Niivue instance
|
|
2574
|
-
* @see {@link https://niivue.github.io/niivue/features/connectome.html|live demo usage}
|
|
2549
|
+
* @see {@link https://niivue.github.io/niivue/features/connectome.html | live demo usage}
|
|
2575
2550
|
*/
|
|
2576
2551
|
loadFreeSurferConnectomeFromUrl(url: string, headers?: {}): Promise<this>;
|
|
2577
2552
|
/**
|
|
2578
2553
|
* load a connectome specified by json
|
|
2579
2554
|
* @param connectome - freesurfer model
|
|
2580
2555
|
* @returns Niivue instance
|
|
2581
|
-
* @see {@link https://niivue.github.io/niivue/features/connectome.html|live demo usage}
|
|
2556
|
+
* @see {@link https://niivue.github.io/niivue/features/connectome.html | live demo usage}
|
|
2582
2557
|
*/
|
|
2583
2558
|
loadFreeSurferConnectome(json: FreeSurferConnectome): Promise<this>;
|
|
2584
2559
|
handleNodeAdded(event: {
|
|
@@ -2586,17 +2561,18 @@ declare class Niivue {
|
|
|
2586
2561
|
node: NVConnectomeNode;
|
|
2587
2562
|
};
|
|
2588
2563
|
}): void;
|
|
2564
|
+
loadConnectomeAsMesh(json: Connectome | LegacyConnectome | FreeSurferConnectome): NVMesh;
|
|
2589
2565
|
/**
|
|
2590
2566
|
* load a connectome specified by json
|
|
2591
2567
|
* @param connectome - model
|
|
2592
2568
|
* @returns Niivue instance
|
|
2593
|
-
* @see {@link https://niivue.github.io/niivue/features/connectome.html|live demo usage}
|
|
2569
|
+
* @see {@link https://niivue.github.io/niivue/features/connectome.html | live demo usage}
|
|
2594
2570
|
*/
|
|
2595
2571
|
loadConnectome(json: Connectome | LegacyConnectome): this;
|
|
2596
2572
|
/**
|
|
2597
2573
|
* generate a blank canvas for the pen tool
|
|
2598
2574
|
* @example niivue.createEmptyDrawing()
|
|
2599
|
-
* @see {@link https://niivue.github.io/niivue/features/cactus.html|live demo usage}
|
|
2575
|
+
* @see {@link https://niivue.github.io/niivue/features/cactus.html | live demo usage}
|
|
2600
2576
|
*/
|
|
2601
2577
|
createEmptyDrawing(): void;
|
|
2602
2578
|
r16Tex(texID: WebGLTexture | null, activeID: number, dims: number[], img16: Int16Array): WebGLTexture;
|
|
@@ -2604,7 +2580,7 @@ declare class Niivue {
|
|
|
2604
2580
|
* dilate drawing so all voxels are colored.
|
|
2605
2581
|
* works on drawing with multiple colors
|
|
2606
2582
|
* @example niivue.drawGrowCut();
|
|
2607
|
-
* @see {@link https://niivue.github.io/niivue/features/draw2.html|live demo usage}
|
|
2583
|
+
* @see {@link https://niivue.github.io/niivue/features/draw2.html | live demo usage}
|
|
2608
2584
|
*/
|
|
2609
2585
|
drawGrowCut(): void;
|
|
2610
2586
|
drawPt(x: number, y: number, z: number, penValue: number): void;
|
|
@@ -2616,14 +2592,14 @@ declare class Niivue {
|
|
|
2616
2592
|
/**
|
|
2617
2593
|
* close drawing: make sure you have saved any changes before calling this!
|
|
2618
2594
|
* @example niivue.closeDrawing();
|
|
2619
|
-
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html|live demo usage}
|
|
2595
|
+
* @see {@link https://niivue.github.io/niivue/features/draw.ui.html | live demo usage}
|
|
2620
2596
|
*/
|
|
2621
2597
|
closeDrawing(): void;
|
|
2622
2598
|
/**
|
|
2623
2599
|
* copy drawing bitmap from CPU to GPU storage and redraw the screen
|
|
2624
2600
|
* @param isForceRedraw - refreshes scene immediately (default true)
|
|
2625
2601
|
* @example niivue.refreshDrawing();
|
|
2626
|
-
* @see {@link https://niivue.github.io/niivue/features/cactus.html|live demo usage}
|
|
2602
|
+
* @see {@link https://niivue.github.io/niivue/features/cactus.html | live demo usage}
|
|
2627
2603
|
*/
|
|
2628
2604
|
refreshDrawing(isForceRedraw?: boolean): void;
|
|
2629
2605
|
r8Tex(texID: WebGLTexture | null, activeID: number, dims: number[], isInit?: boolean): WebGLTexture | null;
|
|
@@ -2637,7 +2613,7 @@ declare class Niivue {
|
|
|
2637
2613
|
* @param name - name of matcap to load ("Shiny", "Cortex", "Cream")
|
|
2638
2614
|
* @example
|
|
2639
2615
|
* niivue.loadMatCapTexture("Cortex");
|
|
2640
|
-
* @see {@link https://niivue.github.io/niivue/features/shiny.volumes.html|live demo usage}
|
|
2616
|
+
* @see {@link https://niivue.github.io/niivue/features/shiny.volumes.html | live demo usage}
|
|
2641
2617
|
*/
|
|
2642
2618
|
loadMatCapTexture(bmpUrl: string): Promise<WebGLTexture | null>;
|
|
2643
2619
|
initFontMets(): void;
|
|
@@ -2646,7 +2622,7 @@ declare class Niivue {
|
|
|
2646
2622
|
* @param name - name of matcap to load ("Roboto", "Garamond", "Ubuntu")
|
|
2647
2623
|
* @example
|
|
2648
2624
|
* niivue.loadMatCapTexture("Cortex");
|
|
2649
|
-
* @see {@link https://niivue.github.io/niivue/features/selectfont.html|live demo usage}
|
|
2625
|
+
* @see {@link https://niivue.github.io/niivue/features/selectfont.html | live demo usage}
|
|
2650
2626
|
*/
|
|
2651
2627
|
loadFont(fontSheetUrl?: any, metricsUrl?: {
|
|
2652
2628
|
atlas: {
|
|
@@ -2697,7 +2673,7 @@ declare class Niivue {
|
|
|
2697
2673
|
* @param id - id of mesh to change
|
|
2698
2674
|
* @param meshShaderNameOrNumber - identify shader for usage
|
|
2699
2675
|
* @example niivue.setMeshShader('toon');
|
|
2700
|
-
* @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
|
|
2676
|
+
* @see {@link https://niivue.github.io/niivue/features/meshes.html | live demo usage}
|
|
2701
2677
|
*/
|
|
2702
2678
|
setMeshShader(id: number, meshShaderNameOrNumber?: number): void;
|
|
2703
2679
|
/**
|
|
@@ -2716,7 +2692,7 @@ declare class Niivue {
|
|
|
2716
2692
|
* @param fragmentShaderText - custom fragment shader.
|
|
2717
2693
|
* @param ame - title for new shader.
|
|
2718
2694
|
* @returns index of the new shader (for setMeshShader)
|
|
2719
|
-
* @see {@link https://niivue.github.io/niivue/features/mesh.atlas.html|live demo usage}
|
|
2695
|
+
* @see {@link https://niivue.github.io/niivue/features/mesh.atlas.html | live demo usage}
|
|
2720
2696
|
*/
|
|
2721
2697
|
setCustomMeshShader(fragmentShaderText?: string, name?: string): number;
|
|
2722
2698
|
/**
|
|
@@ -2724,7 +2700,7 @@ declare class Niivue {
|
|
|
2724
2700
|
* @param sort - sort output alphabetically
|
|
2725
2701
|
* @returns list of available mesh shader names
|
|
2726
2702
|
* @example niivue.meshShaderNames();
|
|
2727
|
-
* @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
|
|
2703
|
+
* @see {@link https://niivue.github.io/niivue/features/meshes.html | live demo usage}
|
|
2728
2704
|
*/
|
|
2729
2705
|
meshShaderNames(sort?: boolean): string[];
|
|
2730
2706
|
initRenderShader(shader: Shader, gradientAmount?: number): void;
|
|
@@ -2735,7 +2711,7 @@ declare class Niivue {
|
|
|
2735
2711
|
* @example
|
|
2736
2712
|
* niivue = new Niivue()
|
|
2737
2713
|
* niivue.updateGLVolume()
|
|
2738
|
-
* @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
|
|
2714
|
+
* @see {@link https://niivue.github.io/niivue/features/colormaps.html | live demo usage}
|
|
2739
2715
|
*/
|
|
2740
2716
|
updateGLVolume(): void;
|
|
2741
2717
|
/**
|
|
@@ -2744,7 +2720,7 @@ declare class Niivue {
|
|
|
2744
2720
|
* @param masks - are optional binary images to filter voxles
|
|
2745
2721
|
* @returns numeric values to describe image
|
|
2746
2722
|
* @example niivue.getDescriptives(0);
|
|
2747
|
-
* @see {@link https://niivue.github.io/niivue/features/draw2.html|live demo usage}
|
|
2723
|
+
* @see {@link https://niivue.github.io/niivue/features/draw2.html | live demo usage}
|
|
2748
2724
|
*/
|
|
2749
2725
|
getDescriptives(layer?: number, masks?: never[], drawingIsMask?: boolean): Descriptive;
|
|
2750
2726
|
refreshLayers(overlayItem: NVImage, layer: number): void;
|
|
@@ -2755,14 +2731,14 @@ declare class Niivue {
|
|
|
2755
2731
|
* @example
|
|
2756
2732
|
* niivue = new Niivue()
|
|
2757
2733
|
* colormaps = niivue.colormaps()
|
|
2758
|
-
* @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
|
|
2734
|
+
* @see {@link https://niivue.github.io/niivue/features/colormaps.html | live demo usage}
|
|
2759
2735
|
*/
|
|
2760
2736
|
colormaps(): string[];
|
|
2761
2737
|
/**
|
|
2762
2738
|
* create a new colormap
|
|
2763
2739
|
* @param key - name of new colormap
|
|
2764
2740
|
* @param colormap - properties (Red, Green, Blue, Alpha and Indices)
|
|
2765
|
-
* @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
|
|
2741
|
+
* @see {@link https://niivue.github.io/niivue/features/colormaps.html | live demo usage}
|
|
2766
2742
|
*/
|
|
2767
2743
|
addColormap(key: string, cmap: ColorMap): void;
|
|
2768
2744
|
/**
|
|
@@ -2771,13 +2747,37 @@ declare class Niivue {
|
|
|
2771
2747
|
* @param colormap - the name of the colormap to use
|
|
2772
2748
|
* @example
|
|
2773
2749
|
* niivue.setColormap(niivue.volumes[0].id,, 'red')
|
|
2774
|
-
* @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
|
|
2750
|
+
* @see {@link https://niivue.github.io/niivue/features/colormaps.html | live demo usage}
|
|
2775
2751
|
*/
|
|
2776
2752
|
setColormap(id: string, colormap: string): void;
|
|
2753
|
+
idx(A: number, B: number, C: number, DIM: Uint32Array): number;
|
|
2754
|
+
check_previous_slice(bw: Uint32Array, il: Uint32Array, r: number, c: number, sl: number, dim: Uint32Array, conn: number, tt: Uint32Array): number;
|
|
2755
|
+
do_initial_labelling(bw: Uint32Array, dim: Uint32Array, conn: number): [number, Uint32Array, Uint32Array];
|
|
2756
|
+
fill_tratab(tt: Uint32Array, nabo: Uint32Array, nr_set: number): void;
|
|
2757
|
+
translate_labels(il: Uint32Array, dim: Uint32Array, tt: Uint32Array, ttn: number): [number, Uint32Array];
|
|
2758
|
+
largest_original_cluster_labels(bw: Uint32Array, cl: number, ls: Uint32Array): [number, Uint32Array];
|
|
2759
|
+
bwlabel(img: Uint32Array, dim: Uint32Array, conn?: number, binarize?: boolean, onlyLargestClusterPerClass?: boolean): [number, Uint32Array];
|
|
2760
|
+
createConnectedLabelImage(id: string, conn?: number, binarize?: boolean, onlyLargestClusterPerClass?: boolean): Promise<NVImage>;
|
|
2761
|
+
scalecropUint8(img32: Float32Array, dst_min: number | undefined, dst_max: number | undefined, src_min: number, scale: number): Promise<Uint8Array>;
|
|
2762
|
+
scalecropFloat32(img32: Float32Array, dst_min: number | undefined, dst_max: number | undefined, src_min: number, scale: number): Promise<Float32Array>;
|
|
2763
|
+
getScale(volume: NVImage, dst_min?: number, dst_max?: number, f_low?: number, f_high?: number): [number, number];
|
|
2764
|
+
conformVox2Vox(inDims: number[], inAffine: number[], outDim?: number, outMM?: number, toRAS?: boolean): [mat4, mat4, mat4];
|
|
2765
|
+
createNiftiArray(dims?: number[], pixDims?: number[], affine?: number[], datatypeCode?: NiiDataType, img?: Uint8Array): Promise<Uint8Array>;
|
|
2766
|
+
niftiArray2NVImage(bytes?: Uint8Array): Promise<NVImage>;
|
|
2767
|
+
loadFromUrl(fnm: string): Promise<NVImage>;
|
|
2768
|
+
/**
|
|
2769
|
+
* FreeSurfer-style conform reslices any image to a 256x256x256 volume with 1mm voxels
|
|
2770
|
+
* @param volume - input volume to be re-oriented, intensity-scaled and resliced
|
|
2771
|
+
* @param toRAS - reslice to row, column slices to right-anterior-superior not left-inferior-anterior (default false).
|
|
2772
|
+
* @param isLinear - reslice with linear rather than nearest-neighbor interpolation (default true).
|
|
2773
|
+
* @param asFloat32 - use Float32 datatype rather than Uint8 (default false).
|
|
2774
|
+
* @see {@link https://niivue.github.io/niivue/features/torso.html | live demo usage}
|
|
2775
|
+
*/
|
|
2776
|
+
conform(volume: NVImage, toRAS?: boolean, isLinear?: boolean, asFloat32?: boolean): Promise<NVImage>;
|
|
2777
2777
|
/**
|
|
2778
2778
|
* darken crevices and brighten corners when 3D rendering drawings.
|
|
2779
2779
|
* @param amount - amount of ambient occlusion (default 0.4)
|
|
2780
|
-
* @see {@link https://niivue.github.io/niivue/features/torso.html|live demo usage}
|
|
2780
|
+
* @see {@link https://niivue.github.io/niivue/features/torso.html | live demo usage}
|
|
2781
2781
|
*/
|
|
2782
2782
|
setRenderDrawAmbientOcclusion(ao: number): void;
|
|
2783
2783
|
setColorMap(id: string, colormap: string): void;
|
|
@@ -2788,24 +2788,24 @@ declare class Niivue {
|
|
|
2788
2788
|
* @example
|
|
2789
2789
|
* niivue = new Niivue()
|
|
2790
2790
|
* niivue.setColormapNegative(niivue.volumes[1].id,"winter");
|
|
2791
|
-
* @see {@link https://niivue.github.io/niivue/features/mosaics2.html|live demo usage}
|
|
2791
|
+
* @see {@link https://niivue.github.io/niivue/features/mosaics2.html | live demo usage}
|
|
2792
2792
|
*/
|
|
2793
2793
|
setColormapNegative(id: string, colormapNegative: string): void;
|
|
2794
2794
|
/**
|
|
2795
2795
|
* modulate intensity of one image based on intensity of another
|
|
2796
2796
|
* @param idTarget - the ID of the NVImage to be biased
|
|
2797
|
-
* @param idModulation - the ID of the NVImage that controls bias (
|
|
2797
|
+
* @param idModulation - the ID of the NVImage that controls bias (empty string to disable modulation)
|
|
2798
2798
|
* @param modulateAlpha - does the modulation influence alpha transparency (values greater than 1).
|
|
2799
2799
|
* @example niivue.setModulationImage(niivue.volumes[0].id, niivue.volumes[1].id);
|
|
2800
|
-
* @see {@link https://niivue.github.io/niivue/features/modulate.html|live demo scalar usage}
|
|
2801
|
-
* @see {@link https://niivue.github.io/niivue/features/modulateAfni.html|live demo usage}
|
|
2800
|
+
* @see {@link https://niivue.github.io/niivue/features/modulate.html | live demo scalar usage}
|
|
2801
|
+
* @see {@link https://niivue.github.io/niivue/features/modulateAfni.html | live demo usage}
|
|
2802
2802
|
*/
|
|
2803
2803
|
setModulationImage(idTarget: string, idModulation: string, modulateAlpha?: number): void;
|
|
2804
2804
|
/**
|
|
2805
2805
|
* adjust screen gamma. Low values emphasize shadows but can appear flat, high gamma hides shadow details.
|
|
2806
2806
|
* @param gamma - selects luminance, default is 1
|
|
2807
2807
|
* @example niivue.setGamma(1.0);
|
|
2808
|
-
* @see {@link https://niivue.github.io/niivue/features/colormaps.html|live demo usage}
|
|
2808
|
+
* @see {@link https://niivue.github.io/niivue/features/colormaps.html | live demo usage}
|
|
2809
2809
|
*/
|
|
2810
2810
|
setGamma(gamma?: number): void;
|
|
2811
2811
|
/** Load all volumes for image opened with `limitFrames4D`, the user can also click the `...` on a 4D timeline to load deferred volumes
|
|
@@ -2817,7 +2817,7 @@ declare class Niivue {
|
|
|
2817
2817
|
* @param id - the ID of the 4D NVImage
|
|
2818
2818
|
* @param frame4D - frame to display (indexed from zero)
|
|
2819
2819
|
* @example nv1.setFrame4D(nv1.volumes[0].id, 42);
|
|
2820
|
-
* @see {@link https://niivue.github.io/niivue/features/timeseries.html|live demo usage}
|
|
2820
|
+
* @see {@link https://niivue.github.io/niivue/features/timeseries.html | live demo usage}
|
|
2821
2821
|
*/
|
|
2822
2822
|
setFrame4D(id: string, frame4D: number): void;
|
|
2823
2823
|
/**
|
|
@@ -2825,7 +2825,7 @@ declare class Niivue {
|
|
|
2825
2825
|
* @param id - the ID of the 4D NVImage
|
|
2826
2826
|
* @returns currently selected volume (indexed from 0)
|
|
2827
2827
|
* @example nv1.getFrame4D(nv1.volumes[0].id);
|
|
2828
|
-
* @see {@link https://niivue.github.io/niivue/features/timeseries.html|live demo usage}
|
|
2828
|
+
* @see {@link https://niivue.github.io/niivue/features/timeseries.html | live demo usage}
|
|
2829
2829
|
*/
|
|
2830
2830
|
getFrame4D(id: string): number;
|
|
2831
2831
|
colormapFromKey(name: string): ColorMap;
|
|
@@ -2875,7 +2875,7 @@ declare class Niivue {
|
|
|
2875
2875
|
* select between nearest and linear interpolation for voxel based images
|
|
2876
2876
|
* @param isNearest - whether nearest neighbor interpolation is used, else linear interpolation
|
|
2877
2877
|
* @example niivue.setInterpolation(true);
|
|
2878
|
-
* @see {@link https://niivue.github.io/niivue/features/draw2.html|live demo usage}
|
|
2878
|
+
* @see {@link https://niivue.github.io/niivue/features/draw2.html | live demo usage}
|
|
2879
2879
|
*/
|
|
2880
2880
|
setInterpolation(isNearest: boolean): void;
|
|
2881
2881
|
calculateMvpMatrix2D(leftTopWidthHeight: number[], mn: vec3, mx: vec3, clipTolerance: number | undefined, clipDepth: number | undefined, azimuth: number | undefined, elevation: number | undefined, isRadiolgical: boolean): MvpMatrix2D;
|
|
@@ -2923,7 +2923,7 @@ declare class Niivue {
|
|
|
2923
2923
|
* @param y - translate posterior (-) or +anterior (+)
|
|
2924
2924
|
* @param z - translate inferior (-) or superior (+)
|
|
2925
2925
|
* @example niivue.moveCrosshairInVox(1, 0, 0)
|
|
2926
|
-
* @see {@link https://niivue.github.io/niivue/features/draw2.html|live demo usage}
|
|
2926
|
+
* @see {@link https://niivue.github.io/niivue/features/draw2.html | live demo usage}
|
|
2927
2927
|
*/
|
|
2928
2928
|
moveCrosshairInVox(x: number, y: number, z: number): void;
|
|
2929
2929
|
frac2mm(frac: vec3, volIdx?: number, isForceSliceMM?: boolean): vec4;
|
|
@@ -2941,7 +2941,7 @@ declare class Niivue {
|
|
|
2941
2941
|
* display a lightbox or montage view
|
|
2942
2942
|
* @param mosaicStr - specifies orientation (A,C,S) and location of slices.
|
|
2943
2943
|
* @example niivue.setSliceMosaicString("A -10 0 20");
|
|
2944
|
-
* @see {@link https://niivue.github.io/niivue/features/mosaics.html|live demo usage}
|
|
2944
|
+
* @see {@link https://niivue.github.io/niivue/features/mosaics.html | live demo usage}
|
|
2945
2945
|
*/
|
|
2946
2946
|
drawMosaic(mosaicStr: string): void;
|
|
2947
2947
|
drawSceneCore(): string | void;
|
|
@@ -2950,4 +2950,4 @@ declare class Niivue {
|
|
|
2950
2950
|
set gl(gl: WebGL2RenderingContext | null);
|
|
2951
2951
|
}
|
|
2952
2952
|
|
|
2953
|
-
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 };
|
|
2953
|
+
export { type Connectome, type ConnectomeOptions, DEFAULT_OPTIONS, DRAG_MODE, type DocumentData, type DragReleaseParams, type ExportDocumentData, LabelLineTerminator, LabelTextAlignment, type LegacyConnectome, type LegacyNodes, MULTIPLANAR_TYPE, type NVConfigOptions, 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 };
|