@niivue/niivue 0.44.2-dev.2 → 0.44.2-dev.4

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
@@ -598,7 +598,8 @@ declare enum DRAG_MODE {
598
598
  measurement = 2,
599
599
  pan = 3,
600
600
  slicer3D = 4,
601
- callbackOnly = 5
601
+ callbackOnly = 5,
602
+ roiSelection = 6
602
603
  }
603
604
  /**
604
605
  * NVConfigOptions
@@ -668,10 +669,19 @@ type NVConfigOptions = {
668
669
  renderOverlayBlend: number;
669
670
  sliceMosaicString: string;
670
671
  centerMosaic: boolean;
672
+ penSize: number;
671
673
  clickToSegment: boolean;
672
674
  clickToSegmentRadius: number;
673
- clickToSegmentSteps: number;
674
675
  clickToSegmentBright: boolean;
676
+ clickToSegmentAutoIntensity: boolean;
677
+ clickToSegmentIntensityMax: number;
678
+ clickToSegmentIntensityMin: number;
679
+ clickToSegmentPercent: number;
680
+ clickToSegmentMaxDistanceMM: number;
681
+ clickToSegmentIs2D: boolean;
682
+ selectionBoxLineThickness: number;
683
+ selectionBoxIsOutline: boolean;
684
+ scrollRequiresFocus: boolean;
675
685
  };
676
686
  declare const DEFAULT_OPTIONS: NVConfigOptions;
677
687
  type SceneData = {
@@ -976,6 +986,18 @@ type NiiVueLocation = {
976
986
  vox: vec3;
977
987
  xy: [number, number];
978
988
  };
989
+ type SyncOpts = {
990
+ '3d'?: boolean;
991
+ '2d'?: boolean;
992
+ zoomPan?: boolean;
993
+ cal_min?: boolean;
994
+ cal_max?: boolean;
995
+ gamma?: boolean;
996
+ useSliceOffset?: boolean;
997
+ sliceType?: boolean;
998
+ crosshair?: boolean;
999
+ clipPlane?: boolean;
1000
+ };
979
1001
 
980
1002
  type ValuesArray = Array<{
981
1003
  id: string;
@@ -1612,6 +1634,7 @@ type Descriptive = {
1612
1634
  cal_max: number;
1613
1635
  robust_min: number;
1614
1636
  robust_max: number;
1637
+ area: number | null;
1615
1638
  };
1616
1639
  type SliceScale = {
1617
1640
  volScale: number[];
@@ -1670,7 +1693,6 @@ type SaveImageOptions = {
1670
1693
  * let niivue = new Niivue({crosshairColor: [0,1,0,0.5], textHeight: 0.5}) // a see-through green crosshair, and larger text labels
1671
1694
  */
