@niivue/niivue 0.62.0 → 0.62.1
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/drawing/index.d.ts +128 -0
- package/build/drawing/index.js +8885 -0
- package/build/drawing/index.js.map +1 -0
- package/build/index.min.js +1 -1
- package/build/metafile-esm.json +1 -1
- package/build/{index.d.ts → niivue/index.d.ts} +18 -1355
- package/build/{index.js → niivue/index.js} +3506 -3427
- package/build/niivue/index.js.map +1 -0
- package/build/nvdocument-D56hVgmz.d.ts +1350 -0
- package/build/utils/index.d.ts +29 -0
- package/build/utils/index.js +597 -0
- package/build/utils/index.js.map +1 -0
- package/dist/index.d.ts +16 -9
- package/dist/index.js +3143 -3064
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/niivue.umd.js +175 -175
- package/package.json +16 -6
- package/src/colortables.ts +2 -2
- package/src/drawing/index.ts +13 -0
- package/src/drawing/{drawing.ts → masks.ts} +2 -2
- package/src/drawing/rle.ts +97 -0
- package/src/drawing/undo.ts +32 -0
- package/src/niivue/index.ts +165 -124
- package/src/nvconnectome.ts +8 -8
- package/src/nvdocument.ts +6 -6
- package/src/nvimage/ImageReaders/index.ts +4 -4
- package/src/nvimage/ImageReaders/mgh.ts +4 -4
- package/src/nvimage/ImageReaders/nii.ts +3 -3
- package/src/nvimage/ImageReaders/nrrd.ts +4 -4
- package/src/nvimage/ImageWriter.ts +4 -5
- package/src/nvimage/RenderingUtils.ts +3 -3
- package/src/nvimage/VolumeUtils.ts +3 -3
- package/src/nvimage/index.ts +12 -8
- package/src/nvimage/utils.ts +3 -3
- package/src/nvmesh-loaders.ts +6 -6
- package/src/nvmesh-types.ts +1 -1
- package/src/nvmesh.ts +10 -10
- package/src/shader.ts +1 -1
- package/src/types.ts +2 -2
- package/src/utils/file-utils.ts +33 -0
- package/src/utils/image-utils.ts +91 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/math-utils.ts +52 -0
- package/src/utils/nice.ts +27 -0
- package/src/utils/webgl-utils.ts +40 -0
- package/build/index.js.map +0 -1
- package/src/niivue/types.ts +0 -0
- package/src/niivue/utils.ts +0 -343
- /package/src/cmaps/{index.js → index.ts} +0 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { S as SLICE_TYPE, T as TypedVoxelArray } from '../nvdocument-D56hVgmz.js';
|
|
2
|
+
import 'gl-matrix';
|
|
3
|
+
import 'nifti-reader-js';
|
|
4
|
+
|
|
5
|
+
interface DrawUndoArgs {
|
|
6
|
+
drawUndoBitmaps: Uint8Array[];
|
|
7
|
+
currentDrawUndoBitmap: number;
|
|
8
|
+
drawBitmap: Uint8Array;
|
|
9
|
+
}
|
|
10
|
+
declare const drawUndo: ({ drawUndoBitmaps, currentDrawUndoBitmap, drawBitmap }: DrawUndoArgs) => {
|
|
11
|
+
drawBitmap: Uint8Array;
|
|
12
|
+
currentDrawUndoBitmap: number;
|
|
13
|
+
} | undefined;
|
|
14
|
+
|
|
15
|
+
declare function encodeRLE(data: Uint8Array): Uint8Array;
|
|
16
|
+
declare function decodeRLE(rle: Uint8Array, decodedlen: number): Uint8Array;
|
|
17
|
+
|
|
18
|
+
interface DrawingDimensions {
|
|
19
|
+
dimX: number;
|
|
20
|
+
dimY: number;
|
|
21
|
+
dimZ: number;
|
|
22
|
+
}
|
|
23
|
+
interface InterpolationOptions {
|
|
24
|
+
intensityWeight?: number;
|
|
25
|
+
binaryThreshold?: number;
|
|
26
|
+
intensitySigma?: number;
|
|
27
|
+
applySmoothingToSlices?: boolean;
|
|
28
|
+
useIntensityGuided?: boolean;
|
|
29
|
+
sliceType?: SLICE_TYPE;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Find the first and last slices containing drawing data along a given axis
|
|
33
|
+
* @param sliceType - The slice orientation (AXIAL, CORONAL, or SAGITTAL)
|
|
34
|
+
* @param drawBitmap - The drawing bitmap data
|
|
35
|
+
* @param dims - The volume dimensions
|
|
36
|
+
* @returns Object containing first and last slice indices, or null if no data found
|
|
37
|
+
*/
|
|
38
|
+
declare function findBoundarySlices(sliceType: SLICE_TYPE, drawBitmap: Uint8Array, dims: DrawingDimensions): {
|
|
39
|
+
first: number;
|
|
40
|
+
last: number;
|
|
41
|
+
} | null;
|
|
42
|
+
/**
|
|
43
|
+
* Extract a single slice from 3D volume data
|
|
44
|
+
* @param sliceIndex - Index of the slice to extract
|
|
45
|
+
* @param sliceType - The slice orientation (AXIAL, CORONAL, or SAGITTAL)
|
|
46
|
+
* @param drawBitmap - The drawing bitmap data
|
|
47
|
+
* @param dims - The volume dimensions
|
|
48
|
+
* @returns Float32Array containing the slice data
|
|
49
|
+
*/
|
|
50
|
+
declare function extractSlice(sliceIndex: number, sliceType: SLICE_TYPE, drawBitmap: Uint8Array, dims: DrawingDimensions): Float32Array;
|
|
51
|
+
/**
|
|
52
|
+
* Extract intensity slice from image data
|
|
53
|
+
* @param sliceIndex - Index of the slice to extract
|
|
54
|
+
* @param sliceType - The slice orientation
|
|
55
|
+
* @param imageData - The image intensity data
|
|
56
|
+
* @param dims - The volume dimensions
|
|
57
|
+
* @param maxVal - Maximum value for normalization
|
|
58
|
+
* @returns Float32Array containing normalized intensity values
|
|
59
|
+
*/
|
|
60
|
+
declare function extractIntensitySlice(sliceIndex: number, sliceType: SLICE_TYPE, imageData: TypedVoxelArray, dims: DrawingDimensions, maxVal: number): Float32Array;
|
|
61
|
+
/**
|
|
62
|
+
* Insert a color mask into the drawing bitmap at a specific slice
|
|
63
|
+
* @param mask - The mask data to insert
|
|
64
|
+
* @param sliceIndex - Index of the slice
|
|
65
|
+
* @param sliceType - The slice orientation
|
|
66
|
+
* @param drawBitmap - The drawing bitmap to modify
|
|
67
|
+
* @param dims - The volume dimensions
|
|
68
|
+
* @param binaryThreshold - Threshold for binary conversion
|
|
69
|
+
* @param color - Color value to use
|
|
70
|
+
*/
|
|
71
|
+
declare function insertColorMask(mask: TypedVoxelArray, sliceIndex: number, sliceType: SLICE_TYPE, drawBitmap: Uint8Array, dims: DrawingDimensions, binaryThreshold: number, color: number): void;
|
|
72
|
+
/**
|
|
73
|
+
* Smooth a 2D slice using a simple 3x3 kernel
|
|
74
|
+
* @param slice - The slice data to smooth
|
|
75
|
+
* @param width - Width of the slice
|
|
76
|
+
* @param height - Height of the slice
|
|
77
|
+
*/
|
|
78
|
+
declare function smoothSlice(slice: Float32Array, width: number, height: number): void;
|
|
79
|
+
/**
|
|
80
|
+
* Calculate intensity-based weight for interpolation
|
|
81
|
+
* @param intensity1 - Intensity from first slice
|
|
82
|
+
* @param intensity2 - Intensity from second slice
|
|
83
|
+
* @param targetIntensity - Target intensity to compare against
|
|
84
|
+
* @param intensitySigma - Sigma parameter for weight calculation
|
|
85
|
+
* @returns Weight value between 0 and 1
|
|
86
|
+
*/
|
|
87
|
+
declare function calculateIntensityWeight(intensity1: number, intensity2: number, targetIntensity: number, intensitySigma: number): number;
|
|
88
|
+
/**
|
|
89
|
+
* Perform geometric interpolation between two slices
|
|
90
|
+
* @param sliceLow - Lower slice data
|
|
91
|
+
* @param sliceHigh - Higher slice data
|
|
92
|
+
* @param z - Current slice index
|
|
93
|
+
* @param sliceIndexLow - Lower slice index
|
|
94
|
+
* @param sliceIndexHigh - Higher slice index
|
|
95
|
+
* @param interpolatedSlice - Output array for interpolated values
|
|
96
|
+
*/
|
|
97
|
+
declare function doGeometricInterpolation(sliceLow: Float32Array, sliceHigh: Float32Array, z: number, sliceIndexLow: number, sliceIndexHigh: number, interpolatedSlice: Float32Array): void;
|
|
98
|
+
/**
|
|
99
|
+
* Perform intensity-guided interpolation between two slices
|
|
100
|
+
* @param sliceLow - Lower slice data
|
|
101
|
+
* @param sliceHigh - Higher slice data
|
|
102
|
+
* @param z - Current slice index
|
|
103
|
+
* @param sliceIndexLow - Lower slice index
|
|
104
|
+
* @param sliceIndexHigh - Higher slice index
|
|
105
|
+
* @param interpolatedSlice - Output array for interpolated values
|
|
106
|
+
* @param opts - Interpolation options
|
|
107
|
+
* @param intensityLow - Intensity data for lower slice
|
|
108
|
+
* @param intensityHigh - Intensity data for higher slice
|
|
109
|
+
* @param targetIntensity - Target intensity data
|
|
110
|
+
*/
|
|
111
|
+
declare function doIntensityGuidedInterpolation(sliceLow: Float32Array, sliceHigh: Float32Array, z: number, sliceIndexLow: number, sliceIndexHigh: number, interpolatedSlice: Float32Array, opts: {
|
|
112
|
+
intensityWeight: number;
|
|
113
|
+
intensitySigma: number;
|
|
114
|
+
}, intensityLow: Float32Array, intensityHigh: Float32Array, targetIntensity: Float32Array): void;
|
|
115
|
+
/**
|
|
116
|
+
* Main interpolation function for mask slices
|
|
117
|
+
* @param drawBitmap - The drawing bitmap to modify
|
|
118
|
+
* @param dims - The volume dimensions
|
|
119
|
+
* @param imageData - Optional image intensity data for guided interpolation
|
|
120
|
+
* @param maxVal - Maximum value for intensity normalization
|
|
121
|
+
* @param sliceIndexLow - Lower slice index (optional)
|
|
122
|
+
* @param sliceIndexHigh - Higher slice index (optional)
|
|
123
|
+
* @param options - Interpolation options
|
|
124
|
+
* @param refreshDrawingCallback - Callback to refresh the drawing
|
|
125
|
+
*/
|
|
126
|
+
declare function interpolateMaskSlices(drawBitmap: Uint8Array, dims: DrawingDimensions, imageData: TypedVoxelArray, maxVal: number, sliceIndexLow: number | undefined, sliceIndexHigh: number | undefined, options: InterpolationOptions, refreshDrawingCallback: () => void): void;
|
|
127
|
+
|
|
128
|
+
export { calculateIntensityWeight, decodeRLE, doGeometricInterpolation, doIntensityGuidedInterpolation, drawUndo, encodeRLE, extractIntensitySlice, extractSlice, findBoundarySlices, insertColorMask, interpolateMaskSlices, smoothSlice };
|