@niivue/niivue 0.44.0 → 0.44.2

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 CHANGED
@@ -437,7 +437,7 @@ declare class NVImage {
437
437
  * read a 3D slab of voxels from a volume
438
438
  * @param voxStart - first row, column and slice (RAS order) for selection
439
439
  * @param voxEnd - final row, column and slice (RAS order) for selection
440
- * @param dataType - array data type. Options: 'same' (default), 'uint8', 'float32'
440
+ * @param dataType - array data type. Options: 'same' (default), 'uint8', 'float32', 'scaled', 'normalized', 'windowed'
441
441
  * @returns the an array where ret[0] is the voxel values and ret[1] is dimension of selection
442
442
  * @see {@link https://niivue.github.io/niivue/features/slab_selection.html | live demo usage}
443
443
  */
@@ -1191,6 +1191,9 @@ declare class NVMesh {
1191
1191
  unloadMesh(gl: WebGL2RenderingContext): void;
1192
1192
  updateMesh(gl: WebGL2RenderingContext): void;
1193
1193
  reverseFaces(gl: WebGL2RenderingContext): void;
1194
+ hierarchicalOrder(): number;
1195
+ decimateFaces(n: number, ntarget: number): void;
1196
+ decimateHierarchicalMesh(gl: WebGL2RenderingContext, order?: number): boolean;
1194
1197
  setLayerProperty(id: number, key: keyof NVMeshLayer, val: number | string | boolean, gl: WebGL2RenderingContext): void;
1195
1198
  setProperty(key: keyof this, val: unknown, gl: WebGL2RenderingContext): void;
1196
1199
  generatePosNormClr(pts: Float32Array, tris: Uint32Array, rgba255: Uint8Array): Float32Array;
@@ -1520,6 +1523,7 @@ declare class NVMeshLoaders {
1520
1523
  static readSRF(buffer: ArrayBuffer): DefaultMeshType;
1521
1524
  static readTxtSTL(buffer: ArrayBuffer): DefaultMeshType;
1522
1525
  static readSTL(buffer: ArrayBuffer): DefaultMeshType;
1526
+ static decimateLayerVertices(nVertLayer: number, nVertMesh: number): number;
1523
1527
  static readNII2(buffer: ArrayBuffer, n_vert?: number, anatomicalStructurePrimary?: string): Int32Array | Float32Array | Int16Array | Uint8Array;
1524
1528
  static readNII(buffer: ArrayBuffer, n_vert?: number, anatomicalStructurePrimary?: string): Float32Array | Uint8Array | Int32Array | Int16Array;
1525
1529
  static readMGH(buffer: ArrayBuffer, n_vert?: number, isReadColortables?: boolean): MGH;
@@ -1527,6 +1531,26 @@ declare class NVMeshLoaders {
1527
1531
  static readGII(buffer: ArrayBuffer, n_vert?: number): GII;
1528
1532
  }
1529
1533
 
1534
+ type Extents = {
1535
+ mxDx: number;
1536
+ extentsMin: number | number[];
1537
+ extentsMax: number | number[];
1538
+ };
1539
+ /**
1540
+ * Utilities class for common mesh functions
1541
+ */
1542
+ declare class NVMeshUtilities {
1543
+ static getClusterBoundaryU8(u8: Uint8Array, faces: number[] | Uint32Array): boolean[];
1544
+ static createMZ3(vertices: Float32Array, indices: Uint32Array, compress?: boolean): ArrayBuffer;
1545
+ static createOBJ(vertices: Float32Array, indices: Uint32Array): ArrayBuffer;
1546
+ static createSTL(vertices: Float32Array, indices: Uint32Array): ArrayBuffer;
1547
+ static downloadArrayBuffer(buffer: ArrayBuffer, filename: string): void;
1548
+ static saveMesh(vertices: Float32Array, indices: Uint32Array, filename?: string, compress?: boolean): ArrayBuffer;
1549
+ static getClusterBoundary(rgba8: Uint8Array, faces: number[] | Uint32Array): boolean[];
1550
+ static getExtents(pts: number[] | Float32Array): Extents;
1551
+ static generateNormals(pts: number[] | Float32Array, tris: number[] | Uint32Array): Float32Array;
1552
+ }
1553
+
1530
1554
  type ColormapListEntry = {
1531
1555
  name: string;
1532
1556
  min: number;
@@ -2264,6 +2288,15 @@ declare class Niivue {
2264
2288
  * @see {@link https://niivue.github.io/niivue/features/clipplanes.html | live demo usage}
2265
2289
  */
2266
2290
  indexNearestXYZmm(mesh: number, Xmm: number, Ymm: number, Zmm: number): number[];
2291
+ /**
2292
+ * reduce complexity of FreeSurfer mesh
2293
+ * @param mesh - identity of mesh to change
2294
+ * @param order - decimation order 0..6
2295
+ * @example niivue.decimateHierarchicalMesh(niivue.meshes[0].id, 4)
2296
+ * @returns boolean false if mesh is not hierarchical or of lower order
2297
+ * @see {@link https://niivue.github.io/niivue/features/meshes.html | live demo usage}
2298
+ */
2299
+ decimateHierarchicalMesh(mesh: number, order?: number): boolean;
2267
2300
  /**
2268
2301
  * reverse triangle winding of mesh (swap front and back faces)
2269
2302
  * @param id - identity of mesh to change
@@ -3009,4 +3042,4 @@ declare class Niivue {
3009
3042
  set gl(gl: WebGL2RenderingContext | null);
3010
3043
  }
3011
3044
 
3012
- export { type Connectome, type ConnectomeOptions, DEFAULT_OPTIONS, DRAG_MODE, type DocumentData, type DragReleaseParams, type ExportDocumentData, INITIAL_SCENE_DATA, LabelLineTerminator, LabelTextAlignment, type LegacyConnectome, type LegacyNodes, MULTIPLANAR_TYPE, type NVConfigOptions, type NVConnectomeEdge, type NVConnectomeNode, NVController, NVDocument, NVImage, NVImageFromUrlOptions, NVLabel3D, NVLabel3DStyle, NVMesh, NVMeshFromUrlOptions, NVMeshLayerDefaults, NVMeshLoaders, NVUtilities, type NiftiHeader, type NiiVueLocation, type NiiVueLocationValue, Niivue, type Point, SHOW_RENDER, SLICE_TYPE, type Scene, type Volume, cmapper, ColorTables as colortables };
3045
+ export { type Connectome, type ConnectomeOptions, DEFAULT_OPTIONS, DRAG_MODE, type DocumentData, type DragReleaseParams, type ExportDocumentData, INITIAL_SCENE_DATA, LabelLineTerminator, LabelTextAlignment, type LegacyConnectome, type LegacyNodes, MULTIPLANAR_TYPE, type NVConfigOptions, type NVConnectomeEdge, type NVConnectomeNode, NVController, NVDocument, NVImage, NVImageFromUrlOptions, NVLabel3D, NVLabel3DStyle, NVMesh, NVMeshFromUrlOptions, NVMeshLayerDefaults, NVMeshLoaders, NVMeshUtilities, NVUtilities, type NiftiHeader, type NiiVueLocation, type NiiVueLocationValue, Niivue, type Point, SHOW_RENDER, SLICE_TYPE, type Scene, type Volume, cmapper, ColorTables as colortables };