@niivue/niivue 0.40.0 → 0.41.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 +25 -17
- package/build/index.js +182 -122
- package/build/index.js.map +1 -1
- package/build/index.min.js +1 -1
- package/package.json +6 -5
- package/src/colortables.ts +1 -1
- package/src/index.html +1 -1
- package/src/niivue/index.ts +35 -11
- package/src/nvdocument.ts +3 -5
- package/src/nvimage/index.ts +2 -13
- package/src/nvimage/utils.ts +0 -8
- package/src/nvmesh-loaders.ts +94 -44
- package/src/nvmesh-types.ts +2 -2
- package/src/nvmesh.ts +40 -35
- package/src/shader-srcs.ts +21 -31
package/build/index.d.ts
CHANGED
|
@@ -313,7 +313,7 @@ type MGH = AnyNumberArray | {
|
|
|
313
313
|
colormapLabel: LUT;
|
|
314
314
|
};
|
|
315
315
|
type X3D = {
|
|
316
|
-
positions:
|
|
316
|
+
positions: Float32Array;
|
|
317
317
|
indices: Int32Array;
|
|
318
318
|
rgba255: number[];
|
|
319
319
|
};
|
|
@@ -346,7 +346,7 @@ type NVMeshLayer = {
|
|
|
346
346
|
frame4D: number;
|
|
347
347
|
nFrame4D: number;
|
|
348
348
|
values: number[];
|
|
349
|
-
|
|
349
|
+
outlineBorder?: number;
|
|
350
350
|
isTransparentBelowCalMin?: boolean;
|
|
351
351
|
alphaThreshold: boolean;
|
|
352
352
|
base64?: string;
|
|
@@ -550,7 +550,6 @@ type ImageFromUrlOptions = {
|
|
|
550
550
|
cal_max?: number;
|
|
551
551
|
trustCalMinMax?: boolean;
|
|
552
552
|
percentileFrac?: number;
|
|
553
|
-
visible?: boolean;
|
|
554
553
|
useQFormNotSForm?: boolean;
|
|
555
554
|
alphaThreshold?: boolean;
|
|
556
555
|
colormapNegative?: string;
|
|
@@ -577,7 +576,6 @@ type ImageFromFileOptions = {
|
|
|
577
576
|
trustCalMinMax?: boolean;
|
|
578
577
|
percentileFrac?: number;
|
|
579
578
|
ignoreZeroVoxels?: boolean;
|
|
580
|
-
visible?: boolean;
|
|
581
579
|
useQFormNotSForm?: boolean;
|
|
582
580
|
colormapNegative?: string;
|
|
583
581
|
imageType?: ImageType;
|
|
@@ -594,7 +592,6 @@ type ImageFromBase64 = {
|
|
|
594
592
|
trustCalMinMax?: boolean;
|
|
595
593
|
percentileFrac?: number;
|
|
596
594
|
ignoreZeroVoxels?: boolean;
|
|
597
|
-
visible?: boolean;
|
|
598
595
|
};
|
|
599
596
|
type ImageMetadata = {
|
|
600
597
|
id: string;
|
|
@@ -609,7 +606,7 @@ type ImageMetadata = {
|
|
|
609
606
|
dt: number;
|
|
610
607
|
bpv: number;
|
|
611
608
|
};
|
|
612
|
-
declare const NVImageFromUrlOptions: (url: string, urlImageData?: string, name?: string, colormap?: string, opacity?: number, cal_min?: number, cal_max?: number, trustCalMinMax?: boolean, percentileFrac?: number, ignoreZeroVoxels?: boolean,
|
|
609
|
+
declare const NVImageFromUrlOptions: (url: string, urlImageData?: string, name?: string, colormap?: string, opacity?: number, cal_min?: number, cal_max?: number, trustCalMinMax?: boolean, percentileFrac?: number, ignoreZeroVoxels?: boolean, useQFormNotSForm?: boolean, colormapNegative?: string, frame4D?: number, imageType?: ImageType, cal_minNeg?: number, cal_maxNeg?: number, colorbarVisible?: boolean, alphaThreshold?: boolean, colormapLabel?: string[]) => ImageFromUrlOptions;
|
|
613
610
|
|
|
614
611
|
/**
|
|
615
612
|
* a NVImage encapsulates some images data and provides methods to query and operate on images
|
|
@@ -633,7 +630,6 @@ declare class NVImage {
|
|
|
633
630
|
cal_minNeg: number;
|
|
634
631
|
cal_maxNeg: number;
|
|
635
632
|
colorbarVisible: boolean;
|
|
636
|
-
visible: boolean;
|
|
637
633
|
modulationImage: number | null;
|
|
638
634
|
modulateAlpha: number;
|
|
639
635
|
series: any;
|
|
@@ -708,7 +704,6 @@ declare class NVImage {
|
|
|
708
704
|
* @param trustCalMinMax - whether or not to trust cal_min and cal_max from the nifti header (trusting results in faster loading)
|
|
709
705
|
* @param percentileFrac - the percentile to use for setting the robust range of the display values (smart intensity setting for images with large ranges)
|
|
710
706
|
* @param ignoreZeroVoxels - whether or not to ignore zero voxels in setting the robust range of display values
|
|
711
|
-
* @param visible - whether or not this image is to be visible
|
|
712
707
|
* @param useQFormNotSForm - give precedence to QForm (Quaternion) or SForm (Matrix)
|
|
713
708
|
* @param colormapNegative - a color map to use for symmetrical negative intensities
|
|
714
709
|
* @param frame4D - volume displayed, 0 indexed, must be less than nFrame4D
|
|
@@ -724,7 +719,7 @@ declare class NVImage {
|
|
|
724
719
|
* @param colorbarVisible - TODO
|
|
725
720
|
* @param colormapLabel - TODO
|
|
726
721
|
*/
|
|
727
|
-
constructor(dataBuffer?: ArrayBuffer | ArrayBuffer[] | null, name?: string, colormap?: string, opacity?: number, pairedImgData?: ArrayBuffer | null, cal_min?: number, cal_max?: number, trustCalMinMax?: boolean, percentileFrac?: number, ignoreZeroVoxels?: boolean,
|
|
722
|
+
constructor(dataBuffer?: ArrayBuffer | ArrayBuffer[] | null, name?: string, colormap?: string, opacity?: number, pairedImgData?: ArrayBuffer | null, cal_min?: number, cal_max?: number, trustCalMinMax?: boolean, percentileFrac?: number, ignoreZeroVoxels?: boolean, useQFormNotSForm?: boolean, colormapNegative?: string, frame4D?: number, imageType?: ImageType, cal_minNeg?: number, cal_maxNeg?: number, colorbarVisible?: boolean, colormapLabel?: LUT | null);
|
|
728
723
|
computeObliqueAngle(mtx44: mat4): number;
|
|
729
724
|
calculateOblique(): void;
|
|
730
725
|
THD_daxes_to_NIFTI(xyzDelta: number[], xyzOrigin: number[], orientSpecific: number[]): void;
|
|
@@ -763,7 +758,7 @@ declare class NVImage {
|
|
|
763
758
|
* factory function to load and return a new NVImage instance from a given URL
|
|
764
759
|
* @returns NVImage instance
|
|
765
760
|
*/
|
|
766
|
-
static loadFromUrl({ url, urlImgData, headers, name, colormap, opacity, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels,
|
|
761
|
+
static loadFromUrl({ url, urlImgData, headers, name, colormap, opacity, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels, useQFormNotSForm, colormapNegative, frame4D, isManifest, limitFrames4D, imageType, colorbarVisible }?: Partial<Omit<ImageFromUrlOptions, 'url'>> & {
|
|
767
762
|
url?: string | Uint8Array | ArrayBuffer;
|
|
768
763
|
}): Promise<NVImage>;
|
|
769
764
|
static readFileAsync(file: File, bytesToLoad?: number): Promise<ArrayBuffer>;
|
|
@@ -771,7 +766,7 @@ declare class NVImage {
|
|
|
771
766
|
* factory function to load and return a new NVImage instance from a file in the browser
|
|
772
767
|
*/
|
|
773
768
|
static loadFromFile({ file, // file can be an array of file objects or a single file object
|
|
774
|
-
name, colormap, opacity, urlImgData, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels,
|
|
769
|
+
name, colormap, opacity, urlImgData, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels, useQFormNotSForm, colormapNegative, frame4D, limitFrames4D, imageType }: ImageFromFileOptions): Promise<NVImage>;
|
|
775
770
|
/**
|
|
776
771
|
* factory function to load and return a new NVImage instance from a base64 encoded string
|
|
777
772
|
*
|
|
@@ -779,7 +774,7 @@ declare class NVImage {
|
|
|
779
774
|
* @example
|
|
780
775
|
* myImage = NVImage.loadFromBase64('SomeBase64String')
|
|
781
776
|
*/
|
|
782
|
-
static loadFromBase64({ base64, name, colormap, opacity, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels
|
|
777
|
+
static loadFromBase64({ base64, name, colormap, opacity, cal_min, cal_max, trustCalMinMax, percentileFrac, ignoreZeroVoxels }: ImageFromBase64): NVImage;
|
|
783
778
|
/**
|
|
784
779
|
* make a clone of a NVImage instance and return a new NVImage
|
|
785
780
|
* @returns NVImage instance
|
|
@@ -918,7 +913,7 @@ type NVConfigOptions = {
|
|
|
918
913
|
longTouchTimeout: number;
|
|
919
914
|
keyDebounceTime: number;
|
|
920
915
|
isNearestInterpolation: boolean;
|
|
921
|
-
|
|
916
|
+
atlasOutline: number;
|
|
922
917
|
isRuler: boolean;
|
|
923
918
|
isColorbar: boolean;
|
|
924
919
|
isOrientCube: boolean;
|
|
@@ -1358,7 +1353,7 @@ declare class NVMeshLoaders {
|
|
|
1358
1353
|
static readTCK(buffer: ArrayBuffer): TCK;
|
|
1359
1354
|
static readTRK(buffer: ArrayBuffer): TRK;
|
|
1360
1355
|
static readTxtVTK(buffer: ArrayBuffer): VTK;
|
|
1361
|
-
static readLayer(name: string | undefined, buffer: ArrayBuffer, nvmesh: NVMesh, opacity?: number, colormap?: string, colormapNegative?: string, useNegativeCmap?: boolean, cal_min?: number | null, cal_max?: number | null,
|
|
1356
|
+
static readLayer(name: string | undefined, buffer: ArrayBuffer, nvmesh: NVMesh, opacity?: number, colormap?: string, colormapNegative?: string, useNegativeCmap?: boolean, cal_min?: number | null, cal_max?: number | null, outlineBorder?: number): void;
|
|
1362
1357
|
static readSMP(buffer: ArrayBuffer, n_vert: number): Float32Array;
|
|
1363
1358
|
static readSTC(buffer: ArrayBuffer, n_vert: number): Float32Array;
|
|
1364
1359
|
static readCURV(buffer: ArrayBuffer, n_vert: number): Float32Array;
|
|
@@ -1372,6 +1367,7 @@ declare class NVMeshLoaders {
|
|
|
1372
1367
|
static readICO(buffer: ArrayBuffer): DefaultMeshType;
|
|
1373
1368
|
static readGEO(buffer: ArrayBuffer, isFlipWinding?: boolean): DefaultMeshType;
|
|
1374
1369
|
static readOFF(buffer: ArrayBuffer): DefaultMeshType;
|
|
1370
|
+
static readOBJMNI(buffer: ArrayBuffer): DefaultMeshType;
|
|
1375
1371
|
static readOBJ(buffer: ArrayBuffer): DefaultMeshType;
|
|
1376
1372
|
static readFreeSurfer(buffer: ArrayBuffer): DefaultMeshType;
|
|
1377
1373
|
static readSRF(buffer: ArrayBuffer): DefaultMeshType;
|
|
@@ -1484,7 +1480,7 @@ type NiiVueOptions = {
|
|
|
1484
1480
|
loadingText?: string;
|
|
1485
1481
|
dragAndDropEnabled?: boolean;
|
|
1486
1482
|
isNearestInterpolation?: boolean;
|
|
1487
|
-
|
|
1483
|
+
atlasOutline?: number;
|
|
1488
1484
|
isRuler?: boolean;
|
|
1489
1485
|
isColorbar?: boolean;
|
|
1490
1486
|
isOrientCube?: boolean;
|
|
@@ -1614,6 +1610,7 @@ declare class Niivue {
|
|
|
1614
1610
|
position?: vec3;
|
|
1615
1611
|
extentsMin?: vec3;
|
|
1616
1612
|
extentsMax?: vec3;
|
|
1613
|
+
private resizeObserver;
|
|
1617
1614
|
syncOpts: Record<string, unknown>;
|
|
1618
1615
|
readyForSync: boolean;
|
|
1619
1616
|
uiData: UIData;
|
|
@@ -1845,7 +1842,7 @@ declare class Niivue {
|
|
|
1845
1842
|
longTouchTimeout: number;
|
|
1846
1843
|
keyDebounceTime: number;
|
|
1847
1844
|
isNearestInterpolation: boolean;
|
|
1848
|
-
|
|
1845
|
+
atlasOutline: number;
|
|
1849
1846
|
isRuler: boolean;
|
|
1850
1847
|
isColorbar: boolean;
|
|
1851
1848
|
isOrientCube: boolean;
|
|
@@ -2245,6 +2242,17 @@ declare class Niivue {
|
|
|
2245
2242
|
* @see {@link https://niivue.github.io/niivue/features/meshes.html|live demo usage}
|
|
2246
2243
|
*/
|
|
2247
2244
|
setMeshProperty(id: number, key: keyof NVMesh, val: number): void;
|
|
2245
|
+
/**
|
|
2246
|
+
* returns the index of the mesh vertex that is closest to the provided coordinates
|
|
2247
|
+
* @param id - identity of mesh to change
|
|
2248
|
+
* @param Xmm - location in left/right dimension
|
|
2249
|
+
* @param Ymm - location in posterior/anterior dimension
|
|
2250
|
+
* @param Zmm - location in foot/head dimension
|
|
2251
|
+
* @returns the an array where ret[0] is the mesh index and ret[1] is distance from vertex to coordinates
|
|
2252
|
+
* @example niivue.indexNearestXYZmm(niivue.meshes[0].id, -22, 42, 13)
|
|
2253
|
+
* @see {@link https://niivue.github.io/niivue/features/clipplanes.html | live demo usage}
|
|
2254
|
+
*/
|
|
2255
|
+
indexNearestXYZmm(mesh: number, Xmm: number, Ymm: number, Zmm: number): number[];
|
|
2248
2256
|
/**
|
|
2249
2257
|
* reverse triangle winding of mesh (swap front and back faces)
|
|
2250
2258
|
* @param id - identity of mesh to change
|
|
@@ -2862,7 +2870,7 @@ declare class Niivue {
|
|
|
2862
2870
|
drawTextBetween(startXYendXY: number[], str: string, scale?: number, color?: number[] | null): void;
|
|
2863
2871
|
drawTextBelow(xy: number[], str: string, scale?: number, color?: number[] | null): void;
|
|
2864
2872
|
updateInterpolation(layer: number, isForceLinear?: boolean): void;
|
|
2865
|
-
setAtlasOutline(isOutline:
|
|
2873
|
+
setAtlasOutline(isOutline: number): void;
|
|
2866
2874
|
/**
|
|
2867
2875
|
* select between nearest and linear interpolation for voxel based images
|
|
2868
2876
|
* @param isNearest - whether nearest neighbor interpolation is used, else linear interpolation
|