@niivue/niivue 0.45.1 → 0.46.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 CHANGED
@@ -417,7 +417,13 @@ declare class NVImage {
417
417
  set colorMap(cm: string);
418
418
  get opacity(): number;
419
419
  set opacity(opacity: number);
420
- calMinMax(): number[];
420
+ /**
421
+ * set contrast/brightness to robust range (2%..98%)
422
+ * @param vol - volume for estimate (use -1 to use estimate on all loaded volumes; use INFINITY for current volume)
423
+ * @sets volume brightness and returns array [pct2, pct98, mnScale, mxScale]
424
+ * @see {@link https://niivue.github.io/niivue/features/timeseries2.html | live demo usage}
425
+ */
426
+ calMinMax(vol?: number): number[];
421
427
  intensityRaw2Scaled(raw: number): number;
422
428
  intensityScaled2Raw(scaled: number): number;
423
429
  saveToUint8Array(fnm: string, drawing8?: Uint8Array | null): Uint8Array;
@@ -598,7 +604,8 @@ declare enum DRAG_MODE {
598
604
  measurement = 2,
599
605
  pan = 3,
600
606
  slicer3D = 4,
601
- callbackOnly = 5
607
+ callbackOnly = 5,
608
+ roiSelection = 6
602
609
  }
603
610
  /**
604
611
  * NVConfigOptions
@@ -668,10 +675,19 @@ type NVConfigOptions = {
668
675
  renderOverlayBlend: number;
669
676
  sliceMosaicString: string;
670
677
  centerMosaic: boolean;
678
+ penSize: number;
671
679
  clickToSegment: boolean;
672
680
  clickToSegmentRadius: number;
673
- clickToSegmentSteps: number;
674
681
  clickToSegmentBright: boolean;
682
+ clickToSegmentAutoIntensity: boolean;
683
+ clickToSegmentIntensityMax: number;
684
+ clickToSegmentIntensityMin: number;
685
+ clickToSegmentPercent: number;
686
+ clickToSegmentMaxDistanceMM: number;
687
+ clickToSegmentIs2D: boolean;
688
+ selectionBoxLineThickness: number;
689
+ selectionBoxIsOutline: boolean;
690
+ scrollRequiresFocus: boolean;
675
691
  };
676
692
  declare const DEFAULT_OPTIONS: NVConfigOptions;
677
693
  type SceneData = {
@@ -976,6 +992,18 @@ type NiiVueLocation = {
976
992
  vox: vec3;
977
993
  xy: [number, number];
978
994
  };
995
+ type SyncOpts = {
996
+ '3d'?: boolean;
997
+ '2d'?: boolean;
998
+ zoomPan?: boolean;
999
+ cal_min?: boolean;
1000
+ cal_max?: boolean;
1001
+ gamma?: boolean;
1002
+ useSliceOffset?: boolean;
1003
+ sliceType?: boolean;
1004
+ crosshair?: boolean;
1005
+ clipPlane?: boolean;
1006
+ };
979
1007
 
980
1008
  type ValuesArray = Array<{
981
1009
  id: string;
@@ -1586,6 +1614,7 @@ type Graph = {
1586
1614
  vols: number[];
1587
1615
  autoSizeMultiplanar: boolean;
1588
1616
  normalizeValues: boolean;
1617
+ isRangeCalMinMax: boolean;
1589
1618
  backColor?: number[];
1590
1619
  lineColor?: number[];
1591
1620
  textColor?: number[];
@@ -1612,6 +1641,7 @@ type Descriptive = {
1612
1641
  cal_max: number;
1613
1642
  robust_min: number;
1614
1643
  robust_max: number;
1644
+ area: number | null;
1615
1645
  };
1616
1646
  type SliceScale = {
1617
1647
  volScale: number[];
@@ -1684,6 +1714,9 @@ declare class Niivue {
1684
1714
  drawUndoBitmaps: Uint8Array[];
1685
1715
  drawLut: LUT;
1686
1716
  drawOpacity: number;
1717
+ clickToSegmentIsGrowing: boolean;
1718
+ clickToSegmentGrowingBitmap: Uint8Array | null;
1719
+ clickToSegmentXY: number[];
1687
1720
  renderDrawAmbientOcclusion: number;
1688
1721
  colorbarHeight: number;
1689
1722
  drawPenLocation: number[];
@@ -1697,6 +1730,7 @@ declare class Niivue {
1697
1730
  orientCubeShader?: Shader;
1698
1731
  orientCubeShaderVAO: WebGLVertexArrayObject | null;
1699
1732
  rectShader?: Shader;
1733
+ rectOutlineShader?: Shader;
1700
1734
  renderShader?: Shader;
1701
1735
  lineShader?: Shader;
1702
1736
  line3DShader?: Shader;
@@ -1741,7 +1775,7 @@ declare class Niivue {
1741
1775
  extentsMin?: vec3;
1742
1776
  extentsMax?: vec3;
1743
1777
  private resizeObserver;
1744
- syncOpts: Record<string, unknown>;
1778
+ syncOpts: SyncOpts;
1745
1779
  readyForSync: boolean;
1746
1780
  uiData: UIData;
1747
1781
  back: NVImage | null;
@@ -1762,7 +1796,7 @@ declare class Niivue {
1762
1796
  screen2frac?: number[];
1763
1797
  }>;
1764
1798
  cuboidVertexBuffer?: WebGLBuffer;
1765
- otherNV: Niivue | Niivue[] | null;
1799
+ otherNV: Niivue[] | null;
1766
1800
  volumeObject3D: NiivueObject3D | null;
1767
1801
  pivot3D: number[];
1768
1802
  furthestFromPivot: number;
@@ -2017,7 +2051,7 @@ declare class Niivue {
2017
2051
  * @deprecated use broadcastTo instead
2018
2052
  * @see {@link https://niivue.github.io/niivue/features/sync.mesh.html | live demo usage}
2019
2053
  */
2020
- syncWith(otherNV: Niivue, syncOpts?: {
2054
+ syncWith(otherNV: Niivue | Niivue[], syncOpts?: {
2021
2055
  '2d': boolean;
2022
2056
  '3d': boolean;
2023
2057
  }): void;
@@ -2036,6 +2070,15 @@ declare class Niivue {
2036
2070
  '2d': boolean;
2037
2071
  '3d': boolean;
2038
2072
  }): void;
2073
+ doSync3d(otherNV: Niivue): void;
2074
+ doSync2d(otherNV: Niivue): void;
2075
+ doSyncGamma(otherNV: Niivue): void;
2076
+ doSyncZoomPan(otherNV: Niivue): void;
2077
+ doSyncCrosshair(otherNV: Niivue): void;
2078
+ doSyncCalMin(otherNV: Niivue): void;
2079
+ doSyncCalMax(otherNV: Niivue): void;
2080
+ doSyncSliceType(otherNV: Niivue): void;
2081
+ doSyncClipPlane(otherNV: Niivue): void;
2039
2082
  /**
2040
2083
  * Sync the scene controls (orientation, crosshair location, etc.) from one Niivue instance to another. useful for using one canvas to drive another.
2041
2084
  * @internal
@@ -2698,9 +2741,17 @@ declare class Niivue {
2698
2741
  drawGrowCut(): void;
2699
2742
  drawPt(x: number, y: number, z: number, penValue: number): void;
2700
2743
  drawPenLine(ptA: number[], ptB: number[], penValue: number): void;
2744
+ /**
2745
+ * Performs a 1-voxel binary dilation on a connected cluster within the drawing mask using the drawFloodFillCore function.
2746
+ *
2747
+ * @param seedXYZ - voxel index of the seed voxel in the mask array.
2748
+ * @param neighbors - Number of neighbors to consider for connectivity and dilation (6, 18, or 26).
2749
+ */
2750
+ drawingBinaryDilationWithSeed(seedXYZ: number[], // seed voxel x,y,z
2751
+ neighbors?: 6 | 18 | 26): void;
2701
2752
  drawFloodFillCore(img: Uint8Array, seedVx: number, neighbors?: number): void;
2702
2753
  drawFloodFill(seedXYZ: number[], newColor?: number, growSelectedCluster?: number, // if non-zero, growth based on background intensity POSITIVE_INFINITY for selected or bright, NEGATIVE_INFINITY for selected or darker
2703
- forceMin?: number, forceMax?: number, neighbors?: number): void;
2754
+ forceMin?: number, forceMax?: number, neighbors?: number, maxDistanceMM?: number, is2D?: boolean): void;
2704
2755
  drawPenFilled(): void;
2705
2756
  /**
2706
2757
  * close drawing: make sure you have saved any changes before calling this!
@@ -2714,7 +2765,7 @@ declare class Niivue {
2714
2765
  * @example niivue.refreshDrawing();
2715
2766
  * @see {@link https://niivue.github.io/niivue/features/cactus.html | live demo usage}
2716
2767
  */
2717
- refreshDrawing(isForceRedraw?: boolean): void;
2768
+ refreshDrawing(isForceRedraw?: boolean, useClickToSegmentBitmap?: boolean): void;
2718
2769
  r8Tex(texID: WebGLTexture | null, activeID: number, dims: number[], isInit?: boolean): WebGLTexture | null;
2719
2770
  rgbaTex(texID: WebGLTexture | null, activeID: number, dims: number[], isInit?: boolean): WebGLTexture | null;
2720
2771
  requestCORSIfNotSameOrigin(img: HTMLImageElement, url: string): void;
@@ -2829,13 +2880,33 @@ declare class Niivue {
2829
2880
  updateGLVolume(): void;
2830
2881
  /**
2831
2882
  * basic statistics for selected voxel-based image
2832
- * @param layer - selects image to describe
2833
- * @param masks - are optional binary images to filter voxles
2834
- * @returns numeric values to describe image
2835
- * @example niivue.getDescriptives(0);
2883
+ * @param options - an object containing the following properties:
2884
+ * - layer: selects image to describe
2885
+ * - masks: optional binary images to filter voxels
2886
+ * - drawingIsMask: a boolean indicating if the drawing is used as a mask
2887
+ * - roiIsMask: a boolean indicating if the ROI is used as a mask
2888
+ * - startVox: the starting voxel coordinates
2889
+ * - endVox: the ending voxel coordinates
2890
+ * @returns numeric values to describe image or regions of images
2891
+ * @example
2892
+ * niivue.getDescriptives({
2893
+ * layer: 0,
2894
+ * masks: [],
2895
+ * drawingIsMask: true, // drawingIsMask and roiIsMask are mutually exclusive
2896
+ * roiIsMask: false,
2897
+ * startVox: [10, 20, 30], // ignored if roiIsMask is false
2898
+ * endVox: [40, 50, 60] // ignored if roiIsMask is false
2899
+ * });
2836
2900
  * @see {@link https://niivue.github.io/niivue/features/draw2.html | live demo usage}
2837
2901
  */
2838
- getDescriptives(layer?: number, masks?: any[], drawingIsMask?: boolean): Descriptive;
2902
+ getDescriptives(options: {
2903
+ layer?: number;
2904
+ masks?: number[];
2905
+ drawingIsMask?: boolean;
2906
+ roiIsMask?: boolean;
2907
+ startVox?: number[];
2908
+ endVox?: number[];
2909
+ }): Descriptive;
2839
2910
  refreshLayers(overlayItem: NVImage, layer: number): void;
2840
2911
  /**
2841
2912
  * query all available color maps that can be applied to volumes
@@ -2953,6 +3024,8 @@ declare class Niivue {
2953
3024
  sliceScroll3D(posChange?: number): void;
2954
3025
  deleteThumbnail(): void;
2955
3026
  inGraphTile(x: number, y: number): boolean;
3027
+ updateBitmapFromClickToSegment(): void;
3028
+ sumBitmap(img: Uint8Array): number;
2956
3029
  mouseClick(x: number, y: number, posChange?: number, isDelta?: boolean): void;
2957
3030
  drawRuler(): void;
2958
3031
  drawRuler10cm(startXYendXY: number[]): void;
@@ -3067,4 +3140,4 @@ declare class Niivue {
3067
3140
  set gl(gl: WebGL2RenderingContext | null);
3068
3141
  }
3069
3142
 
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 };
3143
+ 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 SyncOpts, type Volume, cmapper, ColorTables as colortables };