@niivue/niivue 0.44.1 → 0.44.2-dev.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/README.md CHANGED
@@ -46,6 +46,15 @@ The command `npm run demo` will minify the project and locally host all of the [
46
46
  - [Neuroinformatics Research and Development Group](http://neuroinformatics.uw.edu/) embeds NiiVue in [tractoscope](https://github.com/nrdg/tractoscope)
47
47
  - [nilearn](https://nilearn.github.io/stable/index.html) is extending [ipyniivue](https://github.com/niivue/ipyniivue)
48
48
  - [niivue-vscode](https://github.com/niivue/niivue-vscode) is a VSCode extension for displaying images
49
+ - [QuantCo](https://www.quantco.com/) is using NiiVue in medical imaging workflows
50
+ - [FSL Clinical](https://fslclinical.com/) is using NiiVue in brain imaging reports
51
+ - [brain2print](https://brain2print.org/) (from the NiiVue team) uses NiiVue for showing both volume data and converted meshes
52
+ - [ct2print](https://ct2print.org/) (from the NiiVue team) uses NiiVue for showing volume and mesh data
53
+ - [ipyniivue](https://github.com/niivue/ipyniivue) allows NiiVue to be used in Jupyter Notebooks
54
+ - [T2Lesion](https://niivue.github.io/T2lesion/) (from the NiiVue team) uses NiiVue to show input data and segmented lesion masks
55
+ - [NiiVue Desktop](https://github.com/niivue/desktop) (from the NiiVue team) uses NiiVue in a crossplatform Electron app
56
+ - [NiiVue iOS](https://github.com/niivue/ios) (from the NiiVue team) uses NiiVue in a hybrid Swift + webView mobile app
57
+ - [NiiVue Neglect](https://niivue.github.io/niivue-neglect/) uses NiiVue to visualise stroke lesion data in the spatial neglect severity prediction tool
49
58
 
50
59
  # Funding
51
60
 
package/build/index.d.ts CHANGED
@@ -107,6 +107,18 @@ declare enum LabelLineTerminator {
107
107
  CIRCLE = "circle",
108
108
  RING = "ring"
109
109
  }
110
+ declare enum LabelAnchorPoint {
111
+ NONE = 0,
112
+ TOPLEFT = 9,
113
+ TOPCENTER = 10,
114
+ TOPRIGHT = 12,
115
+ MIDDLELEFT = 17,
116
+ MIDDLECENTER = 18,
117
+ MIDDLERIGHT = 20,
118
+ BOTTOMLEFT = 33,
119
+ BOTTOMCENTER = 34,
120
+ BOTTOMRIGHT = 36
121
+ }
110
122
  /**
111
123
  * Class representing label style.
112
124
  * @ignore
@@ -140,12 +152,14 @@ declare class NVLabel3D {
140
152
  text: string;
141
153
  style: NVLabel3DStyle;
142
154
  points?: number[] | number[][];
155
+ anchor: LabelAnchorPoint;
156
+ onClick?: (label: NVLabel3D) => void;
143
157
  /**
144
158
  * @param text - The text of the label
145
159
  * @param style - The style of the label
146
160
  * @param points - An array of points label for label lines
147
161
  */
148
- constructor(text: string, style: NVLabel3DStyle, points?: number[] | number[][]);
162
+ constructor(text: string, style: NVLabel3DStyle, points?: number[] | number[][], anchor?: LabelAnchorPoint, onClick?: (label: NVLabel3D) => void);
149
163
  }
150
164
 
151
165
  /**
@@ -619,6 +633,7 @@ type NVConfigOptions = {
619
633
  isOrientCube: boolean;
620
634
  multiplanarPadPixels: number;
621
635
  multiplanarForceRender: boolean;
636
+ multiplanarEqualSize: boolean;
622
637
  multiplanarShowRender: SHOW_RENDER;
623
638
  isRadiologicalConvention: boolean;
624
639
  meshThicknessOn2D: number | string;
@@ -660,6 +675,7 @@ type NVConfigOptions = {
660
675
  };
661
676
  declare const DEFAULT_OPTIONS: NVConfigOptions;
662
677
  type SceneData = {
678
+ gamma: number;
663
679
  azimuth: number;
664
680
  elevation: number;
665
681
  crosshairPos: vec3;
@@ -672,6 +688,7 @@ type SceneData = {
672
688
  clipVolumeHigh: number[];
673
689
  };
674
690
  declare const INITIAL_SCENE_DATA: {
691
+ gamma: number;
675
692
  azimuth: number;
676
693
  elevation: number;
677
694
  crosshairPos: vec3;
@@ -696,6 +713,7 @@ type Scene = {
696
713
  pan2Dxyzmm: vec4;
697
714
  _elevation?: number;
698
715
  _azimuth?: number;
716
+ gamma?: number;
699
717
  };
700
718
  type DocumentData = {
701
719
  title: string;
@@ -1506,6 +1524,7 @@ declare class NVMeshLoaders {
1506
1524
  static readLayer(name: string, buffer: ArrayBuffer, nvmesh: NVMesh, opacity?: number, colormap?: string, colormapNegative?: string, useNegativeCmap?: boolean, cal_min?: number | null, cal_max?: number | null, outlineBorder?: number): NVMeshLayer | undefined;
1507
1525
  static readSMP(buffer: ArrayBuffer, n_vert: number): Float32Array;
1508
1526
  static readSTC(buffer: ArrayBuffer, n_vert: number): Float32Array;
1527
+ static isCurv(buffer: ArrayBuffer): boolean;
1509
1528
  static readCURV(buffer: ArrayBuffer, n_vert: number): Float32Array;
1510
1529
  static readANNOT(buffer: ArrayBuffer, n_vert: number, isReadColortables?: boolean): ANNOT;
1511
1530
  static readNV(buffer: ArrayBuffer): DefaultMeshType;
@@ -1651,6 +1670,7 @@ type SaveImageOptions = {
1651
1670
  * let niivue = new Niivue({crosshairColor: [0,1,0,0.5], textHeight: 0.5}) // a see-through green crosshair, and larger text labels
1652
1671
  */
1653
1672
  declare class Niivue {
1673
+ loaders: {};
1654
1674
  canvas: HTMLCanvasElement | null;
1655
1675
  _gl: WebGL2RenderingContext | null;
1656
1676
  isBusy: boolean;
@@ -2119,6 +2139,7 @@ declare class Niivue {
2119
2139
  * @param file - File object
2120
2140
  */
2121
2141
  loadFromFile(file: File): Promise<void>;
2142
+ useLoader(loader: unknown, fileExt: string, toExt: string): void;
2122
2143
  dropListener(e: DragEvent): void;
2123
2144
  /**
2124
2145
  * insert a gap between slices of a mutliplanar view.
@@ -2598,6 +2619,7 @@ declare class Niivue {
2598
2619
  * @see {@link https://niivue.github.io/niivue/features/document.3d.html | live demo usage}
2599
2620
  */
2600
2621
  saveDocument(fileName?: string, compress?: boolean): Promise<void>;
2622
+ loadImages(images: Array<ImageFromUrlOptions | LoadFromUrlParams>): Promise<this>;
2601
2623
  /**
2602
2624
  * load an array of volume objects
2603
2625
  * @param volumeList - the array of objects to load. each object must have a resolvable "url" property at a minimum
@@ -2945,6 +2967,7 @@ declare class Niivue {
2945
2967
  effectiveCanvasHeight(): number;
2946
2968
  effectiveCanvasWidth(): number;
2947
2969
  getAllLabels(): NVLabel3D[];
2970
+ getConnectomeLabels(): NVLabel3D[];
2948
2971
  getBulletMarginWidth(): number;
2949
2972
  getLegendPanelWidth(): number;
2950
2973
  getLegendPanelHeight(): number;
@@ -2976,9 +2999,10 @@ declare class Niivue {
2976
2999
  screenFieldOfViewMM(axCorSag?: number, forceSliceMM?: boolean): vec3;
2977
3000
  screenFieldOfViewExtendedVox(axCorSag?: number): MM;
2978
3001
  screenFieldOfViewExtendedMM(axCorSag?: number): MM;
2979
- drawSliceOrientationText(leftTopWidthHeight: number[], axCorSag: SLICE_TYPE): void;
3002
+ drawSliceOrientationText(leftTopWidthHeight: number[], axCorSag: SLICE_TYPE, padLeftTop?: number[]): void;
2980
3003
  xyMM2xyzMM(axCorSag: SLICE_TYPE, sliceFrac: number): number[];
2981
- draw2D(leftTopWidthHeight: number[], axCorSag: SLICE_TYPE, customMM?: number): void;
3004
+ draw2DMain(leftTopWidthHeight: number[], axCorSag: SLICE_TYPE, customMM?: number): void;
3005
+ draw2D(leftTopWidthHeight: number[], axCorSag: SLICE_TYPE, customMM?: number, imageWidthHeight?: number[]): void;
2982
3006
  calculateMvpMatrix(_unused: unknown, leftTopWidthHeight: number[], azimuth: number, elevation: number): mat4[];
2983
3007
  calculateModelMatrix(azimuth: number, elevation: number): mat4;
2984
3008
  calculateRayDirection(azimuth: number, elevation: number): vec3;
@@ -2997,12 +3021,13 @@ declare class Niivue {
2997
3021
  * @param style - label style
2998
3022
  * @param point - 3D point on the model
2999
3023
  */
3000
- addLabel(text: string, style: NVLabel3DStyle, points?: number[] | number[][]): NVLabel3D;
3024
+ addLabel(text: string, style: NVLabel3DStyle, points?: number[] | number[][], anchor?: LabelAnchorPoint, onClick?: (label: NVLabel3D) => void): NVLabel3D;
3001
3025
  calculateScreenPoint(point: [number, number, number], mvpMatrix: mat4, leftTopWidthHeight: number[]): vec4;
3002
3026
  getLabelAtPoint(screenPoint: [number, number]): NVLabel3D | null;
3003
3027
  drawLabelLine(label: NVLabel3D, pos: vec2, mvpMatrix: mat4, leftTopWidthHeight: number[], secondPass?: boolean): void;
3004
- draw3DLabel(label: NVLabel3D, pos: vec2, mvpMatrix: mat4, leftTopWidthHeight: number[], bulletMargin: number, legendWidth: number, secondPass?: boolean): void;
3028
+ draw3DLabel(label: NVLabel3D, pos: vec2, mvpMatrix?: mat4, leftTopWidthHeight?: number[], bulletMargin?: number, legendWidth?: number, secondPass?: boolean): void;
3005
3029
  draw3DLabels(mvpMatrix: mat4, leftTopWidthHeight: number[], secondPass?: boolean): void;
3030
+ drawAnchoredLabels(): void;
3006
3031
  draw3D(leftTopWidthHeight?: number[], mvpMatrix?: mat4 | null, modelMatrix?: mat4 | null, normalMatrix?: mat4 | null, azimuth?: number | null, elevation?: number): string | undefined;
3007
3032
  drawMesh3D(isDepthTest?: boolean, alpha?: number, m?: mat4, modelMtx?: mat4, normMtx?: mat4): void;
3008
3033
  drawCrosshairs3D(isDepthTest?: boolean, alpha?: number, mvpMtx?: mat4 | null, is2DView?: boolean, isSliceMM?: boolean): void;
@@ -3042,4 +3067,4 @@ declare class Niivue {
3042
3067
  set gl(gl: WebGL2RenderingContext | null);
3043
3068
  }
3044
3069
 
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 };
3070
+ export { type Connectome, type ConnectomeOptions, DEFAULT_OPTIONS, DRAG_MODE, type DocumentData, type DragReleaseParams, type ExportDocumentData, INITIAL_SCENE_DATA, LabelAnchorPoint, 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 };