@niivue/niivue 0.41.1 → 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 +1007 -981
- package/build/index.js +1064 -276
- package/build/index.js.map +1 -1
- package/build/index.min.js +1 -1
- package/package.json +1 -3
- package/src/niivue/index.ts +832 -256
- package/src/nvcontroller.ts +1 -0
- package/src/nvdocument.ts +11 -1
- package/src/nvimage/index.ts +368 -127
- package/src/nvimage/utils.ts +36 -1
- package/src/nvlabel.ts +2 -0
- package/src/nvmesh-loaders.ts +1 -0
- package/src/nvutilities.ts +1 -0
- package/src/types.ts +16 -0
package/build/index.d.ts
CHANGED
|
@@ -109,6 +109,7 @@ declare enum LabelLineTerminator {
|
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
* Class representing label style.
|
|
112
|
+
* @ignore
|
|
112
113
|
*/
|
|
113
114
|
declare class NVLabel3DStyle {
|
|
114
115
|
textColor: number[];
|
|
@@ -133,6 +134,7 @@ declare class NVLabel3DStyle {
|
|
|
133
134
|
}
|
|
134
135
|
/**
|
|
135
136
|
* Label class
|
|
137
|
+
* @ignore
|
|
136
138
|
*/
|
|
137
139
|
declare class NVLabel3D {
|
|
138
140
|
text: string;
|
|
@@ -146,724 +148,392 @@ declare class NVLabel3D {
|
|
|
146
148
|
constructor(text: string, style: NVLabel3DStyle, points?: number[] | number[][]);
|
|
147
149
|
}
|
|
148
150
|
|
|
149
|
-
type NiftiHeader = {
|
|
150
|
-
littleEndian: boolean;
|
|
151
|
-
dim_info: number;
|
|
152
|
-
dims: number[];
|
|
153
|
-
pixDims: number[];
|
|
154
|
-
intent_p1: number;
|
|
155
|
-
intent_p2: number;
|
|
156
|
-
intent_p3: number;
|
|
157
|
-
intent_code: number;
|
|
158
|
-
datatypeCode: number;
|
|
159
|
-
numBitsPerVoxel: number;
|
|
160
|
-
slice_start: number;
|
|
161
|
-
vox_offset: number;
|
|
162
|
-
scl_slope: number;
|
|
163
|
-
scl_inter: number;
|
|
164
|
-
slice_end: number;
|
|
165
|
-
slice_code: number;
|
|
166
|
-
xyzt_units: number;
|
|
167
|
-
cal_max: number;
|
|
168
|
-
cal_min: number;
|
|
169
|
-
slice_duration: number;
|
|
170
|
-
toffset: number;
|
|
171
|
-
description: string;
|
|
172
|
-
aux_file: string;
|
|
173
|
-
qform_code: number;
|
|
174
|
-
sform_code: number;
|
|
175
|
-
quatern_b: number;
|
|
176
|
-
quatern_c: number;
|
|
177
|
-
quatern_d: number;
|
|
178
|
-
qoffset_x: number;
|
|
179
|
-
qoffset_y: number;
|
|
180
|
-
qoffset_z: number;
|
|
181
|
-
affine: number[][];
|
|
182
|
-
intent_name: string;
|
|
183
|
-
magic: string;
|
|
184
|
-
};
|
|
185
|
-
type Volume = Record<string, any>;
|
|
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
|
-
type
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
Y: number[];
|
|
240
|
-
Z: number[];
|
|
241
|
-
Color: number[];
|
|
242
|
-
Size: number[];
|
|
243
|
-
};
|
|
244
|
-
type LegacyConnectome = Partial<ConnectomeOptions> & {
|
|
245
|
-
nodes: LegacyNodes;
|
|
246
|
-
edges: number[];
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
type ValuesArray = Array<{
|
|
250
|
-
id: string;
|
|
251
|
-
vals: Float32Array;
|
|
252
|
-
global_min?: number;
|
|
253
|
-
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;
|
|
254
205
|
cal_min?: number;
|
|
255
206
|
cal_max?: number;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
};
|
|
273
|
-
type TRX = {
|
|
274
|
-
pts: Float32Array;
|
|
275
|
-
offsetPt0: Uint32Array;
|
|
276
|
-
dpg: ValuesArray;
|
|
277
|
-
dps: ValuesArray;
|
|
278
|
-
dpv: ValuesArray;
|
|
279
|
-
header: unknown;
|
|
280
|
-
};
|
|
281
|
-
type TRK = {
|
|
282
|
-
pts: Float32Array;
|
|
283
|
-
offsetPt0: Uint32Array;
|
|
284
|
-
dps: ValuesArray;
|
|
285
|
-
dpv: ValuesArray;
|
|
286
|
-
};
|
|
287
|
-
type TCK = {
|
|
288
|
-
pts: Float32Array;
|
|
289
|
-
offsetPt0: Uint32Array;
|
|
290
|
-
};
|
|
291
|
-
type VTK = DefaultMeshType | {
|
|
292
|
-
pts: Float32Array;
|
|
293
|
-
offsetPt0: Uint32Array;
|
|
294
|
-
};
|
|
295
|
-
type ANNOT = Uint32Array | {
|
|
296
|
-
scalars: Float32Array;
|
|
297
|
-
colormapLabel: LUT;
|
|
298
|
-
};
|
|
299
|
-
type MZ3 = Float32Array | {
|
|
300
|
-
positions: Float32Array | null;
|
|
301
|
-
indices: Uint32Array | null;
|
|
302
|
-
scalars: Float32Array;
|
|
303
|
-
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;
|
|
304
223
|
};
|
|
305
|
-
type
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
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;
|
|
311
240
|
};
|
|
312
|
-
type
|
|
313
|
-
|
|
314
|
-
|
|
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;
|
|
315
251
|
};
|
|
316
|
-
type
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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;
|
|
320
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;
|
|
321
266
|
|
|
322
|
-
|
|
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
|
|
323
270
|
*/
|
|
324
|
-
declare
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
FIBER = "fiber"
|
|
328
|
-
}
|
|
329
|
-
type NVMeshLayer = {
|
|
330
|
-
name?: string;
|
|
331
|
-
key?: string;
|
|
271
|
+
declare class NVImage {
|
|
272
|
+
name: string;
|
|
273
|
+
id: string;
|
|
332
274
|
url?: string;
|
|
333
275
|
headers?: Record<string, string>;
|
|
334
|
-
|
|
335
|
-
|
|
276
|
+
_colormap: string;
|
|
277
|
+
_opacity: number;
|
|
278
|
+
percentileFrac: number;
|
|
279
|
+
ignoreZeroVoxels: boolean;
|
|
280
|
+
trustCalMinMax: boolean;
|
|
336
281
|
colormapNegative: string;
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
cal_min: number;
|
|
343
|
-
cal_max: number;
|
|
282
|
+
colormapLabel: LUT | null;
|
|
283
|
+
colormapInvert?: boolean;
|
|
284
|
+
nFrame4D?: number;
|
|
285
|
+
frame4D: number;
|
|
286
|
+
nTotalFrame4D?: number;
|
|
344
287
|
cal_minNeg: number;
|
|
345
288
|
cal_maxNeg: number;
|
|
346
|
-
isAdditiveBlend: boolean;
|
|
347
|
-
frame4D: number;
|
|
348
|
-
nFrame4D: number;
|
|
349
|
-
values: number[];
|
|
350
|
-
outlineBorder?: number;
|
|
351
|
-
isTransparentBelowCalMin?: boolean;
|
|
352
|
-
alphaThreshold: boolean;
|
|
353
|
-
base64?: string;
|
|
354
|
-
colorbarVisible?: boolean;
|
|
355
|
-
};
|
|
356
|
-
declare class NVMeshFromUrlOptions {
|
|
357
|
-
url: string;
|
|
358
|
-
gl: WebGL2RenderingContext | null;
|
|
359
|
-
name: string;
|
|
360
|
-
opacity: number;
|
|
361
|
-
rgba255: Uint8Array;
|
|
362
|
-
visible: boolean;
|
|
363
|
-
layers: NVMeshLayer[];
|
|
364
|
-
colorbarVisible: boolean;
|
|
365
|
-
constructor(url?: string, gl?: null, name?: string, opacity?: number, rgba255?: Uint8Array, visible?: boolean, layers?: never[], colorbarVisible?: boolean);
|
|
366
|
-
}
|
|
367
|
-
type BaseLoadParams = {
|
|
368
|
-
gl: WebGL2RenderingContext;
|
|
369
|
-
name: string;
|
|
370
|
-
opacity: number;
|
|
371
|
-
rgba255: number[] | Uint8Array;
|
|
372
|
-
visible: boolean;
|
|
373
|
-
layers: NVMeshLayer[];
|
|
374
|
-
};
|
|
375
|
-
type LoadFromUrlParams = Partial<BaseLoadParams> & {
|
|
376
|
-
url: string;
|
|
377
|
-
headers?: Record<string, string>;
|
|
378
|
-
};
|
|
379
|
-
type LoadFromFileParams = BaseLoadParams & {
|
|
380
|
-
file: Blob;
|
|
381
|
-
};
|
|
382
|
-
type LoadFromBase64Params = BaseLoadParams & {
|
|
383
|
-
base64: string;
|
|
384
|
-
};
|
|
385
|
-
/**
|
|
386
|
-
* a NVMesh encapsulates some mesh data and provides methods to query and operate on meshes
|
|
387
|
-
*/
|
|
388
|
-
declare class NVMesh {
|
|
389
|
-
id: string;
|
|
390
|
-
name: string;
|
|
391
|
-
anatomicalStructurePrimary: string;
|
|
392
289
|
colorbarVisible: boolean;
|
|
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
|
-
|
|
437
|
-
nodeMaxColor?: number;
|
|
438
|
-
edgeMin?: number;
|
|
439
|
-
edgeMax?: number;
|
|
440
|
-
nodes?: LegacyNodes | NVConnectomeNode[];
|
|
441
|
-
edges?: number[] | NVConnectomeEdge[];
|
|
442
|
-
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;
|
|
443
334
|
/**
|
|
444
|
-
*
|
|
445
|
-
* @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)
|
|
446
337
|
* @param name - a name for this image. Default is an empty string
|
|
447
|
-
* @param
|
|
448
|
-
* @param opacity - the opacity for this
|
|
449
|
-
* @param
|
|
450
|
-
* @param
|
|
451
|
-
* @param
|
|
452
|
-
* @param
|
|
453
|
-
* @param
|
|
454
|
-
* @param
|
|
455
|
-
* @param
|
|
456
|
-
* @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
|
|
457
360
|
*/
|
|
458
|
-
constructor(
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
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>;
|
|
470
396
|
/**
|
|
471
|
-
* 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
|
|
472
399
|
*/
|
|
473
|
-
static loadFromUrl({ url,
|
|
474
|
-
|
|
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>;
|
|
475
404
|
/**
|
|
476
|
-
* factory function to load and return a new
|
|
477
|
-
*
|
|
478
|
-
* @returns NVMesh instance
|
|
405
|
+
* factory function to load and return a new NVImage instance from a file in the browser
|
|
479
406
|
*/
|
|
480
|
-
static loadFromFile({ file,
|
|
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>;
|
|
481
409
|
/**
|
|
482
|
-
* load and return a new
|
|
410
|
+
* factory function to load and return a new NVImage instance from a base64 encoded string
|
|
411
|
+
*
|
|
412
|
+
* @returns NVImage instance
|
|
413
|
+
* @example
|
|
414
|
+
* myImage = NVImage.loadFromBase64('SomeBase64String')
|
|
483
415
|
*/
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
static
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
static
|
|
512
|
-
|
|
513
|
-
|
|
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;
|
|
419
|
+
/**
|
|
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}
|
|
426
|
+
*/
|
|
427
|
+
getVolumeData(voxStart?: number[], voxEnd?: number[], dataType?: string): [TypedVoxelArray, number[]];
|
|
428
|
+
/**
|
|
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}
|
|
434
|
+
*/
|
|
435
|
+
setVolumeData(voxStart?: number[], voxEnd?: number[], img?: TypedVoxelArray): void;
|
|
436
|
+
/**
|
|
437
|
+
* factory function to load and return a new NVImage instance from a base64 encoded string
|
|
438
|
+
*
|
|
439
|
+
* @returns NVImage instance
|
|
440
|
+
* @example
|
|
441
|
+
* myImage = NVImage.loadFromBase64('SomeBase64String')
|
|
442
|
+
*/
|
|
443
|
+
static loadFromBase64({ base64, name, colormap, opacity, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels }: ImageFromBase64): NVImage;
|
|
444
|
+
/**
|
|
445
|
+
* make a clone of a NVImage instance and return a new NVImage
|
|
446
|
+
* @returns NVImage instance
|
|
447
|
+
* @example
|
|
448
|
+
* myImage = NVImage.loadFromFile(SomeFileObject) // files can be from dialogs or drag and drop
|
|
449
|
+
* clonedImage = myImage.clone()
|
|
450
|
+
*/
|
|
451
|
+
clone(): NVImage;
|
|
452
|
+
/**
|
|
453
|
+
* fill a NVImage instance with zeros for the image data
|
|
454
|
+
* @example
|
|
455
|
+
* myImage = NVImage.loadFromFile(SomeFileObject) // files can be from dialogs or drag and drop
|
|
456
|
+
* clonedImageWithZeros = myImage.clone().zeroImage()
|
|
457
|
+
*/
|
|
458
|
+
zeroImage(): void;
|
|
459
|
+
/**
|
|
460
|
+
* get nifti specific metadata about the image
|
|
461
|
+
*/
|
|
462
|
+
getImageMetadata(): ImageMetadata;
|
|
463
|
+
/**
|
|
464
|
+
* a factory function to make a zero filled image given a NVImage as a reference
|
|
465
|
+
* @param nvImage - an existing NVImage as a reference
|
|
466
|
+
* @param dataType - the output data type. Options: 'same', 'uint8'
|
|
467
|
+
* @returns new NVImage filled with zeros for the image data
|
|
468
|
+
* @example
|
|
469
|
+
* myImage = NVImage.loadFromFile(SomeFileObject) // files can be from dialogs or drag and drop
|
|
470
|
+
* newZeroImage = NVImage.zerosLike(myImage)
|
|
471
|
+
*/
|
|
472
|
+
static zerosLike(nvImage: NVImage, dataType?: string): NVImage;
|
|
473
|
+
getValue(x: number, y: number, z: number, frame4D?: number, isReadImaginary?: boolean): number;
|
|
474
|
+
/**
|
|
475
|
+
* @param id - id of 3D Object (is this the base volume or an overlay?)
|
|
476
|
+
* @param gl - WebGL rendering context
|
|
477
|
+
* @returns new 3D object in model space
|
|
478
|
+
*/
|
|
479
|
+
toNiivueObject3D(id: number, gl: WebGL2RenderingContext): NiivueObject3D;
|
|
480
|
+
/**
|
|
481
|
+
* Update options for image
|
|
482
|
+
*/
|
|
483
|
+
applyOptionsUpdate(options: ImageFromUrlOptions): void;
|
|
484
|
+
getImageOptions(): ImageFromUrlOptions;
|
|
485
|
+
/**
|
|
486
|
+
* Converts NVImage to NIfTI compliant byte array
|
|
487
|
+
*/
|
|
488
|
+
toUint8Array(drawingBytes?: Uint8Array | null): Uint8Array;
|
|
489
|
+
convertVox2Frac(vox: vec3): vec3;
|
|
490
|
+
convertFrac2Vox(frac: vec3): vec3;
|
|
491
|
+
convertFrac2MM(frac: vec3, isForceSliceMM?: boolean): vec4;
|
|
492
|
+
convertMM2Frac(mm: vec3 | vec4, isForceSliceMM?: boolean): vec3;
|
|
514
493
|
}
|
|
515
494
|
|
|
495
|
+
type FreeSurferConnectome = {
|
|
496
|
+
data_type: string;
|
|
497
|
+
points: Array<{
|
|
498
|
+
comments?: Array<{
|
|
499
|
+
text: string;
|
|
500
|
+
}>;
|
|
501
|
+
coordinates: {
|
|
502
|
+
x: number;
|
|
503
|
+
y: number;
|
|
504
|
+
z: number;
|
|
505
|
+
};
|
|
506
|
+
}>;
|
|
507
|
+
};
|
|
516
508
|
/**
|
|
517
|
-
*
|
|
509
|
+
* Represents a connectome
|
|
518
510
|
*/
|
|
519
|
-
declare
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
511
|
+
declare class NVConnectome extends NVMesh {
|
|
512
|
+
gl: WebGL2RenderingContext;
|
|
513
|
+
nodesChanged: EventTarget;
|
|
514
|
+
constructor(gl: WebGL2RenderingContext, connectome: LegacyConnectome);
|
|
515
|
+
static convertLegacyConnectome(json: LegacyConnectome): Connectome;
|
|
516
|
+
static convertFreeSurferConnectome(json: FreeSurferConnectome, colormap?: string): Connectome;
|
|
517
|
+
updateLabels(): void;
|
|
518
|
+
addConnectomeNode(node: NVConnectomeNode): void;
|
|
519
|
+
deleteConnectomeNode(node: NVConnectomeNode): void;
|
|
520
|
+
updateConnectomeNodeByIndex(index: number, updatedNode: NVConnectomeNode): void;
|
|
521
|
+
updateConnectomeNodeByPoint(point: [number, number, number], updatedNode: NVConnectomeNode): void;
|
|
522
|
+
addConnectomeEdge(first: number, second: number, colorValue: number): NVConnectomeEdge;
|
|
523
|
+
deleteConnectomeEdge(first: number, second: number): NVConnectomeEdge;
|
|
524
|
+
findClosestConnectomeNode(point: number[], distance: number): NVConnectomeNode | null;
|
|
525
|
+
updateConnectome(gl: WebGL2RenderingContext): void;
|
|
526
|
+
updateMesh(gl: WebGL2RenderingContext): void;
|
|
527
|
+
json(): Connectome;
|
|
528
|
+
/**
|
|
529
|
+
* Factory method to create connectome from options
|
|
530
|
+
*/
|
|
531
|
+
static loadConnectomeFromUrl(gl: WebGL2RenderingContext, url: string): Promise<NVConnectome>;
|
|
537
532
|
}
|
|
538
|
-
type ImageFromUrlOptions = {
|
|
539
|
-
url: string;
|
|
540
|
-
urlImageData?: string;
|
|
541
|
-
headers?: Record<string, string>;
|
|
542
|
-
name?: string;
|
|
543
|
-
colorMap?: string;
|
|
544
|
-
colormap?: string;
|
|
545
|
-
opacity?: number;
|
|
546
|
-
cal_min?: number;
|
|
547
|
-
cal_max?: number;
|
|
548
|
-
trustCalMinMax?: boolean;
|
|
549
|
-
percentileFrac?: number;
|
|
550
|
-
useQFormNotSForm?: boolean;
|
|
551
|
-
alphaThreshold?: boolean;
|
|
552
|
-
colormapNegative?: string;
|
|
553
|
-
cal_minNeg?: number;
|
|
554
|
-
cal_maxNeg?: number;
|
|
555
|
-
colorbarVisible?: boolean;
|
|
556
|
-
ignoreZeroVoxels?: boolean;
|
|
557
|
-
imageType?: ImageType;
|
|
558
|
-
frame4D?: number;
|
|
559
|
-
colormapLabel?: string[];
|
|
560
|
-
pairedImgData?: null;
|
|
561
|
-
limitFrames4D?: number;
|
|
562
|
-
isManifest?: boolean;
|
|
563
|
-
urlImgData?: string;
|
|
564
|
-
};
|
|
565
|
-
type ImageFromFileOptions = {
|
|
566
|
-
file: File | File[];
|
|
567
|
-
name?: string;
|
|
568
|
-
colormap?: string;
|
|
569
|
-
opacity?: number;
|
|
570
|
-
urlImgData?: File | null;
|
|
571
|
-
cal_min?: number;
|
|
572
|
-
cal_max?: number;
|
|
573
|
-
trustCalMinMax?: boolean;
|
|
574
|
-
percentileFrac?: number;
|
|
575
|
-
ignoreZeroVoxels?: boolean;
|
|
576
|
-
useQFormNotSForm?: boolean;
|
|
577
|
-
colormapNegative?: string;
|
|
578
|
-
imageType?: ImageType;
|
|
579
|
-
frame4D?: number;
|
|
580
|
-
limitFrames4D?: number;
|
|
581
|
-
};
|
|
582
|
-
type ImageFromBase64 = {
|
|
583
|
-
base64: string;
|
|
584
|
-
name?: string;
|
|
585
|
-
colormap?: string;
|
|
586
|
-
opacity?: number;
|
|
587
|
-
cal_min?: number;
|
|
588
|
-
cal_max?: number;
|
|
589
|
-
trustCalMinMax?: boolean;
|
|
590
|
-
percentileFrac?: number;
|
|
591
|
-
ignoreZeroVoxels?: boolean;
|
|
592
|
-
};
|
|
593
|
-
type ImageMetadata = {
|
|
594
|
-
id: string;
|
|
595
|
-
datatypeCode: number;
|
|
596
|
-
nx: number;
|
|
597
|
-
ny: number;
|
|
598
|
-
nz: number;
|
|
599
|
-
nt: number;
|
|
600
|
-
dx: number;
|
|
601
|
-
dy: number;
|
|
602
|
-
dz: number;
|
|
603
|
-
dt: number;
|
|
604
|
-
bpv: number;
|
|
605
|
-
};
|
|
606
|
-
declare const NVImageFromUrlOptions: (url: string, urlImageData?: string, name?: string, colormap?: string, opacity?: number, cal_min?: number, cal_max?: number, trustCalMinMax?: boolean, percentileFrac?: number, ignoreZeroVoxels?: boolean, useQFormNotSForm?: boolean, colormapNegative?: string, frame4D?: number, imageType?: ImageType, cal_minNeg?: number, cal_maxNeg?: number, colorbarVisible?: boolean, alphaThreshold?: boolean, colormapLabel?: string[]) => ImageFromUrlOptions;
|
|
607
533
|
|
|
608
534
|
/**
|
|
609
|
-
*
|
|
610
|
-
|
|
611
|
-
declare class NVImage {
|
|
612
|
-
name: string;
|
|
613
|
-
id: string;
|
|
614
|
-
url?: string;
|
|
615
|
-
headers?: Record<string, string>;
|
|
616
|
-
_colormap: string;
|
|
617
|
-
_opacity: number;
|
|
618
|
-
percentileFrac: number;
|
|
619
|
-
ignoreZeroVoxels: boolean;
|
|
620
|
-
trustCalMinMax: boolean;
|
|
621
|
-
colormapNegative: string;
|
|
622
|
-
colormapLabel: LUT | null;
|
|
623
|
-
colormapInvert?: boolean;
|
|
624
|
-
nFrame4D?: number;
|
|
625
|
-
frame4D: number;
|
|
626
|
-
nTotalFrame4D?: number;
|
|
627
|
-
cal_minNeg: number;
|
|
628
|
-
cal_maxNeg: number;
|
|
629
|
-
colorbarVisible: boolean;
|
|
630
|
-
modulationImage: number | null;
|
|
631
|
-
modulateAlpha: number;
|
|
632
|
-
series: any;
|
|
633
|
-
nVox3D?: number;
|
|
634
|
-
oblique_angle?: number;
|
|
635
|
-
maxShearDeg?: number;
|
|
636
|
-
useQFormNotSForm: boolean;
|
|
637
|
-
alphaThreshold?: number;
|
|
638
|
-
pixDims?: number[];
|
|
639
|
-
matRAS?: mat4;
|
|
640
|
-
pixDimsRAS?: number[];
|
|
641
|
-
obliqueRAS?: mat4;
|
|
642
|
-
dimsRAS?: number[];
|
|
643
|
-
permRAS?: number[];
|
|
644
|
-
toRAS?: mat4;
|
|
645
|
-
toRASvox?: mat4;
|
|
646
|
-
frac2mm?: mat4;
|
|
647
|
-
frac2mmOrtho?: mat4;
|
|
648
|
-
extentsMinOrtho?: number[];
|
|
649
|
-
extentsMaxOrtho?: number[];
|
|
650
|
-
mm2ortho?: mat4;
|
|
651
|
-
hdr: nifti.NIFTI1 | nifti.NIFTI2 | null;
|
|
652
|
-
imageType?: ImageType;
|
|
653
|
-
img?: Uint8Array | Int16Array | Float32Array | Float64Array | Uint16Array;
|
|
654
|
-
imaginary?: Float32Array;
|
|
655
|
-
fileObject?: File | File[];
|
|
656
|
-
dims?: number[];
|
|
657
|
-
onColormapChange: (img: NVImage) => void;
|
|
658
|
-
onOpacityChange: (img: NVImage) => void;
|
|
659
|
-
mm000?: vec3;
|
|
660
|
-
mm100?: vec3;
|
|
661
|
-
mm010?: vec3;
|
|
662
|
-
mm001?: vec3;
|
|
663
|
-
cal_min?: number;
|
|
664
|
-
cal_max?: number;
|
|
665
|
-
robust_min?: number;
|
|
666
|
-
robust_max?: number;
|
|
667
|
-
global_min?: number;
|
|
668
|
-
global_max?: number;
|
|
669
|
-
urlImgData?: string;
|
|
670
|
-
isManifest?: boolean;
|
|
671
|
-
limitFrames4D?: number;
|
|
672
|
-
DT_NONE: number;
|
|
673
|
-
DT_UNKNOWN: number;
|
|
674
|
-
DT_BINARY: number;
|
|
675
|
-
DT_UNSIGNED_CHAR: number;
|
|
676
|
-
DT_SIGNED_SHORT: number;
|
|
677
|
-
DT_SIGNED_INT: number;
|
|
678
|
-
DT_FLOAT: number;
|
|
679
|
-
DT_COMPLEX: number;
|
|
680
|
-
DT_DOUBLE: number;
|
|
681
|
-
DT_RGB: number;
|
|
682
|
-
DT_ALL: number;
|
|
683
|
-
DT_INT8: number;
|
|
684
|
-
DT_UINT16: number;
|
|
685
|
-
DT_UINT32: number;
|
|
686
|
-
DT_INT64: number;
|
|
687
|
-
DT_UINT64: number;
|
|
688
|
-
DT_FLOAT128: number;
|
|
689
|
-
DT_COMPLEX128: number;
|
|
690
|
-
DT_COMPLEX256: number;
|
|
691
|
-
DT_RGBA32: number;
|
|
692
|
-
/**
|
|
693
|
-
*
|
|
694
|
-
* @param dataBuffer - an array buffer of image data to load (there are also methods that abstract this more. See loadFromUrl, and loadFromFile)
|
|
695
|
-
* @param name - a name for this image. Default is an empty string
|
|
696
|
-
* @param colormap - a color map to use. default is gray
|
|
697
|
-
* @param opacity - the opacity for this image. default is 1
|
|
698
|
-
* @param pairedImgData - Allows loading formats where header and image are separate files (e.g. nifti.hdr, nifti.img)
|
|
699
|
-
* @param cal_min - minimum intensity for color brightness/contrast
|
|
700
|
-
* @param cal_max - maximum intensity for color brightness/contrast
|
|
701
|
-
* @param trustCalMinMax - whether or not to trust cal_min and cal_max from the nifti header (trusting results in faster loading)
|
|
702
|
-
* @param percentileFrac - the percentile to use for setting the robust range of the display values (smart intensity setting for images with large ranges)
|
|
703
|
-
* @param ignoreZeroVoxels - whether or not to ignore zero voxels in setting the robust range of display values
|
|
704
|
-
* @param useQFormNotSForm - give precedence to QForm (Quaternion) or SForm (Matrix)
|
|
705
|
-
* @param colormapNegative - a color map to use for symmetrical negative intensities
|
|
706
|
-
* @param frame4D - volume displayed, 0 indexed, must be less than nFrame4D
|
|
707
|
-
*
|
|
708
|
-
* FIXME the following params are documented but not included in the actual constructor
|
|
709
|
-
* @param onColormapChange - callback for color map change
|
|
710
|
-
* @param onOpacityChange -callback for color map change
|
|
711
|
-
*
|
|
712
|
-
* TODO the following parameters were not documented
|
|
713
|
-
* @param imageType - TODO
|
|
714
|
-
* @param cal_minNeg - TODO
|
|
715
|
-
* @param cal_maxNeg - TODO
|
|
716
|
-
* @param colorbarVisible - TODO
|
|
717
|
-
* @param colormapLabel - TODO
|
|
718
|
-
*/
|
|
719
|
-
constructor(dataBuffer?: ArrayBuffer | ArrayBuffer[] | null, name?: string, colormap?: string, opacity?: number, pairedImgData?: ArrayBuffer | null, cal_min?: number, cal_max?: number, trustCalMinMax?: boolean, percentileFrac?: number, ignoreZeroVoxels?: boolean, useQFormNotSForm?: boolean, colormapNegative?: string, frame4D?: number, imageType?: ImageType, cal_minNeg?: number, cal_maxNeg?: number, colorbarVisible?: boolean, colormapLabel?: LUT | null);
|
|
720
|
-
computeObliqueAngle(mtx44: mat4): number;
|
|
721
|
-
calculateOblique(): void;
|
|
722
|
-
THD_daxes_to_NIFTI(xyzDelta: number[], xyzOrigin: number[], orientSpecific: number[]): void;
|
|
723
|
-
SetPixDimFromSForm(): void;
|
|
724
|
-
readDICOM(buf: ArrayBuffer | ArrayBuffer[]): ArrayBuffer;
|
|
725
|
-
readECAT(buffer: ArrayBuffer): ArrayBuffer;
|
|
726
|
-
readV16(buffer: ArrayBuffer): ArrayBuffer;
|
|
727
|
-
readVMR(buffer: ArrayBuffer): ArrayBuffer;
|
|
728
|
-
readMGH(buffer: ArrayBuffer): ArrayBuffer;
|
|
729
|
-
readHEAD(dataBuffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
|
|
730
|
-
readMHA(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
|
|
731
|
-
readMIF(buffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
|
|
732
|
-
readNRRD(dataBuffer: ArrayBuffer, pairedImgData: ArrayBuffer | null): ArrayBuffer;
|
|
733
|
-
calculateRAS(): void;
|
|
734
|
-
img2RAS(): Float32Array | Uint8Array | Int16Array | Float64Array | Uint16Array;
|
|
735
|
-
vox2mm(XYZ: number[], mtx: mat4): vec3;
|
|
736
|
-
mm2vox(mm: number[], frac?: boolean): Float32Array | vec3;
|
|
737
|
-
arrayEquals(a: unknown[], b: unknown[]): boolean;
|
|
738
|
-
setColormap(cm: string): void;
|
|
739
|
-
setColormapLabel(cm: ColorMap): void;
|
|
740
|
-
setColormapLabelFromUrl(url: string): Promise<void>;
|
|
741
|
-
get colormap(): string;
|
|
742
|
-
get colorMap(): string;
|
|
743
|
-
set colormap(cm: string);
|
|
744
|
-
set colorMap(cm: string);
|
|
745
|
-
get opacity(): number;
|
|
746
|
-
set opacity(opacity: number);
|
|
747
|
-
calMinMax(): number[];
|
|
748
|
-
intensityRaw2Scaled(raw: number): number;
|
|
749
|
-
intensityScaled2Raw(scaled: number): number;
|
|
750
|
-
saveToUint8Array(fnm: string, drawing8?: Uint8Array | null): Uint8Array;
|
|
751
|
-
saveToDisk(fnm?: string, drawing8?: Uint8Array | null): Uint8Array;
|
|
752
|
-
static fetchDicomData(url: string, headers?: Record<string, string>): Promise<ArrayBuffer[]>;
|
|
753
|
-
static fetchPartial(url: string, bytesToLoad: number, headers?: Record<string, string>): Promise<Response>;
|
|
754
|
-
/**
|
|
755
|
-
* factory function to load and return a new NVImage instance from a given URL
|
|
756
|
-
* @returns NVImage instance
|
|
757
|
-
*/
|
|
758
|
-
static loadFromUrl({ url, urlImgData, headers, name, colormap, opacity, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels, useQFormNotSForm, colormapNegative, frame4D, isManifest, limitFrames4D, imageType, colorbarVisible }?: Partial<Omit<ImageFromUrlOptions, 'url'>> & {
|
|
759
|
-
url?: string | Uint8Array | ArrayBuffer;
|
|
760
|
-
}): Promise<NVImage>;
|
|
761
|
-
static readFileAsync(file: File, bytesToLoad?: number): Promise<ArrayBuffer>;
|
|
762
|
-
/**
|
|
763
|
-
* factory function to load and return a new NVImage instance from a file in the browser
|
|
764
|
-
*/
|
|
765
|
-
static loadFromFile({ file, // file can be an array of file objects or a single file object
|
|
766
|
-
name, colormap, opacity, urlImgData, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels, useQFormNotSForm, colormapNegative, frame4D, limitFrames4D, imageType }: ImageFromFileOptions): Promise<NVImage>;
|
|
767
|
-
/**
|
|
768
|
-
* factory function to load and return a new NVImage instance from a base64 encoded string
|
|
769
|
-
*
|
|
770
|
-
* @returns NVImage instance
|
|
771
|
-
* @example
|
|
772
|
-
* myImage = NVImage.loadFromBase64('SomeBase64String')
|
|
773
|
-
*/
|
|
774
|
-
static loadFromBase64({ base64, name, colormap, opacity, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels }: ImageFromBase64): NVImage;
|
|
775
|
-
/**
|
|
776
|
-
* make a clone of a NVImage instance and return a new NVImage
|
|
777
|
-
* @returns NVImage instance
|
|
778
|
-
* @example
|
|
779
|
-
* myImage = NVImage.loadFromFile(SomeFileObject) // files can be from dialogs or drag and drop
|
|
780
|
-
* clonedImage = myImage.clone()
|
|
781
|
-
*/
|
|
782
|
-
clone(): NVImage;
|
|
783
|
-
/**
|
|
784
|
-
* fill a NVImage instance with zeros for the image data
|
|
785
|
-
* @example
|
|
786
|
-
* myImage = NVImage.loadFromFile(SomeFileObject) // files can be from dialogs or drag and drop
|
|
787
|
-
* clonedImageWithZeros = myImage.clone().zeroImage()
|
|
788
|
-
*/
|
|
789
|
-
zeroImage(): void;
|
|
790
|
-
/**
|
|
791
|
-
* get nifti specific metadata about the image
|
|
792
|
-
*/
|
|
793
|
-
getImageMetadata(): ImageMetadata;
|
|
794
|
-
/**
|
|
795
|
-
* a factory function to make a zero filled image given a NVImage as a reference
|
|
796
|
-
* @param nvImage - an existing NVImage as a reference
|
|
797
|
-
* @param dataType - the output data type. Options: 'same', 'uint8'
|
|
798
|
-
* @returns new NVImage filled with zeros for the image data
|
|
799
|
-
* @example
|
|
800
|
-
* myImage = NVImage.loadFromFile(SomeFileObject) // files can be from dialogs or drag and drop
|
|
801
|
-
* newZeroImage = NVImage.zerosLike(myImage)
|
|
802
|
-
*/
|
|
803
|
-
static zerosLike(nvImage: NVImage, dataType?: string): NVImage;
|
|
804
|
-
getValue(x: number, y: number, z: number, frame4D?: number, isReadImaginary?: boolean): number;
|
|
805
|
-
/**
|
|
806
|
-
* @param id - id of 3D Object (is this the base volume or an overlay?)
|
|
807
|
-
* @param gl - WebGL rendering context
|
|
808
|
-
* @returns new 3D object in model space
|
|
809
|
-
*/
|
|
810
|
-
toNiivueObject3D(id: number, gl: WebGL2RenderingContext): NiivueObject3D;
|
|
811
|
-
/**
|
|
812
|
-
* Update options for image
|
|
813
|
-
*/
|
|
814
|
-
applyOptionsUpdate(options: ImageFromUrlOptions): void;
|
|
815
|
-
getImageOptions(): ImageFromUrlOptions;
|
|
816
|
-
/**
|
|
817
|
-
* Converts NVImage to NIfTI compliant byte array
|
|
818
|
-
*/
|
|
819
|
-
toUint8Array(drawingBytes?: Uint8Array | null): Uint8Array;
|
|
820
|
-
convertVox2Frac(vox: vec3): vec3;
|
|
821
|
-
convertFrac2Vox(frac: vec3): vec3;
|
|
822
|
-
convertFrac2MM(frac: vec3, isForceSliceMM?: boolean): vec4;
|
|
823
|
-
convertMM2Frac(mm: vec3 | vec4, isForceSliceMM?: boolean): vec3;
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
type FreeSurferConnectome = {
|
|
827
|
-
data_type: string;
|
|
828
|
-
points: Array<{
|
|
829
|
-
comments?: Array<{
|
|
830
|
-
text: string;
|
|
831
|
-
}>;
|
|
832
|
-
coordinates: {
|
|
833
|
-
x: number;
|
|
834
|
-
y: number;
|
|
835
|
-
z: number;
|
|
836
|
-
};
|
|
837
|
-
}>;
|
|
838
|
-
};
|
|
839
|
-
/**
|
|
840
|
-
* Represents a connectome
|
|
841
|
-
*/
|
|
842
|
-
declare class NVConnectome extends NVMesh {
|
|
843
|
-
gl: WebGL2RenderingContext;
|
|
844
|
-
nodesChanged: EventTarget;
|
|
845
|
-
constructor(gl: WebGL2RenderingContext, connectome: LegacyConnectome);
|
|
846
|
-
static convertLegacyConnectome(json: LegacyConnectome): Connectome;
|
|
847
|
-
static convertFreeSurferConnectome(json: FreeSurferConnectome, colormap?: string): Connectome;
|
|
848
|
-
updateLabels(): void;
|
|
849
|
-
addConnectomeNode(node: NVConnectomeNode): void;
|
|
850
|
-
deleteConnectomeNode(node: NVConnectomeNode): void;
|
|
851
|
-
updateConnectomeNodeByIndex(index: number, updatedNode: NVConnectomeNode): void;
|
|
852
|
-
updateConnectomeNodeByPoint(point: [number, number, number], updatedNode: NVConnectomeNode): void;
|
|
853
|
-
addConnectomeEdge(first: number, second: number, colorValue: number): NVConnectomeEdge;
|
|
854
|
-
deleteConnectomeEdge(first: number, second: number): NVConnectomeEdge;
|
|
855
|
-
findClosestConnectomeNode(point: number[], distance: number): NVConnectomeNode | null;
|
|
856
|
-
updateConnectome(gl: WebGL2RenderingContext): void;
|
|
857
|
-
updateMesh(gl: WebGL2RenderingContext): void;
|
|
858
|
-
json(): Connectome;
|
|
859
|
-
/**
|
|
860
|
-
* Factory method to create connectome from options
|
|
861
|
-
*/
|
|
862
|
-
static loadConnectomeFromUrl(gl: WebGL2RenderingContext, url: string): Promise<NVConnectome>;
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
/**
|
|
866
|
-
* Slice Type
|
|
535
|
+
* Slice Type
|
|
536
|
+
* @ignore
|
|
867
537
|
*/
|
|
868
538
|
declare enum SLICE_TYPE {
|
|
869
539
|
AXIAL = 0,
|
|
@@ -874,6 +544,7 @@ declare enum SLICE_TYPE {
|
|
|
874
544
|
}
|
|
875
545
|
/**
|
|
876
546
|
* Multi-planar layout
|
|
547
|
+
* @ignore
|
|
877
548
|
*/
|
|
878
549
|
declare enum MULTIPLANAR_TYPE {
|
|
879
550
|
AUTO = 0,
|
|
@@ -881,6 +552,10 @@ declare enum MULTIPLANAR_TYPE {
|
|
|
881
552
|
GRID = 2,
|
|
882
553
|
ROW = 3
|
|
883
554
|
}
|
|
555
|
+
/**
|
|
556
|
+
* Drag mode
|
|
557
|
+
* @ignore
|
|
558
|
+
*/
|
|
884
559
|
declare enum DRAG_MODE {
|
|
885
560
|
none = 0,
|
|
886
561
|
contrast = 1,
|
|
@@ -889,6 +564,9 @@ declare enum DRAG_MODE {
|
|
|
889
564
|
slicer3D = 4,
|
|
890
565
|
callbackOnly = 5
|
|
891
566
|
}
|
|
567
|
+
/**
|
|
568
|
+
* NVConfigOptions
|
|
569
|
+
*/
|
|
892
570
|
type NVConfigOptions = {
|
|
893
571
|
textHeight: number;
|
|
894
572
|
colorbarHeight: number;
|
|
@@ -972,132 +650,513 @@ type Scene = {
|
|
|
972
650
|
_elevation?: number;
|
|
973
651
|
_azimuth?: number;
|
|
974
652
|
};
|
|
975
|
-
type DocumentData = {
|
|
976
|
-
title: string;
|
|
977
|
-
imageOptionsArray: ImageFromUrlOptions[];
|
|
978
|
-
meshOptionsArray: unknown[];
|
|
979
|
-
opts: NVConfigOptions;
|
|
980
|
-
previewImageDataURL: string;
|
|
981
|
-
labels: NVLabel3D[];
|
|
982
|
-
encodedImageBlobs: string[];
|
|
983
|
-
encodedDrawingBlob: string;
|
|
984
|
-
meshesString?: string;
|
|
985
|
-
sceneData?: SceneData;
|
|
986
|
-
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;
|
|
987
1027
|
};
|
|
988
|
-
type
|
|
989
|
-
|
|
990
|
-
encodedDrawingBlob: string;
|
|
991
|
-
previewImageDataURL: string;
|
|
992
|
-
imageOptionsMap: Map<string, number>;
|
|
993
|
-
imageOptionsArray: ImageFromUrlOptions[];
|
|
994
|
-
sceneData: Partial<SceneData>;
|
|
995
|
-
opts: NVConfigOptions;
|
|
996
|
-
meshesString: string;
|
|
997
|
-
labels: NVLabel3D[];
|
|
998
|
-
connectomes: string[];
|
|
1028
|
+
type LoadFromBase64Params = BaseLoadParams & {
|
|
1029
|
+
base64: string;
|
|
999
1030
|
};
|
|
1000
1031
|
/**
|
|
1001
|
-
*
|
|
1032
|
+
* a NVMesh encapsulates some mesh data and provides methods to query and operate on meshes
|
|
1002
1033
|
*/
|
|
1003
|
-
declare class
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
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
|
-
* Checks if document has an image by id
|
|
1059
|
-
*/
|
|
1060
|
-
hasImage(image: NVImage): boolean;
|
|
1061
|
-
/**
|
|
1062
|
-
* Checks if document has an image by url
|
|
1063
|
-
*/
|
|
1064
|
-
hasImageFromUrl(url: string): boolean;
|
|
1065
|
-
/**
|
|
1066
|
-
* Adds an image and the options an image was created with
|
|
1067
|
-
*/
|
|
1068
|
-
addImageOptions(image: NVImage, imageOptions: ImageFromUrlOptions): void;
|
|
1069
|
-
/**
|
|
1070
|
-
* Removes image from the document as well as its options
|
|
1071
|
-
*/
|
|
1072
|
-
removeImage(image: NVImage): void;
|
|
1073
|
-
/**
|
|
1074
|
-
* Returns the options for the image if it was added by url
|
|
1075
|
-
*/
|
|
1076
|
-
getImageOptions(image: NVImage): ImageFromUrlOptions | null;
|
|
1077
|
-
/**
|
|
1078
|
-
* Converts NVDocument to JSON
|
|
1079
|
-
*/
|
|
1080
|
-
json(): ExportDocumentData;
|
|
1081
|
-
/**
|
|
1082
|
-
* Downloads a JSON file with options, scene, images, meshes and drawing of {@link Niivue} instance
|
|
1083
|
-
*/
|
|
1084
|
-
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[];
|
|
1085
1089
|
/**
|
|
1086
|
-
*
|
|
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
|
|
1087
1103
|
*/
|
|
1088
|
-
|
|
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>;
|
|
1089
1116
|
/**
|
|
1090
|
-
*
|
|
1117
|
+
* factory function to load and return a new NVMesh instance from a given URL
|
|
1091
1118
|
*/
|
|
1092
|
-
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>;
|
|
1093
1121
|
/**
|
|
1094
|
-
*
|
|
1122
|
+
* factory function to load and return a new NVMesh instance from a file in the browser
|
|
1123
|
+
*
|
|
1124
|
+
* @returns NVMesh instance
|
|
1095
1125
|
*/
|
|
1096
|
-
static loadFromFile(file
|
|
1126
|
+
static loadFromFile({ file, gl, name, opacity, rgba255, visible, layers }?: Partial<LoadFromFileParams>): Promise<NVMesh>;
|
|
1097
1127
|
/**
|
|
1098
|
-
*
|
|
1128
|
+
* load and return a new NVMesh instance from a base64 encoded string
|
|
1099
1129
|
*/
|
|
1100
|
-
|
|
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;
|
|
1101
1160
|
}
|
|
1102
1161
|
|
|
1103
1162
|
/**
|
|
@@ -1219,6 +1278,7 @@ declare class SessionBus {
|
|
|
1219
1278
|
|
|
1220
1279
|
/**
|
|
1221
1280
|
* NVController is for synchronizing both remote and local instances of Niivue
|
|
1281
|
+
* @ignore
|
|
1222
1282
|
*/
|
|
1223
1283
|
declare class NVController {
|
|
1224
1284
|
niivue: Niivue;
|
|
@@ -1308,6 +1368,7 @@ declare class NVController {
|
|
|
1308
1368
|
|
|
1309
1369
|
/**
|
|
1310
1370
|
* Namespace for utility functions
|
|
1371
|
+
* @ignore
|
|
1311
1372
|
*/
|
|
1312
1373
|
declare class NVUtilities {
|
|
1313
1374
|
static arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
|
|
@@ -1341,6 +1402,7 @@ declare class NVUtilities {
|
|
|
1341
1402
|
|
|
1342
1403
|
/**
|
|
1343
1404
|
* Class to load different mesh formats
|
|
1405
|
+
* @ignore
|
|
1344
1406
|
*/
|
|
1345
1407
|
declare class NVMeshLoaders {
|
|
1346
1408
|
static readTRACT(buffer: ArrayBuffer): TRACT;
|
|
@@ -1377,17 +1439,6 @@ declare class NVMeshLoaders {
|
|
|
1377
1439
|
static readGII(buffer: ArrayBuffer, n_vert?: number): GII;
|
|
1378
1440
|
}
|
|
1379
1441
|
|
|
1380
|
-
type DragReleaseParams = {
|
|
1381
|
-
fracStart: vec3;
|
|
1382
|
-
fracEnd: vec3;
|
|
1383
|
-
voxStart: vec3;
|
|
1384
|
-
voxEnd: vec3;
|
|
1385
|
-
mmStart: vec4;
|
|
1386
|
-
mmEnd: vec4;
|
|
1387
|
-
mmLength: number;
|
|
1388
|
-
tileIdx: number;
|
|
1389
|
-
axCorSag: SLICE_TYPE;
|
|
1390
|
-
};
|
|
1391
1442
|
type ColormapListEntry = {
|
|
1392
1443
|
name: string;
|
|
1393
1444
|
min: number;
|
|
@@ -1450,55 +1501,6 @@ type MM = {
|
|
|
1450
1501
|
rotation: mat4;
|
|
1451
1502
|
fovMM: vec3;
|
|
1452
1503
|
};
|
|
1453
|
-
/**
|
|
1454
|
-
* Niivue exposes many properties. It's always good to call `updateGLVolume` after altering one of these settings.
|
|
1455
|
-
*/
|
|
1456
|
-
type NiiVueOptions = {
|
|
1457
|
-
textHeight?: number;
|
|
1458
|
-
colorbarHeight?: number;
|
|
1459
|
-
colorbarMargin?: number;
|
|
1460
|
-
crosshairWidth?: number;
|
|
1461
|
-
rulerWidth?: number;
|
|
1462
|
-
backColor?: number[];
|
|
1463
|
-
crosshairColor?: number[];
|
|
1464
|
-
fontColor?: number[];
|
|
1465
|
-
selectionBoxColor?: number[];
|
|
1466
|
-
clipPlaneColor?: number[];
|
|
1467
|
-
rulerColor?: number[];
|
|
1468
|
-
show3Dcrosshair?: boolean;
|
|
1469
|
-
trustCalMinMax?: boolean;
|
|
1470
|
-
clipPlaneHotKey?: string;
|
|
1471
|
-
viewModeHotKey?: string;
|
|
1472
|
-
keyDebounceTime?: number;
|
|
1473
|
-
doubleTouchTimeout?: number;
|
|
1474
|
-
longTouchTimeout?: number;
|
|
1475
|
-
isRadiologicalConvention?: boolean;
|
|
1476
|
-
logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'fatal' | 'silent';
|
|
1477
|
-
loadingText?: string;
|
|
1478
|
-
dragAndDropEnabled?: boolean;
|
|
1479
|
-
isNearestInterpolation?: boolean;
|
|
1480
|
-
atlasOutline?: number;
|
|
1481
|
-
isRuler?: boolean;
|
|
1482
|
-
isColorbar?: boolean;
|
|
1483
|
-
isOrientCube?: boolean;
|
|
1484
|
-
multiplanarPadPixels?: number;
|
|
1485
|
-
multiplanarForceRender?: boolean;
|
|
1486
|
-
meshThicknessOn2D?: number;
|
|
1487
|
-
dragMode?: DRAG_MODE;
|
|
1488
|
-
isDepthPickMesh?: boolean;
|
|
1489
|
-
isCornerOrientationText?: boolean;
|
|
1490
|
-
sagittalNoseLeft?: boolean;
|
|
1491
|
-
isSliceMM?: boolean;
|
|
1492
|
-
isV1SliceShader?: boolean;
|
|
1493
|
-
isHighResolutionCapable?: boolean;
|
|
1494
|
-
isForceMouseClickToVoxelCenters?: boolean;
|
|
1495
|
-
drawingEnabled?: boolean;
|
|
1496
|
-
penValue?: number;
|
|
1497
|
-
floodFillNeighbors?: number;
|
|
1498
|
-
maxDrawUndoBitmaps?: number;
|
|
1499
|
-
thumbnail?: string;
|
|
1500
|
-
meshXRay?: number;
|
|
1501
|
-
};
|
|
1502
1504
|
type UIData = {
|
|
1503
1505
|
mousedown: boolean;
|
|
1504
1506
|
touchdown: boolean;
|
|
@@ -1534,7 +1536,7 @@ type SaveImageOptions = {
|
|
|
1534
1536
|
* loading and rendering NIFTI image data in a WebGL 2.0 context.
|
|
1535
1537
|
*
|
|
1536
1538
|
* @example
|
|
1537
|
-
* 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
|
|
1538
1540
|
*/
|
|
1539
1541
|
declare class Niivue {
|
|
1540
1542
|
canvas: HTMLCanvasElement | null;
|
|
@@ -1661,128 +1663,128 @@ declare class Niivue {
|
|
|
1661
1663
|
/**
|
|
1662
1664
|
* callback function to run when the right mouse button is released after dragging
|
|
1663
1665
|
* @example
|
|
1664
|
-
* niivue.onDragRelease = ()
|
|
1666
|
+
* niivue.onDragRelease = () => {
|
|
1665
1667
|
* console.log('drag ended')
|
|
1666
|
-
*
|
|
1668
|
+
* }
|
|
1667
1669
|
*/
|
|
1668
1670
|
onDragRelease: (params: DragReleaseParams) => void;
|
|
1669
1671
|
/**
|
|
1670
1672
|
* callback function to run when the left mouse button is released
|
|
1671
1673
|
* @example
|
|
1672
|
-
* niivue.onMouseUp = ()
|
|
1674
|
+
* niivue.onMouseUp = () => {
|
|
1673
1675
|
* console.log('mouse up')
|
|
1674
|
-
*
|
|
1676
|
+
* }
|
|
1675
1677
|
*/
|
|
1676
1678
|
onMouseUp: (data: Partial<UIData>) => void;
|
|
1677
1679
|
/**
|
|
1678
1680
|
* callback function to run when the crosshair location changes
|
|
1679
1681
|
* @example
|
|
1680
|
-
* niivue.onLocationChange = (data)
|
|
1682
|
+
* niivue.onLocationChange = (data) => {
|
|
1681
1683
|
* console.log('location changed')
|
|
1682
1684
|
* console.log('mm: ', data.mm)
|
|
1683
1685
|
* console.log('vox: ', data.vox)
|
|
1684
1686
|
* console.log('frac: ', data.frac)
|
|
1685
1687
|
* console.log('values: ', data.values)
|
|
1686
|
-
*
|
|
1688
|
+
* }
|
|
1687
1689
|
*/
|
|
1688
1690
|
onLocationChange: (location: unknown) => void;
|
|
1689
1691
|
/**
|
|
1690
1692
|
* callback function to run when the user changes the intensity range with the selection box action (right click)
|
|
1691
1693
|
* @example
|
|
1692
|
-
* niivue.onIntensityChange = (volume)
|
|
1694
|
+
* niivue.onIntensityChange = (volume) => {
|
|
1693
1695
|
* console.log('intensity changed')
|
|
1694
1696
|
* console.log('volume: ', volume)
|
|
1695
|
-
*
|
|
1697
|
+
* }
|
|
1696
1698
|
*/
|
|
1697
1699
|
onIntensityChange: (volume: NVImage) => void;
|
|
1698
1700
|
/**
|
|
1699
1701
|
* callback function to run when a new volume is loaded
|
|
1700
1702
|
* @example
|
|
1701
|
-
* niivue.onImageLoaded = (volume)
|
|
1703
|
+
* niivue.onImageLoaded = (volume) => {
|
|
1702
1704
|
* console.log('volume loaded')
|
|
1703
1705
|
* console.log('volume: ', volume)
|
|
1704
|
-
*
|
|
1706
|
+
* }
|
|
1705
1707
|
*/
|
|
1706
1708
|
onImageLoaded: (volume: NVImage) => void;
|
|
1707
1709
|
/**
|
|
1708
1710
|
* callback function to run when a new mesh is loaded
|
|
1709
1711
|
* @example
|
|
1710
|
-
* niivue.onMeshLoaded = (mesh)
|
|
1712
|
+
* niivue.onMeshLoaded = (mesh) => {
|
|
1711
1713
|
* console.log('mesh loaded')
|
|
1712
1714
|
* console.log('mesh: ', mesh)
|
|
1713
|
-
*
|
|
1715
|
+
* }
|
|
1714
1716
|
*/
|
|
1715
1717
|
onMeshLoaded: (mesh: NVMesh) => void;
|
|
1716
1718
|
/**
|
|
1717
1719
|
* callback function to run when the user changes the volume when a 4D image is loaded
|
|
1718
1720
|
* @example
|
|
1719
|
-
* niivue.onFrameChange = (volume, frameNumber)
|
|
1721
|
+
* niivue.onFrameChange = (volume, frameNumber) => {
|
|
1720
1722
|
* console.log('frame changed')
|
|
1721
1723
|
* console.log('volume: ', volume)
|
|
1722
1724
|
* console.log('frameNumber: ', frameNumber)
|
|
1723
|
-
*
|
|
1725
|
+
* }
|
|
1724
1726
|
*/
|
|
1725
1727
|
onFrameChange: (volume: NVImage, index: number) => void;
|
|
1726
1728
|
/**
|
|
1727
1729
|
* callback function to run when niivue reports an error
|
|
1728
1730
|
* @example
|
|
1729
|
-
* niivue.onError = (error)
|
|
1731
|
+
* niivue.onError = (error) => {
|
|
1730
1732
|
* console.log('error: ', error)
|
|
1731
|
-
*
|
|
1733
|
+
* }
|
|
1732
1734
|
*/
|
|
1733
1735
|
onError: () => void;
|
|
1734
1736
|
onColormapChange: () => void;
|
|
1735
1737
|
/**
|
|
1736
1738
|
* callback function to run when niivue reports detailed info
|
|
1737
1739
|
* @example
|
|
1738
|
-
* niivue.onInfo = (info)
|
|
1740
|
+
* niivue.onInfo = (info) => {
|
|
1739
1741
|
* console.log('info: ', info)
|
|
1740
|
-
*
|
|
1742
|
+
* }
|
|
1741
1743
|
*/
|
|
1742
1744
|
onInfo: () => void;
|
|
1743
1745
|
/**
|
|
1744
1746
|
* callback function to run when niivue reports a warning
|
|
1745
1747
|
* @example
|
|
1746
|
-
* niivue.onWarn = (warn)
|
|
1748
|
+
* niivue.onWarn = (warn) => {
|
|
1747
1749
|
* console.log('warn: ', warn)
|
|
1748
|
-
*
|
|
1750
|
+
* }
|
|
1749
1751
|
*/
|
|
1750
1752
|
onWarn: () => void;
|
|
1751
1753
|
/**
|
|
1752
1754
|
* callback function to run when niivue reports a debug message
|
|
1753
1755
|
* @example
|
|
1754
|
-
* niivue.onDebug = (debug)
|
|
1756
|
+
* niivue.onDebug = (debug) => {
|
|
1755
1757
|
* console.log('debug: ', debug)
|
|
1756
|
-
*
|
|
1758
|
+
* }
|
|
1757
1759
|
*/
|
|
1758
1760
|
onDebug: () => void;
|
|
1759
1761
|
/**
|
|
1760
1762
|
* callback function to run when a volume is added from a url
|
|
1761
1763
|
* @example
|
|
1762
|
-
* niivue.onVolumeAddedFromUrl = (imageOptions, volume)
|
|
1764
|
+
* niivue.onVolumeAddedFromUrl = (imageOptions, volume) => {
|
|
1763
1765
|
* console.log('volume added from url')
|
|
1764
1766
|
* console.log('imageOptions: ', imageOptions)
|
|
1765
1767
|
* console.log('volume: ', volume)
|
|
1766
|
-
*
|
|
1768
|
+
* }
|
|
1767
1769
|
*/
|
|
1768
1770
|
onVolumeAddedFromUrl: (imageOptions: ImageFromUrlOptions, volume: NVImage) => void;
|
|
1769
1771
|
onVolumeWithUrlRemoved: (url: string) => void;
|
|
1770
1772
|
/**
|
|
1771
1773
|
* callback function to run when updateGLVolume is called (most users will not need to use
|
|
1772
1774
|
* @example
|
|
1773
|
-
* niivue.onVolumeUpdated = ()
|
|
1775
|
+
* niivue.onVolumeUpdated = () => {
|
|
1774
1776
|
* console.log('volume updated')
|
|
1775
|
-
*
|
|
1777
|
+
* }
|
|
1776
1778
|
*/
|
|
1777
1779
|
onVolumeUpdated: () => void;
|
|
1778
1780
|
/**
|
|
1779
1781
|
* callback function to run when a mesh is added from a url
|
|
1780
1782
|
* @example
|
|
1781
|
-
* niivue.onMeshAddedFromUrl = (meshOptions, mesh)
|
|
1783
|
+
* niivue.onMeshAddedFromUrl = (meshOptions, mesh) => {
|
|
1782
1784
|
* console.log('mesh added from url')
|
|
1783
1785
|
* console.log('meshOptions: ', meshOptions)
|
|
1784
1786
|
* console.log('mesh: ', mesh)
|
|
1785
|
-
*
|
|
1787
|
+
* }
|
|
1786
1788
|
*/
|
|
1787
1789
|
onMeshAddedFromUrl: (meshOptions: LoadFromUrlParams, mesh: NVMesh) => void;
|
|
1788
1790
|
onMeshAdded: () => void;
|
|
@@ -1791,18 +1793,18 @@ declare class Niivue {
|
|
|
1791
1793
|
/**
|
|
1792
1794
|
* callback function to run when the user changes the rotation of the 3D rendering
|
|
1793
1795
|
* @example
|
|
1794
|
-
* niivue.onAzimuthElevationChange = (azimuth, elevation)
|
|
1796
|
+
* niivue.onAzimuthElevationChange = (azimuth, elevation) => {
|
|
1795
1797
|
* console.log('azimuth: ', azimuth)
|
|
1796
1798
|
* console.log('elevation: ', elevation)
|
|
1797
|
-
*
|
|
1799
|
+
* }
|
|
1798
1800
|
*/
|
|
1799
1801
|
onAzimuthElevationChange: (azimuth: number, elevation: number) => void;
|
|
1800
1802
|
/**
|
|
1801
1803
|
* callback function to run when the user changes the clip plane
|
|
1802
1804
|
* @example
|
|
1803
|
-
* niivue.onClipPlaneChange = (clipPlane)
|
|
1805
|
+
* niivue.onClipPlaneChange = (clipPlane) => {
|
|
1804
1806
|
* console.log('clipPlane: ', clipPlane)
|
|
1805
|
-
*
|
|
1807
|
+
* }
|
|
1806
1808
|
*/
|
|
1807
1809
|
onClipPlaneChange: (clipPlane: number[]) => void;
|
|
1808
1810
|
onCustomMeshShaderAdded: (fragmentShaderText: string, name: string) => void;
|
|
@@ -1811,9 +1813,9 @@ declare class Niivue {
|
|
|
1811
1813
|
/**
|
|
1812
1814
|
* callback function to run when the user loads a new NiiVue document
|
|
1813
1815
|
* @example
|
|
1814
|
-
* niivue.onDocumentLoaded = (document)
|
|
1816
|
+
* niivue.onDocumentLoaded = (document) => {
|
|
1815
1817
|
* console.log('document: ', document)
|
|
1816
|
-
*
|
|
1818
|
+
* }
|
|
1817
1819
|
*/
|
|
1818
1820
|
onDocumentLoaded: (document: NVDocument) => void;
|
|
1819
1821
|
document: NVDocument;
|
|
@@ -1903,9 +1905,9 @@ declare class Niivue {
|
|
|
1903
1905
|
currentDrawUndoBitmap: number;
|
|
1904
1906
|
loadingText: string;
|
|
1905
1907
|
/**
|
|
1906
|
-
* @param options
|
|
1908
|
+
* @param options - options object to set modifiable Niivue properties
|
|
1907
1909
|
*/
|
|
1908
|
-
constructor(options?: Partial<
|
|
1910
|
+
constructor(options?: Partial<NVConfigOptions>);
|
|
1909
1911
|
get volumes(): NVImage[];
|
|
1910
1912
|
set volumes(volumes: NVImage[]);
|
|
1911
1913
|
get meshes(): NVMesh[];
|
|
@@ -1918,7 +1920,7 @@ declare class Niivue {
|
|
|
1918
1920
|
* save webgl2 canvas as png format bitmap
|
|
1919
1921
|
* @param filename - filename for screen capture
|
|
1920
1922
|
* @example niivue.saveScene('test.png');
|
|
1921
|
-
* @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}
|
|
1922
1924
|
*/
|
|
1923
1925
|
saveScene(filename?: string): Promise<void>;
|
|
1924
1926
|
/**
|
|
@@ -1927,7 +1929,7 @@ declare class Niivue {
|
|
|
1927
1929
|
* @param isAntiAlias - determines if anti-aliasing is requested (if not specified, AA usage depends on hardware)
|
|
1928
1930
|
* @example niivue = new Niivue().attachTo('gl')
|
|
1929
1931
|
* @example niivue.attachTo('gl')
|
|
1930
|
-
* @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}
|
|
1931
1933
|
*/
|
|
1932
1934
|
attachTo(id: string, isAntiAlias?: null): Promise<this>;
|
|
1933
1935
|
/**
|
|
@@ -1946,7 +1948,7 @@ declare class Niivue {
|
|
|
1946
1948
|
* niivue2 = new Niivue()
|
|
1947
1949
|
* niivue2.syncWith(niivue1)
|
|
1948
1950
|
* @deprecated use broadcastTo instead
|
|
1949
|
-
* @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}
|
|
1950
1952
|
*/
|
|
1951
1953
|
syncWith(otherNV: Niivue, syncOpts?: {
|
|
1952
1954
|
'2d': boolean;
|
|
@@ -1961,7 +1963,7 @@ declare class Niivue {
|
|
|
1961
1963
|
* niivue3 = new Niivue()
|
|
1962
1964
|
* niivue1.broadcastTo(niivue2)
|
|
1963
1965
|
* niivue1.broadcastTo([niivue2, niivue3])
|
|
1964
|
-
* @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}
|
|
1965
1967
|
*/
|
|
1966
1968
|
broadcastTo(otherNV: Niivue | Niivue[], syncOpts?: {
|
|
1967
1969
|
'2d': boolean;
|
|
@@ -2038,7 +2040,7 @@ declare class Niivue {
|
|
|
2038
2040
|
getFileExt(fullname: string, upperCase?: boolean): string;
|
|
2039
2041
|
/**
|
|
2040
2042
|
* Add an image and notify subscribers
|
|
2041
|
-
* @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}
|
|
2042
2044
|
*/
|
|
2043
2045
|
addVolumeFromUrl(imageOptions: ImageFromUrlOptions): Promise<NVImage>;
|
|
2044
2046
|
/**
|
|
@@ -2048,7 +2050,7 @@ declare class Niivue {
|
|
|
2048
2050
|
/**
|
|
2049
2051
|
* Remove volume by url
|
|
2050
2052
|
* @param url - Volume added by url to remove
|
|
2051
|
-
* @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}
|
|
2052
2054
|
*/
|
|
2053
2055
|
removeVolumeByUrl(url: string): void;
|
|
2054
2056
|
readDirectory(directory: FileSystemDirectoryEntry): FileSystemEntry[];
|
|
@@ -2062,28 +2064,28 @@ declare class Niivue {
|
|
|
2062
2064
|
* insert a gap between slices of a mutliplanar view.
|
|
2063
2065
|
* @param pixels - spacing between tiles of multiplanar view
|
|
2064
2066
|
* @example niivue.setMultiplanarPadPixels(4)
|
|
2065
|
-
* @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}
|
|
2066
2068
|
*/
|
|
2067
2069
|
setMultiplanarPadPixels(pixels: number): void;
|
|
2068
2070
|
/**
|
|
2069
2071
|
* control placement of 2D slices.
|
|
2070
2072
|
* @param layout - AUTO: 0, COLUMN: 1, GRID: 2, ROW: 3,
|
|
2071
2073
|
* @example niivue.setMultiplanarLayout(2)
|
|
2072
|
-
* @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}
|
|
2073
2075
|
*/
|
|
2074
2076
|
setMultiplanarLayout(layout: number): void;
|
|
2075
2077
|
/**
|
|
2076
2078
|
* determine if text appears at corner (true) or sides of 2D slice.
|
|
2077
2079
|
* @param isCornerOrientationText - controls position of text
|
|
2078
2080
|
* @example niivue.setCornerOrientationText(true)
|
|
2079
|
-
* @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}
|
|
2080
2082
|
*/
|
|
2081
2083
|
setCornerOrientationText(isCornerOrientationText: boolean): void;
|
|
2082
2084
|
/**
|
|
2083
2085
|
* control whether 2D slices use radiological or neurological convention.
|
|
2084
2086
|
* @param isRadiologicalConvention - new display convention
|
|
2085
|
-
* @example niivue.
|
|
2086
|
-
* @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}
|
|
2087
2089
|
*/
|
|
2088
2090
|
setRadiologicalConvention(isRadiologicalConvention: boolean): void;
|
|
2089
2091
|
/**
|
|
@@ -2091,35 +2093,35 @@ declare class Niivue {
|
|
|
2091
2093
|
* @param options - @see NiiVueOptions
|
|
2092
2094
|
* @param resetBriCon - also reset contrast (default false).
|
|
2093
2095
|
* @example niivue.nv1.setDefaults(opts, true);
|
|
2094
|
-
* @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}
|
|
2095
2097
|
*/
|
|
2096
|
-
setDefaults(options?: Partial<
|
|
2098
|
+
setDefaults(options?: Partial<NVConfigOptions>, resetBriCon?: boolean): void;
|
|
2097
2099
|
/**
|
|
2098
2100
|
* Limit visibility of mesh in front of a 2D image. Requires world-space mode.
|
|
2099
2101
|
* @param meshThicknessOn2D - distance from voxels for clipping mesh. Use Infinity to show entire mesh or 0.0 to hide mesh.
|
|
2100
2102
|
* @example niivue.setMeshThicknessOn2D(42)
|
|
2101
|
-
* @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}
|
|
2102
2104
|
*/
|
|
2103
2105
|
setMeshThicknessOn2D(meshThicknessOn2D: number): void;
|
|
2104
2106
|
/**
|
|
2105
2107
|
* Create a custom multi-slice mosaic (aka lightbox, montage) view.
|
|
2106
2108
|
* @param str - description of mosaic.
|
|
2107
2109
|
* @example niivue.setSliceMosaicString("A 0 20 C 30 S 42")
|
|
2108
|
-
* @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}
|
|
2109
2111
|
*/
|
|
2110
2112
|
setSliceMosaicString(str: string): void;
|
|
2111
2113
|
/**
|
|
2112
2114
|
* control 2D slice view mode.
|
|
2113
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.
|
|
2114
2116
|
* @example niivue.setSliceMM(true)
|
|
2115
|
-
* @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}
|
|
2116
2118
|
*/
|
|
2117
2119
|
setSliceMM(isSliceMM: boolean): void;
|
|
2118
2120
|
/**
|
|
2119
2121
|
* control whether voxel overlays are combined using additive (emission) or traditional (transmission) blending.
|
|
2120
2122
|
* @param isAdditiveBlend - emission (true) or transmission (false) mixing
|
|
2121
2123
|
* @example niivue.isAdditiveBlend(true)
|
|
2122
|
-
* @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}
|
|
2123
2125
|
*/
|
|
2124
2126
|
setAdditiveBlend(isAdditiveBlend: boolean): void;
|
|
2125
2127
|
/**
|
|
@@ -2132,7 +2134,7 @@ declare class Niivue {
|
|
|
2132
2134
|
* Force WebGL canvas to use high resolution display, regardless of browser defaults.
|
|
2133
2135
|
* @param isHighResolutionCapable - allow high-DPI display
|
|
2134
2136
|
* @example niivue.setHighResolutionCapable(true);
|
|
2135
|
-
* @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}
|
|
2136
2138
|
*/
|
|
2137
2139
|
setHighResolutionCapable(isHighResolutionCapable: boolean): void;
|
|
2138
2140
|
/**
|
|
@@ -2140,8 +2142,8 @@ declare class Niivue {
|
|
|
2140
2142
|
* @param volume - the new volume to add to the canvas
|
|
2141
2143
|
* @example
|
|
2142
2144
|
* niivue = new Niivue()
|
|
2143
|
-
* niivue.addVolume(NVImage.loadFromUrl(
|
|
2144
|
-
* @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}
|
|
2145
2147
|
*/
|
|
2146
2148
|
addVolume(volume: NVImage): void;
|
|
2147
2149
|
/**
|
|
@@ -2149,8 +2151,8 @@ declare class Niivue {
|
|
|
2149
2151
|
* @param mesh - the new mesh to add to the canvas
|
|
2150
2152
|
* @example
|
|
2151
2153
|
* niivue = new Niivue()
|
|
2152
|
-
* niivue.addMesh(NVMesh.loadFromUrl(
|
|
2153
|
-
* @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}
|
|
2154
2156
|
*/
|
|
2155
2157
|
addMesh(mesh: NVMesh): void;
|
|
2156
2158
|
/**
|
|
@@ -2166,7 +2168,7 @@ declare class Niivue {
|
|
|
2166
2168
|
/**
|
|
2167
2169
|
* Restore drawing to previous state
|
|
2168
2170
|
* @example niivue.drawUndo();
|
|
2169
|
-
* @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}
|
|
2170
2172
|
*/
|
|
2171
2173
|
drawUndo(): void;
|
|
2172
2174
|
loadDrawing(drawingBitmap: NVImage): boolean;
|
|
@@ -2176,7 +2178,7 @@ declare class Niivue {
|
|
|
2176
2178
|
* @param filename - of NIfTI format drawing
|
|
2177
2179
|
* @param isBinarize - if true will force drawing voxels to be either 0 or 1.
|
|
2178
2180
|
* @example niivue.loadDrawingFromUrl("../images/lesion.nii.gz");
|
|
2179
|
-
* @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}
|
|
2180
2182
|
*/
|
|
2181
2183
|
loadDrawingFromUrl(fnm: string, isBinarize?: boolean): Promise<boolean>;
|
|
2182
2184
|
findOtsu(mlevel?: number): number[];
|
|
@@ -2184,7 +2186,7 @@ declare class Niivue {
|
|
|
2184
2186
|
* remove dark voxels in air
|
|
2185
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.
|
|
2186
2188
|
* @example niivue.drawOtsu(3);
|
|
2187
|
-
* @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}
|
|
2188
2190
|
*/
|
|
2189
2191
|
drawOtsu(levels?: number): void;
|
|
2190
2192
|
/**
|
|
@@ -2192,7 +2194,7 @@ declare class Niivue {
|
|
|
2192
2194
|
* @param level - (1-5) larger values for more preserved voxels
|
|
2193
2195
|
* @param volIndex - volume to dehaze
|
|
2194
2196
|
* @example niivue.removeHaze(3, 0);
|
|
2195
|
-
* @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}
|
|
2196
2198
|
*/
|
|
2197
2199
|
removeHaze(level?: number, volIndex?: number): void;
|
|
2198
2200
|
/**
|
|
@@ -2201,8 +2203,8 @@ declare class Niivue {
|
|
|
2201
2203
|
* @param isSaveDrawing - determines whether drawing or background image is saved
|
|
2202
2204
|
* @param volumeByIndex - determines layer to save (0 for background)
|
|
2203
2205
|
* @param volumeByIndex - determines layer to save (0 for background)
|
|
2204
|
-
* @example niivue.saveImage(
|
|
2205
|
-
* @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}
|
|
2206
2208
|
*/
|
|
2207
2209
|
saveImage(options?: SaveImageOptions): Uint8Array | boolean;
|
|
2208
2210
|
getMeshIndexByID(id: string | number): number;
|
|
@@ -2212,7 +2214,7 @@ declare class Niivue {
|
|
|
2212
2214
|
* @param key - attribute to change
|
|
2213
2215
|
* @param value - for attribute
|
|
2214
2216
|
* @example niivue.setMeshProperty(niivue.meshes[0].id, 'fiberLength', 42)
|
|
2215
|
-
* @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}
|
|
2216
2218
|
*/
|
|
2217
2219
|
setMeshProperty(id: number, key: keyof NVMesh, val: number): void;
|
|
2218
2220
|
/**
|
|
@@ -2230,7 +2232,7 @@ declare class Niivue {
|
|
|
2230
2232
|
* reverse triangle winding of mesh (swap front and back faces)
|
|
2231
2233
|
* @param id - identity of mesh to change
|
|
2232
2234
|
* @example niivue.reverseFaces(niivue.meshes[0].id)
|
|
2233
|
-
* @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}
|
|
2234
2236
|
*/
|
|
2235
2237
|
reverseFaces(mesh: number): void;
|
|
2236
2238
|
/**
|
|
@@ -2240,7 +2242,7 @@ declare class Niivue {
|
|
|
2240
2242
|
* @param key - attribute to change
|
|
2241
2243
|
* @param value - for attribute
|
|
2242
2244
|
* @example niivue.setMeshLayerProperty(niivue.meshes[0].id, 0, 'frame4D', 22)
|
|
2243
|
-
* @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}
|
|
2244
2246
|
*/
|
|
2245
2247
|
setMeshLayerProperty(mesh: number, layer: number, key: keyof NVMeshLayer, val: number): void;
|
|
2246
2248
|
/**
|
|
@@ -2252,7 +2254,7 @@ declare class Niivue {
|
|
|
2252
2254
|
/**
|
|
2253
2255
|
* set rotation of 3D render view
|
|
2254
2256
|
* @example niivue.setRenderAzimuthElevation(45, 15)
|
|
2255
|
-
* @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}
|
|
2256
2258
|
*/
|
|
2257
2259
|
setRenderAzimuthElevation(a: number, e: number): void;
|
|
2258
2260
|
/**
|
|
@@ -2280,7 +2282,7 @@ declare class Niivue {
|
|
|
2280
2282
|
* @example
|
|
2281
2283
|
* niivue = new Niivue()
|
|
2282
2284
|
* niivue.removeVolume(this.volumes[3])
|
|
2283
|
-
* @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}
|
|
2284
2286
|
*/
|
|
2285
2287
|
removeVolume(volume: NVImage): void;
|
|
2286
2288
|
/**
|
|
@@ -2294,7 +2296,7 @@ declare class Niivue {
|
|
|
2294
2296
|
* @example
|
|
2295
2297
|
* niivue = new Niivue()
|
|
2296
2298
|
* niivue.removeMesh(this.meshes[3])
|
|
2297
|
-
* @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}
|
|
2298
2300
|
*/
|
|
2299
2301
|
removeMesh(mesh: NVMesh): void;
|
|
2300
2302
|
/**
|
|
@@ -2354,7 +2356,7 @@ declare class Niivue {
|
|
|
2354
2356
|
* @example
|
|
2355
2357
|
* niivue = new Niivue()
|
|
2356
2358
|
* niivue.setClipPlane([42, 42])
|
|
2357
|
-
* @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}
|
|
2358
2360
|
*/
|
|
2359
2361
|
setClipPlane(depthAzimuthElevation: number[]): void;
|
|
2360
2362
|
/**
|
|
@@ -2363,13 +2365,13 @@ declare class Niivue {
|
|
|
2363
2365
|
* @example
|
|
2364
2366
|
* niivue = new Niivue()
|
|
2365
2367
|
* niivue.setCrosshairColor([0, 1, 0, 0.5]) // set crosshair to transparent green
|
|
2366
|
-
* @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}
|
|
2367
2369
|
*/
|
|
2368
2370
|
setCrosshairColor(color: number[]): void;
|
|
2369
2371
|
/**
|
|
2370
2372
|
* set thickness of crosshair
|
|
2371
2373
|
* @example niivue.crosshairWidth(2)
|
|
2372
|
-
* @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}
|
|
2373
2375
|
*/
|
|
2374
2376
|
setCrosshairWidth(crosshairWidth: number): void;
|
|
2375
2377
|
setDrawColormap(name: string): void;
|
|
@@ -2377,7 +2379,7 @@ declare class Niivue {
|
|
|
2377
2379
|
* does dragging over a 2D slice create a drawing?
|
|
2378
2380
|
* @param trueOrFalse - enabled (true) or not (false)
|
|
2379
2381
|
* @example niivue.setDrawingEnabled(true)
|
|
2380
|
-
* @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}
|
|
2381
2383
|
*/
|
|
2382
2384
|
setDrawingEnabled(trueOrFalse: boolean): void;
|
|
2383
2385
|
/**
|
|
@@ -2385,14 +2387,14 @@ declare class Niivue {
|
|
|
2385
2387
|
* @param penValue - sets the color of the pen
|
|
2386
2388
|
* @param isFilledPen - determines if dragging creates flood-filled shape
|
|
2387
2389
|
* @example niivue.setPenValue(1, true)
|
|
2388
|
-
* @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}
|
|
2389
2391
|
*/
|
|
2390
2392
|
setPenValue(penValue: number, isFilledPen?: boolean): void;
|
|
2391
2393
|
/**
|
|
2392
2394
|
* control whether drawing is transparent (0), opaque (1) or translucent (between 0 and 1).
|
|
2393
2395
|
* @param opacity - translucency of drawing
|
|
2394
2396
|
* @example niivue.setDrawOpacity(0.7)
|
|
2395
|
-
* @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}
|
|
2396
2398
|
*/
|
|
2397
2399
|
setDrawOpacity(opacity: number): void;
|
|
2398
2400
|
/**
|
|
@@ -2401,7 +2403,7 @@ declare class Niivue {
|
|
|
2401
2403
|
* @example
|
|
2402
2404
|
* niivue = new Niivue()
|
|
2403
2405
|
* niivue.setSelectionBoxColor([0, 1, 0, 0.5]) // set to transparent green
|
|
2404
|
-
* @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}
|
|
2405
2407
|
*/
|
|
2406
2408
|
setSelectionBoxColor(color: number[]): void;
|
|
2407
2409
|
sliceScroll2D(posChange: number, x: number, y: number, isDelta?: boolean): void;
|
|
@@ -2411,7 +2413,7 @@ declare class Niivue {
|
|
|
2411
2413
|
* @example
|
|
2412
2414
|
* niivue = new Niivue()
|
|
2413
2415
|
* niivue.setSliceType(Niivue.sliceTypeMultiplanar)
|
|
2414
|
-
* @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}
|
|
2415
2417
|
*/
|
|
2416
2418
|
setSliceType(st: SLICE_TYPE): this;
|
|
2417
2419
|
/**
|
|
@@ -2421,7 +2423,7 @@ declare class Niivue {
|
|
|
2421
2423
|
* @example
|
|
2422
2424
|
* niivue = new Niivue()
|
|
2423
2425
|
* niivue.setOpacity(0, 0.5) // make the first volume transparent
|
|
2424
|
-
* @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}
|
|
2425
2427
|
*/
|
|
2426
2428
|
setOpacity(volIdx: number, newOpacity: number): void;
|
|
2427
2429
|
/**
|
|
@@ -2429,7 +2431,7 @@ declare class Niivue {
|
|
|
2429
2431
|
* @param scale - the new scale value
|
|
2430
2432
|
* @example
|
|
2431
2433
|
* niivue.setScale(2) // zoom some
|
|
2432
|
-
* @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}
|
|
2433
2435
|
*/
|
|
2434
2436
|
setScale(scale: number): void;
|
|
2435
2437
|
/**
|
|
@@ -2437,7 +2439,7 @@ declare class Niivue {
|
|
|
2437
2439
|
* @param color - the new color. expects an array of RGBA values. values can range from 0 to 1
|
|
2438
2440
|
* @example
|
|
2439
2441
|
* niivue.setClipPlaneColor([1, 1, 1, 0.5]) // white, transparent
|
|
2440
|
-
* @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}
|
|
2441
2443
|
*/
|
|
2442
2444
|
setClipPlaneColor(color: number[]): void;
|
|
2443
2445
|
/**
|
|
@@ -2445,7 +2447,7 @@ declare class Niivue {
|
|
|
2445
2447
|
* @param gradientAmount - amount of matcap (0..1), default 0 (matte, surface normal does not influence color)
|
|
2446
2448
|
* @example
|
|
2447
2449
|
* niivue.setVolumeRenderIllumination(0.6);
|
|
2448
|
-
* @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}
|
|
2449
2451
|
*/
|
|
2450
2452
|
setVolumeRenderIllumination(gradientAmount?: number): Promise<void>;
|
|
2451
2453
|
overlayRGBA(volume: NVImage): Uint8ClampedArray;
|
|
@@ -2467,7 +2469,7 @@ declare class Niivue {
|
|
|
2467
2469
|
/**
|
|
2468
2470
|
* Loads an NVDocument
|
|
2469
2471
|
* @returns Niivue instance
|
|
2470
|
-
* @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}
|
|
2471
2473
|
*/
|
|
2472
2474
|
loadDocument(document: NVDocument): this;
|
|
2473
2475
|
/**
|
|
@@ -2476,8 +2478,8 @@ declare class Niivue {
|
|
|
2476
2478
|
* @param esm - bundled version of NiiVue
|
|
2477
2479
|
* @example
|
|
2478
2480
|
* const javascript = this.generateLoadDocumentJavaScript("gl1");
|
|
2479
|
-
* const html =
|
|
2480
|
-
|
|
2481
|
+
* const html = `<html><body><canvas id="gl1"></canvas><script type="module" async>
|
|
2482
|
+
${javascript}</script></body></html>`;
|
|
2481
2483
|
*/
|
|
2482
2484
|
generateLoadDocumentJavaScript(canvasId: string, esm: string): string;
|
|
2483
2485
|
/**
|
|
@@ -2486,8 +2488,8 @@ declare class Niivue {
|
|
|
2486
2488
|
* @param esm - bundled version of NiiVue
|
|
2487
2489
|
* @returns HTML with javascript of the current scene
|
|
2488
2490
|
* @example
|
|
2489
|
-
* const template =
|
|
2490
|
-
* %%javascript%%</script></body></html
|
|
2491
|
+
* const template = `<html><body><canvas id="gl1"></canvas><script type="module" async>
|
|
2492
|
+
* %%javascript%%</script></body></html>`;
|
|
2491
2493
|
* nv1.generateHTML("page.html", esm);
|
|
2492
2494
|
*/
|
|
2493
2495
|
generateHTML(canvasId: string | undefined, esm: string): string;
|
|
@@ -2507,7 +2509,7 @@ declare class Niivue {
|
|
|
2507
2509
|
* @param fileName - the name of the document storing the scene
|
|
2508
2510
|
* @example
|
|
2509
2511
|
* niivue.saveDocument("niivue.basic.nvd")
|
|
2510
|
-
* @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}
|
|
2511
2513
|
*/
|
|
2512
2514
|
saveDocument(fileName?: string): Promise<void>;
|
|
2513
2515
|
/**
|
|
@@ -2516,13 +2518,13 @@ declare class Niivue {
|
|
|
2516
2518
|
* @returns returns the Niivue instance
|
|
2517
2519
|
* @example
|
|
2518
2520
|
* niivue = new Niivue()
|
|
2519
|
-
* niivue.loadVolumes([
|
|
2520
|
-
* @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}
|
|
2521
2523
|
*/
|
|
2522
2524
|
loadVolumes(volumeList: ImageFromUrlOptions[]): Promise<this>;
|
|
2523
2525
|
/**
|
|
2524
2526
|
* Add mesh and notify subscribers
|
|
2525
|
-
* @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}
|
|
2526
2528
|
*/
|
|
2527
2529
|
addMeshFromUrl(meshOptions: LoadFromUrlParams): Promise<NVMesh>;
|
|
2528
2530
|
/**
|
|
@@ -2531,27 +2533,27 @@ declare class Niivue {
|
|
|
2531
2533
|
* @returns Niivue instance
|
|
2532
2534
|
* @example
|
|
2533
2535
|
* niivue = new Niivue()
|
|
2534
|
-
* niivue.loadMeshes([
|
|
2535
|
-
* @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}
|
|
2536
2538
|
*/
|
|
2537
2539
|
loadMeshes(meshList: LoadFromUrlParams[]): Promise<this>;
|
|
2538
2540
|
/**
|
|
2539
2541
|
* load a connectome specified by url
|
|
2540
2542
|
* @returns Niivue instance
|
|
2541
|
-
* @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}
|
|
2542
2544
|
*/
|
|
2543
2545
|
loadConnectomeFromUrl(url: string, headers?: {}): Promise<this>;
|
|
2544
2546
|
/**
|
|
2545
2547
|
* load a connectome specified by url
|
|
2546
2548
|
* @returns Niivue instance
|
|
2547
|
-
* @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}
|
|
2548
2550
|
*/
|
|
2549
2551
|
loadFreeSurferConnectomeFromUrl(url: string, headers?: {}): Promise<this>;
|
|
2550
2552
|
/**
|
|
2551
2553
|
* load a connectome specified by json
|
|
2552
2554
|
* @param connectome - freesurfer model
|
|
2553
2555
|
* @returns Niivue instance
|
|
2554
|
-
* @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}
|
|
2555
2557
|
*/
|
|
2556
2558
|
loadFreeSurferConnectome(json: FreeSurferConnectome): Promise<this>;
|
|
2557
2559
|
handleNodeAdded(event: {
|
|
@@ -2564,13 +2566,13 @@ declare class Niivue {
|
|
|
2564
2566
|
* load a connectome specified by json
|
|
2565
2567
|
* @param connectome - model
|
|
2566
2568
|
* @returns Niivue instance
|
|
2567
|
-
* @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}
|
|
2568
2570
|
*/
|
|
2569
2571
|
loadConnectome(json: Connectome | LegacyConnectome): this;
|
|
2570
2572
|
/**
|
|
2571
2573
|
* generate a blank canvas for the pen tool
|
|
2572
2574
|
* @example niivue.createEmptyDrawing()
|
|
2573
|
-
* @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}
|
|
2574
2576
|
*/
|
|
2575
2577
|
createEmptyDrawing(): void;
|
|
2576
2578
|
r16Tex(texID: WebGLTexture | null, activeID: number, dims: number[], img16: Int16Array): WebGLTexture;
|
|
@@ -2578,7 +2580,7 @@ declare class Niivue {
|
|
|
2578
2580
|
* dilate drawing so all voxels are colored.
|
|
2579
2581
|
* works on drawing with multiple colors
|
|
2580
2582
|
* @example niivue.drawGrowCut();
|
|
2581
|
-
* @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}
|
|
2582
2584
|
*/
|
|
2583
2585
|
drawGrowCut(): void;
|
|
2584
2586
|
drawPt(x: number, y: number, z: number, penValue: number): void;
|
|
@@ -2590,14 +2592,14 @@ declare class Niivue {
|
|
|
2590
2592
|
/**
|
|
2591
2593
|
* close drawing: make sure you have saved any changes before calling this!
|
|
2592
2594
|
* @example niivue.closeDrawing();
|
|
2593
|
-
* @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}
|
|
2594
2596
|
*/
|
|
2595
2597
|
closeDrawing(): void;
|
|
2596
2598
|
/**
|
|
2597
2599
|
* copy drawing bitmap from CPU to GPU storage and redraw the screen
|
|
2598
2600
|
* @param isForceRedraw - refreshes scene immediately (default true)
|
|
2599
2601
|
* @example niivue.refreshDrawing();
|
|
2600
|
-
* @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}
|
|
2601
2603
|
*/
|
|
2602
2604
|
refreshDrawing(isForceRedraw?: boolean): void;
|
|
2603
2605
|
r8Tex(texID: WebGLTexture | null, activeID: number, dims: number[], isInit?: boolean): WebGLTexture | null;
|
|
@@ -2611,7 +2613,7 @@ declare class Niivue {
|
|
|
2611
2613
|
* @param name - name of matcap to load ("Shiny", "Cortex", "Cream")
|
|
2612
2614
|
* @example
|
|
2613
2615
|
* niivue.loadMatCapTexture("Cortex");
|
|
2614
|
-
* @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}
|
|
2615
2617
|
*/
|
|
2616
2618
|
loadMatCapTexture(bmpUrl: string): Promise<WebGLTexture | null>;
|
|
2617
2619
|
initFontMets(): void;
|
|
@@ -2620,7 +2622,7 @@ declare class Niivue {
|
|
|
2620
2622
|
* @param name - name of matcap to load ("Roboto", "Garamond", "Ubuntu")
|
|
2621
2623
|
* @example
|
|
2622
2624
|
* niivue.loadMatCapTexture("Cortex");
|
|
2623
|
-
* @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}
|
|
2624
2626
|
*/
|
|
2625
2627
|
loadFont(fontSheetUrl?: any, metricsUrl?: {
|
|
2626
2628
|
atlas: {
|
|
@@ -2671,7 +2673,7 @@ declare class Niivue {
|
|
|
2671
2673
|
* @param id - id of mesh to change
|
|
2672
2674
|
* @param meshShaderNameOrNumber - identify shader for usage
|
|
2673
2675
|
* @example niivue.setMeshShader('toon');
|
|
2674
|
-
* @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}
|
|
2675
2677
|
*/
|
|
2676
2678
|
setMeshShader(id: number, meshShaderNameOrNumber?: number): void;
|
|
2677
2679
|
/**
|
|
@@ -2690,7 +2692,7 @@ declare class Niivue {
|
|
|
2690
2692
|
* @param fragmentShaderText - custom fragment shader.
|
|
2691
2693
|
* @param ame - title for new shader.
|
|
2692
2694
|
* @returns index of the new shader (for setMeshShader)
|
|
2693
|
-
* @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}
|
|
2694
2696
|
*/
|
|
2695
2697
|
setCustomMeshShader(fragmentShaderText?: string, name?: string): number;
|
|
2696
2698
|
/**
|
|
@@ -2698,7 +2700,7 @@ declare class Niivue {
|
|
|
2698
2700
|
* @param sort - sort output alphabetically
|
|
2699
2701
|
* @returns list of available mesh shader names
|
|
2700
2702
|
* @example niivue.meshShaderNames();
|
|
2701
|
-
* @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}
|
|
2702
2704
|
*/
|
|
2703
2705
|
meshShaderNames(sort?: boolean): string[];
|
|
2704
2706
|
initRenderShader(shader: Shader, gradientAmount?: number): void;
|
|
@@ -2709,7 +2711,7 @@ declare class Niivue {
|
|
|
2709
2711
|
* @example
|
|
2710
2712
|
* niivue = new Niivue()
|
|
2711
2713
|
* niivue.updateGLVolume()
|
|
2712
|
-
* @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}
|
|
2713
2715
|
*/
|
|
2714
2716
|
updateGLVolume(): void;
|
|
2715
2717
|
/**
|
|
@@ -2718,7 +2720,7 @@ declare class Niivue {
|
|
|
2718
2720
|
* @param masks - are optional binary images to filter voxles
|
|
2719
2721
|
* @returns numeric values to describe image
|
|
2720
2722
|
* @example niivue.getDescriptives(0);
|
|
2721
|
-
* @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}
|
|
2722
2724
|
*/
|
|
2723
2725
|
getDescriptives(layer?: number, masks?: never[], drawingIsMask?: boolean): Descriptive;
|
|
2724
2726
|
refreshLayers(overlayItem: NVImage, layer: number): void;
|
|
@@ -2729,14 +2731,14 @@ declare class Niivue {
|
|
|
2729
2731
|
* @example
|
|
2730
2732
|
* niivue = new Niivue()
|
|
2731
2733
|
* colormaps = niivue.colormaps()
|
|
2732
|
-
* @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}
|
|
2733
2735
|
*/
|
|
2734
2736
|
colormaps(): string[];
|
|
2735
2737
|
/**
|
|
2736
2738
|
* create a new colormap
|
|
2737
2739
|
* @param key - name of new colormap
|
|
2738
2740
|
* @param colormap - properties (Red, Green, Blue, Alpha and Indices)
|
|
2739
|
-
* @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}
|
|
2740
2742
|
*/
|
|
2741
2743
|
addColormap(key: string, cmap: ColorMap): void;
|
|
2742
2744
|
/**
|
|
@@ -2745,13 +2747,37 @@ declare class Niivue {
|
|
|
2745
2747
|
* @param colormap - the name of the colormap to use
|
|
2746
2748
|
* @example
|
|
2747
2749
|
* niivue.setColormap(niivue.volumes[0].id,, 'red')
|
|
2748
|
-
* @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}
|
|
2749
2751
|
*/
|
|
2750
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>;
|
|
2751
2777
|
/**
|
|
2752
2778
|
* darken crevices and brighten corners when 3D rendering drawings.
|
|
2753
2779
|
* @param amount - amount of ambient occlusion (default 0.4)
|
|
2754
|
-
* @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}
|
|
2755
2781
|
*/
|
|
2756
2782
|
setRenderDrawAmbientOcclusion(ao: number): void;
|
|
2757
2783
|
setColorMap(id: string, colormap: string): void;
|
|
@@ -2762,7 +2788,7 @@ declare class Niivue {
|
|
|
2762
2788
|
* @example
|
|
2763
2789
|
* niivue = new Niivue()
|
|
2764
2790
|
* niivue.setColormapNegative(niivue.volumes[1].id,"winter");
|
|
2765
|
-
* @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}
|
|
2766
2792
|
*/
|
|
2767
2793
|
setColormapNegative(id: string, colormapNegative: string): void;
|
|
2768
2794
|
/**
|
|
@@ -2771,15 +2797,15 @@ declare class Niivue {
|
|
|
2771
2797
|
* @param idModulation - the ID of the NVImage that controls bias (empty string to disable modulation)
|
|
2772
2798
|
* @param modulateAlpha - does the modulation influence alpha transparency (values greater than 1).
|
|
2773
2799
|
* @example niivue.setModulationImage(niivue.volumes[0].id, niivue.volumes[1].id);
|
|
2774
|
-
* @see {@link https://niivue.github.io/niivue/features/modulate.html|live demo scalar usage}
|
|
2775
|
-
* @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}
|
|
2776
2802
|
*/
|
|
2777
2803
|
setModulationImage(idTarget: string, idModulation: string, modulateAlpha?: number): void;
|
|
2778
2804
|
/**
|
|
2779
2805
|
* adjust screen gamma. Low values emphasize shadows but can appear flat, high gamma hides shadow details.
|
|
2780
2806
|
* @param gamma - selects luminance, default is 1
|
|
2781
2807
|
* @example niivue.setGamma(1.0);
|
|
2782
|
-
* @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}
|
|
2783
2809
|
*/
|
|
2784
2810
|
setGamma(gamma?: number): void;
|
|
2785
2811
|
/** Load all volumes for image opened with `limitFrames4D`, the user can also click the `...` on a 4D timeline to load deferred volumes
|
|
@@ -2791,7 +2817,7 @@ declare class Niivue {
|
|
|
2791
2817
|
* @param id - the ID of the 4D NVImage
|
|
2792
2818
|
* @param frame4D - frame to display (indexed from zero)
|
|
2793
2819
|
* @example nv1.setFrame4D(nv1.volumes[0].id, 42);
|
|
2794
|
-
* @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}
|
|
2795
2821
|
*/
|
|
2796
2822
|
setFrame4D(id: string, frame4D: number): void;
|
|
2797
2823
|
/**
|
|
@@ -2799,7 +2825,7 @@ declare class Niivue {
|
|
|
2799
2825
|
* @param id - the ID of the 4D NVImage
|
|
2800
2826
|
* @returns currently selected volume (indexed from 0)
|
|
2801
2827
|
* @example nv1.getFrame4D(nv1.volumes[0].id);
|
|
2802
|
-
* @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}
|
|
2803
2829
|
*/
|
|
2804
2830
|
getFrame4D(id: string): number;
|
|
2805
2831
|
colormapFromKey(name: string): ColorMap;
|
|
@@ -2849,7 +2875,7 @@ declare class Niivue {
|
|
|
2849
2875
|
* select between nearest and linear interpolation for voxel based images
|
|
2850
2876
|
* @param isNearest - whether nearest neighbor interpolation is used, else linear interpolation
|
|
2851
2877
|
* @example niivue.setInterpolation(true);
|
|
2852
|
-
* @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}
|
|
2853
2879
|
*/
|
|
2854
2880
|
setInterpolation(isNearest: boolean): void;
|
|
2855
2881
|
calculateMvpMatrix2D(leftTopWidthHeight: number[], mn: vec3, mx: vec3, clipTolerance: number | undefined, clipDepth: number | undefined, azimuth: number | undefined, elevation: number | undefined, isRadiolgical: boolean): MvpMatrix2D;
|
|
@@ -2897,7 +2923,7 @@ declare class Niivue {
|
|
|
2897
2923
|
* @param y - translate posterior (-) or +anterior (+)
|
|
2898
2924
|
* @param z - translate inferior (-) or superior (+)
|
|
2899
2925
|
* @example niivue.moveCrosshairInVox(1, 0, 0)
|
|
2900
|
-
* @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}
|
|
2901
2927
|
*/
|
|
2902
2928
|
moveCrosshairInVox(x: number, y: number, z: number): void;
|
|
2903
2929
|
frac2mm(frac: vec3, volIdx?: number, isForceSliceMM?: boolean): vec4;
|
|
@@ -2915,7 +2941,7 @@ declare class Niivue {
|
|
|
2915
2941
|
* display a lightbox or montage view
|
|
2916
2942
|
* @param mosaicStr - specifies orientation (A,C,S) and location of slices.
|
|
2917
2943
|
* @example niivue.setSliceMosaicString("A -10 0 20");
|
|
2918
|
-
* @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}
|
|
2919
2945
|
*/
|
|
2920
2946
|
drawMosaic(mosaicStr: string): void;
|
|
2921
2947
|
drawSceneCore(): string | void;
|
|
@@ -2924,4 +2950,4 @@ declare class Niivue {
|
|
|
2924
2950
|
set gl(gl: WebGL2RenderingContext | null);
|
|
2925
2951
|
}
|
|
2926
2952
|
|
|
2927
|
-
export { type Connectome, type ConnectomeOptions, DEFAULT_OPTIONS, DRAG_MODE, type DocumentData, type ExportDocumentData, LabelLineTerminator, LabelTextAlignment, type LegacyConnectome, type LegacyNodes, MULTIPLANAR_TYPE, type NVConnectomeEdge, type NVConnectomeNode, NVController, NVDocument, NVImage, NVImageFromUrlOptions, NVLabel3D, NVLabel3DStyle, NVMesh, NVMeshFromUrlOptions, NVMeshLoaders, NVUtilities, type NiftiHeader, Niivue, type Point, SLICE_TYPE, type Volume, cmapper, ColorTables as colortables };
|
|
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 };
|