1672
1695
  declare class Niivue {
1673
- loaders: {};
1674
1696
  canvas: HTMLCanvasElement | null;
1675
1697
  _gl: WebGL2RenderingContext | null;
1676
1698
  isBusy: boolean;
@@ -1684,6 +1706,9 @@ declare class Niivue {
1684
1706
  drawUndoBitmaps: Uint8Array[];
1685
1707
  drawLut: LUT;
1686
1708
  drawOpacity: number;
1709
+ clickToSegmentIsGrowing: boolean;
1710
+ clickToSegmentGrowingBitmap: Uint8Array | null;
1711
+ clickToSegmentXY: number[];
1687
1712
  renderDrawAmbientOcclusion: number;
1688
1713
  colorbarHeight: number;
1689
1714
  drawPenLocation: number[];
@@ -1697,6 +1722,7 @@ declare class Niivue {
1697
1722
  orientCubeShader?: Shader;
1698
1723
  orientCubeShaderVAO: WebGLVertexArrayObject | null;
1699
1724
  rectShader?: Shader;
1725
+ rectOutlineShader?: Shader;
1700
1726
  renderShader?: Shader;
1701
1727
  lineShader?: Shader;
1702
1728
  line3DShader?: Shader;
@@ -1741,7 +1767,7 @@ declare class Niivue {
1741
1767
  extentsMin?: vec3;
1742
1768
  extentsMax?: vec3;
1743
1769
  private resizeObserver;
1744
- syncOpts: Record<string, unknown>;
1770
+ syncOpts: SyncOpts;
1745
1771
  readyForSync: boolean;
1746
1772
  uiData: UIData;
1747
1773
  back: NVImage | null;
@@ -1762,7 +1788,7 @@ declare class Niivue {
1762
1788
  screen2frac?: number[];
1763
1789
  }>;
1764
1790
  cuboidVertexBuffer?: WebGLBuffer;
1765
- otherNV: Niivue | Niivue[] | null;
1791
+ otherNV: Niivue[] | null;
1766
1792
  volumeObject3D: NiivueObject3D | null;
1767
1793
  pivot3D: number[];
1768
1794
  furthestFromPivot: number;
@@ -2017,7 +2043,7 @@ declare class Niivue {
2017
2043
  * @deprecated use broadcastTo instead
2018
2044
  * @see {@link https://niivue.github.io/niivue/features/sync.mesh.html | live demo usage}
2019
2045
  */
2020
- syncWith(otherNV: Niivue, syncOpts?: {
2046
+ syncWith(otherNV: Niivue | Niivue[], syncOpts?: {
2021
2047
  '2d': boolean;
2022
2048
  '3d': boolean;
2023
2049
  }): void;
@@ -2036,6 +2062,15 @@ declare class Niivue {
2036
2062
  '2d': boolean;
2037
2063
  '3d': boolean;
2038
2064
  }): void;
2065
+ doSync3d(otherNV: Niivue): void;
2066
+ doSync2d(otherNV: Niivue): void;
2067
+ doSyncGamma(otherNV: Niivue): void;
2068
+ doSyncZoomPan(otherNV: Niivue): void;
2069
+ doSyncCrosshair(otherNV: Niivue): void;
2070
+ doSyncCalMin(otherNV: Niivue): void;
2071
+ doSyncCalMax(otherNV: Niivue): void;
2072
+ doSyncSliceType(otherNV: Niivue): void;
2073
+ doSyncClipPlane(otherNV: Niivue): void;
2039
2074
  /**
2040
2075
  * Sync the scene controls (orientation, crosshair location, etc.) from one Niivue instance to another. useful for using one canvas to drive another.
2041
2076
  * @internal
@@ -2139,7 +2174,6 @@ declare class Niivue {
2139
2174
  * @param file - File object
2140
2175
  */
2141
2176
  loadFromFile(file: File): Promise<void>;
2142
- useLoader(loader: unknown, fileExt: string, toExt: string): void;
2143
2177
  dropListener(e: DragEvent): void;
2144
2178
  /**
2145
2179
  * insert a gap between slices of a mutliplanar view.
@@ -2619,7 +2653,6 @@ declare class Niivue {
2619
2653
  * @see {@link https://niivue.github.io/niivue/features/document.3d.html | live demo usage}
2620
2654
  */
2621
2655
  saveDocument(fileName?: string, compress?: boolean): Promise<void>;
2622
- loadImages(images: Array<ImageFromUrlOptions | LoadFromUrlParams>): Promise<this>;
2623
2656
  /**
2624
2657
  * load an array of volume objects
2625
2658
  * @param volumeList - the array of objects to load. each object must have a resolvable "url" property at a minimum
@@ -2698,9 +2731,17 @@ declare class Niivue {
2698
2731
  drawGrowCut(): void;
2699
2732
  drawPt(x: number, y: number, z: number, penValue: number): void;
2700
2733
  drawPenLine(ptA: number[], ptB: number[], penValue: number): void;
2734
+ /**
2735
+ * Performs a 1-voxel binary dilation on a connected cluster within the drawing mask using the drawFloodFillCore function.
2736
+ *
2737
+ * @param seedXYZ - voxel index of the seed voxel in the mask array.
2738
+ * @param neighbors - Number of neighbors to consider for connectivity and dilation (6, 18, or 26).
2739
+ */
2740
+ drawingBinaryDilationWithSeed(seedXYZ: number[], // seed voxel x,y,z
2741
+ neighbors?: 6 | 18 | 26): void;
2701
2742
  drawFloodFillCore(img: Uint8Array, seedVx: number, neighbors?: number): void;
2702
2743
  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;
2744
+ forceMin?: number, forceMax?: number, neighbors?: number, maxDistanceMM?: number, is2D?: boolean): void;
2704
2745
  drawPenFilled(): void;
2705
2746
  /**
2706
2747
  * close drawing: make sure you have saved any changes before calling this!
@@ -2714,7 +2755,7 @@ declare class Niivue {
2714
2755
  * @example niivue.refreshDrawing();
2715
2756
  * @see {@link https://niivue.github.io/niivue/features/cactus.html | live demo usage}
2716
2757
  */
2717
- refreshDrawing(isForceRedraw?: boolean): void;
2758
+ refreshDrawing(isForceRedraw?: boolean, useClickToSegmentBitmap?: boolean): void;
2718
2759
  r8Tex(texID: WebGLTexture | null, activeID: number, dims: number[], isInit?: boolean): WebGLTexture | null;
2719
2760
  rgbaTex(texID: WebGLTexture | null, activeID: number, dims: number[], isInit?: boolean): WebGLTexture | null;
2720
2761
  requestCORSIfNotSameOrigin(img: HTMLImageElement, url: string): void;
@@ -2829,13 +2870,33 @@ declare class Niivue {
2829
2870
  updateGLVolume(): void;
2830
2871
  /**
2831
2872
  * 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);
2873
+ * @param options - an object containing the following properties:
2874
+ * - layer: selects image to describe
2875
+ * - masks: optional binary images to filter voxels
2876
+ * - drawingIsMask: a boolean indicating if the drawing is used as a mask
2877
+ * - roiIsMask: a boolean indicating if the ROI is used as a mask
2878
+ * - startVox: the starting voxel coordinates
2879
+ * - endVox: the ending voxel coordinates
2880
+ * @returns numeric values to describe image or regions of images
2881
+ * @example
2882
+ * niivue.getDescriptives({
2883
+ * layer: 0,
2884
+ * masks: [],
2885
+ * drawingIsMask: true, // drawingIsMask and roiIsMask are mutually exclusive
2886
+ * roiIsMask: false,
2887
+ * startVox: [10, 20, 30], // ignored if roiIsMask is false
2888
+ * endVox: [40, 50, 60] // ignored if roiIsMask is false
2889
+ * });
2836
2890
  * @see {@link https://niivue.github.io/niivue/features/draw2.html | live demo usage}
2837
2891
  */
2838
- getDescriptives(layer?: number, masks?: any[], drawingIsMask?: boolean): Descriptive;
2892
+ getDescriptives(options: {
2893
+ layer?: number;
2894
+ masks?: number[];
2895
+ drawingIsMask?: boolean;
2896
+ roiIsMask?: boolean;
2897
+ startVox?: number[];
2898
+ endVox?: number[];
2899
+ }): Descriptive;
2839
2900
  refreshLayers(overlayItem: NVImage, layer: number): void;
2840
2901
  /**
2841
2902
  * query all available color maps that can be applied to volumes
@@ -2953,6 +3014,8 @@ declare class Niivue {
2953
3014
  sliceScroll3D(posChange?: number): void;
2954
3015
  deleteThumbnail(): void;
2955
3016
  inGraphTile(x: number, y: number): boolean;
3017
+ updateBitmapFromClickToSegment(): void;
3018
+ sumBitmap(img: Uint8Array): number;
2956
3019
  mouseClick(x: number, y: number, posChange?: number, isDelta?: boolean): void;
2957
3020
  drawRuler(): void;
2958
3021
  drawRuler10cm(startXYendXY: number[]): void;
@@ -3067,4 +3130,4 @@ declare class Niivue {
3067
3130
  set gl(gl: WebGL2RenderingContext | null);
3068
3131
  }
3069
3132
 
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 };
3133
+ 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 };