@kitware/vtk.js 29.5.1 → 29.7.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/Common/Core/Math/index.js +4 -4
- package/Common/Core/Math.d.ts +2 -2
- package/Common/Core/Math.js +1 -1
- package/Filters/General/ContourLoopExtraction.d.ts +79 -0
- package/Filters/General/ContourLoopExtraction.js +137 -0
- package/Filters/General/ScalarToRGBA.js +1 -1
- package/Interaction/Manipulators/MouseRangeManipulator.d.ts +4 -1
- package/Interaction/Widgets/OrientationMarkerWidget/Constants.js +1 -1
- package/Interaction/Widgets/OrientationMarkerWidget.d.ts +5 -6
- package/Rendering/Core/AxesActor.js +1 -1
- package/Rendering/Core/ColorTransferFunction/CssFilters.d.ts +109 -0
- package/Rendering/Core/ColorTransferFunction/CssFilters.js +103 -0
- package/Rendering/Core/ColorTransferFunction.js +1 -1
- package/Rendering/Core/Coordinate.js +1 -1
- package/Rendering/Core/CubeAxesActor.js +1 -1
- package/Rendering/Core/ImageMapper.js +1 -1
- package/Rendering/Core/RenderWindowInteractor.d.ts +12 -0
- package/Rendering/Core/Renderer.js +1 -1
- package/Rendering/Core/ScalarBarActor.js +1 -1
- package/Rendering/Core/VolumeMapper.js +1 -1
- package/Rendering/Core/VolumeProperty.d.ts +3 -2
- package/Rendering/OpenGL/ImageCPRMapper.js +2 -2
- package/Rendering/OpenGL/ImageMapper.js +2 -2
- package/Rendering/OpenGL/ImageResliceMapper.js +2 -2
- package/Rendering/OpenGL/PolyDataMapper2D.js +1 -1
- package/Rendering/OpenGL/RenderWindow.d.ts +1 -1
- package/Rendering/OpenGL/Texture.js +1 -1
- package/Rendering/OpenGL/VolumeMapper.js +2 -2
- package/Rendering/WebGPU/ImageMapper.js +1 -1
- package/Rendering/WebGPU/SphereMapper.js +1 -1
- package/Rendering/WebGPU/StickMapper.js +1 -1
- package/Rendering/WebGPU/VolumePassFSQ.js +1 -1
- package/Widgets/Widgets3D/AngleWidget.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
- package/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -544,7 +544,7 @@ function multiply3x3_mat3(a_3x3, b_3x3, out_3x3) {
|
|
|
544
544
|
out_3x3[i + 6] = copyA[6] * copyB[i] + copyA[7] * copyB[i + 3] + copyA[8] * copyB[i + 6];
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
|
-
function multiplyMatrix(a, b, rowA, colA, rowB, colB,
|
|
547
|
+
function multiplyMatrix(a, b, rowA, colA, rowB, colB, outRowAColB) {
|
|
548
548
|
// we need colA == rowB
|
|
549
549
|
if (colA !== rowB) {
|
|
550
550
|
vtkErrorMacro('Number of columns of A must match number of rows of B.');
|
|
@@ -558,10 +558,10 @@ function multiplyMatrix(a, b, rowA, colA, rowB, colB, out_rowXcol) {
|
|
|
558
558
|
for (let i = 0; i < rowA; i++) {
|
|
559
559
|
// output col
|
|
560
560
|
for (let j = 0; j < colB; j++) {
|
|
561
|
-
|
|
561
|
+
outRowAColB[i * colB + j] = 0;
|
|
562
562
|
// sum for this point
|
|
563
563
|
for (let k = 0; k < colA; k++) {
|
|
564
|
-
|
|
564
|
+
outRowAColB[i * colB + j] += copyA[i * colA + k] * copyB[j + colB * k];
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
567
|
}
|
|
@@ -2245,4 +2245,4 @@ var vtkMath$1 = /*#__PURE__*/Object.freeze({
|
|
|
2245
2245
|
'default': vtkMath
|
|
2246
2246
|
});
|
|
2247
2247
|
|
|
2248
|
-
export {
|
|
2248
|
+
export { max as $, degreesFromRadians as A, areEquals as B, clampValue as C, arrayRange as D, getMajorAxisIndex as E, createUninitializedBounds as F, isIdentity3x3 as G, identity as H, multiplyMatrix as I, floor as J, isInf as K, rgb2hsv as L, rgb2lab as M, lab2rgb as N, round as O, normalize2D as P, nearestPowerOfTwo as Q, multiply3x3_vect3 as R, getSparseOrthogonalMatrix as S, areBoundsInitialized as T, isPowerOfTwo as U, angleBetweenVectors as V, signedAngleBetweenVectors as W, createArray as X, Pi as Y, ceil as Z, min as _, areMatricesEqual as a, float2CssRGBA as a$, arrayMin as a0, arrayMax as a1, ceilLog2 as a2, factorial as a3, binomial as a4, beginCombination as a5, nextCombination as a6, randomSeed as a7, getSeed as a8, gaussian as a9, diagonalize3x3 as aA, singularValueDecomposition3x3 as aB, luFactorLinearSystem as aC, luSolveLinearSystem as aD, invertMatrix as aE, estimateMatrixCondition as aF, solveHomogeneousLeastSquares as aG, solveLeastSquares as aH, hex2float as aI, lab2xyz as aJ, xyz2lab as aK, xyz2rgb as aL, rgb2xyz as aM, computeBoundsFromPoints as aN, clampAndNormalizeValue as aO, getScalarTypeFittingRange as aP, getAdjustedScalarRange as aQ, extentIsWithinOtherExtent as aR, boundsIsWithinOtherBounds as aS, pointIsWithinBounds as aT, solve3PointCircle as aU, inf as aV, negInf as aW, isFinite as aX, isNaN as aY, floatToHex2 as aZ, floatRGB2HexCode as a_, multiplyScalar2D as aa, multiplyAccumulate2D as ab, outer as ac, projectVector as ad, dot2D as ae, projectVector2D as af, gaussianAmplitude as ag, gaussianWeight as ah, outer2D as ai, norm2D as aj, rowsToMat4 as ak, columnsToMat4 as al, columnsToMat3 as am, LUFactor3x3 as an, LUSolve3x3 as ao, linearSolve3x3 as ap, multiply3x3_mat3 as aq, transpose3x3 as ar, invert3x3 as as, identity3x3 as at, isIdentity as au, quaternionToMatrix3x3 as av, roundNumber as aw, matrix3x3ToQuaternion as ax, multiplyQuaternion as ay, orthogonalize3x3 as az, roundVector as b, clampVector as c, dot as d, distance2BetweenPoints as e, vtkMath as f, solveLinearSystem as g, hsv2rgb as h, isNan as i, cross as j, add as k, normalize as l, multiplyAccumulate as m, norm as n, determinant2x2 as o, jacobiN as p, perpendiculars as q, radiansFromDegrees as r, subtract as s, jacobi as t, uninitializeBounds as u, vtkMath$1 as v, multiplyScalar as w, random as x, determinant3x3 as y, rowsToMat3 as z };
|
package/Common/Core/Math.d.ts
CHANGED
|
@@ -471,9 +471,9 @@ export function multiply3x3_mat3(a_3x3: Matrix3x3, b_3x3: Matrix3x3, out_3x3: Ma
|
|
|
471
471
|
* @param {Number} colA
|
|
472
472
|
* @param {Number} rowB
|
|
473
473
|
* @param {Number} colB
|
|
474
|
-
* @param {Matrix}
|
|
474
|
+
* @param {Matrix} outRowAColB
|
|
475
475
|
*/
|
|
476
|
-
export function multiplyMatrix(a: Matrix, b: Matrix, rowA: number, colA: number, rowB: number, colB: number,
|
|
476
|
+
export function multiplyMatrix(a: Matrix, b: Matrix, rowA: number, colA: number, rowB: number, colB: number, outRowAColB: Matrix): void;
|
|
477
477
|
|
|
478
478
|
/**
|
|
479
479
|
* Transpose a 3x3 matrix.
|
package/Common/Core/Math.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'seedrandom';
|
|
2
2
|
import '../../macros2.js';
|
|
3
3
|
import './Math/Constants.js';
|
|
4
|
-
export {
|
|
4
|
+
export { an as LUFactor3x3, ao as LUSolve3x3, Y as Pi, k as add, V as angleBetweenVectors, T as areBoundsInitialized, B as areEquals, a as areMatricesEqual, a1 as arrayMax, a0 as arrayMin, D as arrayRange, a5 as beginCombination, a4 as binomial, aS as boundsIsWithinOtherBounds, Z as ceil, a2 as ceilLog2, aO as clampAndNormalizeValue, C as clampValue, c as clampVector, am as columnsToMat3, al as columnsToMat4, aN as computeBoundsFromPoints, X as createArray, F as createUninitializedBounds, j as cross, f as default, A as degreesFromRadians, o as determinant2x2, y as determinant3x3, aA as diagonalize3x3, e as distance2BetweenPoints, d as dot, ae as dot2D, aF as estimateMatrixCondition, aR as extentIsWithinOtherExtent, a3 as factorial, a$ as float2CssRGBA, a_ as floatRGB2HexCode, aZ as floatToHex2, J as floor, a9 as gaussian, ag as gaussianAmplitude, ah as gaussianWeight, aQ as getAdjustedScalarRange, E as getMajorAxisIndex, aP as getScalarTypeFittingRange, a8 as getSeed, S as getSparseOrthogonalMatrix, aI as hex2float, h as hsv2rgb, H as identity, at as identity3x3, aV as inf, as as invert3x3, aE as invertMatrix, aX as isFinite, au as isIdentity, G as isIdentity3x3, K as isInf, aY as isNaN, i as isNan, U as isPowerOfTwo, t as jacobi, p as jacobiN, N as lab2rgb, aJ as lab2xyz, ap as linearSolve3x3, aC as luFactorLinearSystem, aD as luSolveLinearSystem, ax as matrix3x3ToQuaternion, $ as max, _ as min, aq as multiply3x3_mat3, R as multiply3x3_vect3, m as multiplyAccumulate, ab as multiplyAccumulate2D, I as multiplyMatrix, ay as multiplyQuaternion, w as multiplyScalar, aa as multiplyScalar2D, Q as nearestPowerOfTwo, aW as negInf, a6 as nextCombination, n as norm, aj as norm2D, l as normalize, P as normalize2D, az as orthogonalize3x3, ac as outer, ai as outer2D, q as perpendiculars, aT as pointIsWithinBounds, ad as projectVector, af as projectVector2D, av as quaternionToMatrix3x3, r as radiansFromDegrees, x as random, a7 as randomSeed, L as rgb2hsv, M as rgb2lab, aM as rgb2xyz, O as round, aw as roundNumber, b as roundVector, z as rowsToMat3, ak as rowsToMat4, W as signedAngleBetweenVectors, aB as singularValueDecomposition3x3, aU as solve3PointCircle, aG as solveHomogeneousLeastSquares, aH as solveLeastSquares, g as solveLinearSystem, s as subtract, ar as transpose3x3, u as uninitializeBounds, aK as xyz2lab, aL as xyz2rgb } from './Math/index.js';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { vtkAlgorithm, vtkObject } from './../../interfaces';
|
|
2
|
+
import vtkPolyData from './../../Common/DataModel/PolyData';
|
|
3
|
+
/**
|
|
4
|
+
* Initial configuration values for vtkContourLoopExtraction instances.
|
|
5
|
+
*/
|
|
6
|
+
export interface IContourLoopExtractionInitialValues {}
|
|
7
|
+
|
|
8
|
+
type vtkContourLoopExtractionBase = vtkObject & vtkAlgorithm;
|
|
9
|
+
|
|
10
|
+
export interface vtkContourLoopExtraction extends vtkContourLoopExtractionBase {
|
|
11
|
+
/**
|
|
12
|
+
* Runs the contour extraction algorithm with the given input and output data.
|
|
13
|
+
* @param inData - The input data for the contour extraction.
|
|
14
|
+
* @param outData - The output data where the extracted contours will be stored.
|
|
15
|
+
*/
|
|
16
|
+
requestData(inData: vtkPolyData[], outData: vtkPolyData[]): void;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Extracts contour loops from the given polydata input and populates the given output.
|
|
20
|
+
* @param input - The input polydata
|
|
21
|
+
* @param output - The output polydata
|
|
22
|
+
*/
|
|
23
|
+
extractContours(input: vtkPolyData, output: vtkPolyData): void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Traverses a loop starting from a given line and point, in a specified direction.
|
|
27
|
+
* @param pd - The polydata which to traverse.
|
|
28
|
+
* @param dir - The direction of traversal.
|
|
29
|
+
* @param startLineId - The ID of the starting line.
|
|
30
|
+
* @param startPtId - The ID of the starting point.
|
|
31
|
+
* @param loopPoints - The array to store the traversed points of the loop.
|
|
32
|
+
* @returns The last point ID after traversal.
|
|
33
|
+
*/
|
|
34
|
+
traverseLoop(
|
|
35
|
+
pd: vtkPolyData,
|
|
36
|
+
dir: number,
|
|
37
|
+
startLineId: number,
|
|
38
|
+
startPtId: number,
|
|
39
|
+
loopPoints: Array<{ t: number; ptId: number }>
|
|
40
|
+
): number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// ----------------------------------------------------------------------------
|
|
44
|
+
// Static API
|
|
45
|
+
// ----------------------------------------------------------------------------
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Method use to decorate a given object (publicAPI+model) with vtkContourLoopExtraction characteristics.
|
|
49
|
+
*
|
|
50
|
+
* @param publicAPI - Object on which methods will be bound (public).
|
|
51
|
+
* @param model - Object on which data structure will be bound (protected).
|
|
52
|
+
* @param initialValues - (Optional) Initial values to assign to the model.
|
|
53
|
+
*/
|
|
54
|
+
export function extend(
|
|
55
|
+
publicAPI: object,
|
|
56
|
+
model: object,
|
|
57
|
+
initialValues?: IContourLoopExtractionInitialValues
|
|
58
|
+
): void;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Method used to create a new instance of vtkContourLoopExtraction.
|
|
62
|
+
*
|
|
63
|
+
* @param initialValues - (Optional) Initial values for the instance.
|
|
64
|
+
*/
|
|
65
|
+
export function newInstance(
|
|
66
|
+
initialValues?: IContourLoopExtractionInitialValues
|
|
67
|
+
): vtkContourLoopExtraction;
|
|
68
|
+
|
|
69
|
+
// ----------------------------------------------------------------------------
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* vtkContourLoopExtraction specific static methods.
|
|
73
|
+
*/
|
|
74
|
+
export declare const vtkContourLoopExtraction: {
|
|
75
|
+
newInstance: typeof newInstance;
|
|
76
|
+
extend: typeof extend;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default vtkContourLoopExtraction;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { m as macro } from '../../macros2.js';
|
|
2
|
+
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
3
|
+
|
|
4
|
+
const Dir = {
|
|
5
|
+
Forward: 1,
|
|
6
|
+
Backward: -1
|
|
7
|
+
};
|
|
8
|
+
const visited = new Set();
|
|
9
|
+
function vtkContourLoopExtraction(publicAPI, model) {
|
|
10
|
+
publicAPI.requestData = (inData, outData) => {
|
|
11
|
+
const [input] = inData;
|
|
12
|
+
if (!outData[0]) {
|
|
13
|
+
outData[0] = vtkPolyData.newInstance();
|
|
14
|
+
}
|
|
15
|
+
const [output] = outData;
|
|
16
|
+
publicAPI.extractContours(input, output);
|
|
17
|
+
output.modified();
|
|
18
|
+
};
|
|
19
|
+
publicAPI.traverseLoop = (pd, dir, startLineId, startPtId, loopPoints) => {
|
|
20
|
+
let lineId = startLineId;
|
|
21
|
+
let lastPtId = startPtId;
|
|
22
|
+
let terminated = false;
|
|
23
|
+
let numInserted = 0;
|
|
24
|
+
while (!terminated) {
|
|
25
|
+
const {
|
|
26
|
+
cellPointIds
|
|
27
|
+
} = pd.getCellPoints(lineId);
|
|
28
|
+
if (!cellPointIds) {
|
|
29
|
+
// eslint-disable-next-line no-continue
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
lastPtId = cellPointIds[0] !== lastPtId ? cellPointIds[0] : cellPointIds[1];
|
|
33
|
+
numInserted++;
|
|
34
|
+
|
|
35
|
+
// parametric point value
|
|
36
|
+
const t = dir * numInserted;
|
|
37
|
+
loopPoints.push({
|
|
38
|
+
t,
|
|
39
|
+
ptId: lastPtId
|
|
40
|
+
});
|
|
41
|
+
const lineCell = pd.getPointCells(lastPtId);
|
|
42
|
+
if (lineCell.length !== 2 || lastPtId === startPtId) {
|
|
43
|
+
// looped
|
|
44
|
+
return lastPtId;
|
|
45
|
+
}
|
|
46
|
+
if (lineCell.length === 2) {
|
|
47
|
+
// continue along loop
|
|
48
|
+
lineId = lineCell[0] !== lineId ? lineCell[0] : lineCell[1];
|
|
49
|
+
visited.add(lineId);
|
|
50
|
+
} else {
|
|
51
|
+
// empty or invalid cell
|
|
52
|
+
terminated = true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return lastPtId;
|
|
56
|
+
};
|
|
57
|
+
publicAPI.extractContours = (input, output) => {
|
|
58
|
+
const loops = [];
|
|
59
|
+
visited.clear();
|
|
60
|
+
const inLines = input.getLines();
|
|
61
|
+
output.getPoints().setData(Float32Array.from(input.getPoints().getData()));
|
|
62
|
+
|
|
63
|
+
// TODO skip if cached input mtime hasn't changed.
|
|
64
|
+
// iterate over input lines
|
|
65
|
+
for (let li = 0; li < inLines.getNumberOfCells(); li++) {
|
|
66
|
+
if (visited.has(li)) {
|
|
67
|
+
// eslint-disable-next-line no-continue
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const {
|
|
71
|
+
cellPointIds
|
|
72
|
+
} = input.getCellPoints(li);
|
|
73
|
+
if (!cellPointIds) {
|
|
74
|
+
// eslint-disable-next-line no-continue
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
visited.add(li);
|
|
78
|
+
const startPtId = cellPointIds[0];
|
|
79
|
+
const loopPoints = [];
|
|
80
|
+
loopPoints.push({
|
|
81
|
+
t: 0,
|
|
82
|
+
ptId: startPtId
|
|
83
|
+
});
|
|
84
|
+
const endPtId = publicAPI.traverseLoop(input, Dir.Forward, li, startPtId, loopPoints);
|
|
85
|
+
if (startPtId !== endPtId) {
|
|
86
|
+
// didn't find a loop. Go other direction to see where we end up
|
|
87
|
+
publicAPI.traverseLoop(input, Dir.Backward, li, startPtId, loopPoints);
|
|
88
|
+
loopPoints.sort((a, b) => a.t < b.t ? -1 : 1);
|
|
89
|
+
// make closed contour
|
|
90
|
+
if (loopPoints.length && loopPoints[0].ptId !== loopPoints[loopPoints.length - 1]?.ptId) {
|
|
91
|
+
loopPoints.push({
|
|
92
|
+
...loopPoints[loopPoints.length - 1]
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (loopPoints.length) {
|
|
97
|
+
loops.push(loopPoints);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// clear output lines
|
|
102
|
+
const outLines = output.getLines();
|
|
103
|
+
outLines.resize(0);
|
|
104
|
+
loops.forEach(loop => {
|
|
105
|
+
outLines.insertNextCell(loop.map(pt => pt.ptId));
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// ----------------------------------------------------------------------------
|
|
111
|
+
// Object factory
|
|
112
|
+
// ----------------------------------------------------------------------------
|
|
113
|
+
|
|
114
|
+
const DEFAULT_VALUES = {};
|
|
115
|
+
|
|
116
|
+
// ----------------------------------------------------------------------------
|
|
117
|
+
|
|
118
|
+
function extend(publicAPI, model) {
|
|
119
|
+
let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
120
|
+
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
121
|
+
macro.obj(publicAPI, model);
|
|
122
|
+
macro.algo(publicAPI, model, 1, 1);
|
|
123
|
+
vtkContourLoopExtraction(publicAPI);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ----------------------------------------------------------------------------
|
|
127
|
+
|
|
128
|
+
const newInstance = macro.newInstance(extend, 'vtkContourLoopExtraction');
|
|
129
|
+
|
|
130
|
+
// ----------------------------------------------------------------------------
|
|
131
|
+
|
|
132
|
+
var index = {
|
|
133
|
+
newInstance,
|
|
134
|
+
extend
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export { index as default, extend, newInstance };
|
|
@@ -35,7 +35,7 @@ function vtkScalarToRGBA(publicAPI, model) {
|
|
|
35
35
|
}
|
|
36
36
|
const rgba = [0, 0, 0, 0];
|
|
37
37
|
const data = scalars.getData();
|
|
38
|
-
const rgbaArray = new
|
|
38
|
+
const rgbaArray = new Uint8ClampedArray(data.length * 4);
|
|
39
39
|
let offset = 0;
|
|
40
40
|
for (let idx = 0; idx < data.length; idx++) {
|
|
41
41
|
const x = data[idx];
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import vtkCompositeMouseManipulator, {
|
|
2
2
|
ICompositeMouseManipulatorInitialValues,
|
|
3
3
|
} from './CompositeMouseManipulator';
|
|
4
|
+
import { vtkObject } from './../../interfaces';
|
|
4
5
|
|
|
5
6
|
export interface IMouseRangeManipulatorInitialValues
|
|
6
7
|
extends ICompositeMouseManipulatorInitialValues {}
|
|
7
8
|
|
|
8
|
-
export interface vtkMouseRangeManipulator
|
|
9
|
+
export interface vtkMouseRangeManipulator
|
|
10
|
+
extends vtkCompositeMouseManipulator,
|
|
11
|
+
vtkObject {
|
|
9
12
|
setHorizontalListener(
|
|
10
13
|
min: number,
|
|
11
14
|
max: number,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { vtkObject } from './../../interfaces';
|
|
2
|
-
import
|
|
3
|
-
import vtkAxesActor from './../../Rendering/Core/AxesActor';
|
|
2
|
+
import vtkActor from './../../Rendering/Core/Actor';
|
|
4
3
|
import vtkRenderer from './../../Rendering/Core/Renderer';
|
|
5
4
|
import vtkRenderWindowInteractor from './../../Rendering/Core/RenderWindowInteractor';
|
|
6
5
|
import { Nullable } from './../../types';
|
|
@@ -11,7 +10,7 @@ import { Corners } from './OrientationMarkerWidget/Constants';
|
|
|
11
10
|
*
|
|
12
11
|
*/
|
|
13
12
|
export interface IOrientationMarkerWidgetInitialValues {
|
|
14
|
-
actor?:
|
|
13
|
+
actor?: vtkActor,
|
|
15
14
|
interactor?: vtkRenderWindowInteractor,
|
|
16
15
|
parentRenderer?: vtkRenderer,
|
|
17
16
|
viewportCorner?: Corners,
|
|
@@ -39,7 +38,7 @@ export interface vtkOrientationMarkerWidget extends vtkObject {
|
|
|
39
38
|
/**
|
|
40
39
|
*
|
|
41
40
|
*/
|
|
42
|
-
getActor():
|
|
41
|
+
getActor(): vtkActor;
|
|
43
42
|
|
|
44
43
|
/**
|
|
45
44
|
* Gets the parent renderer, if any.
|
|
@@ -85,9 +84,9 @@ export interface vtkOrientationMarkerWidget extends vtkObject {
|
|
|
85
84
|
|
|
86
85
|
/**
|
|
87
86
|
* Get the actor associated with the widget.
|
|
88
|
-
* @param {
|
|
87
|
+
* @param {vtkActor} actor The actor instance.
|
|
89
88
|
*/
|
|
90
|
-
setActor(actor:
|
|
89
|
+
setActor(actor: vtkActor): void;
|
|
91
90
|
|
|
92
91
|
/**
|
|
93
92
|
* Sets the parent renderer
|
|
@@ -24,7 +24,7 @@ function shiftDataset(ds, axis) {
|
|
|
24
24
|
|
|
25
25
|
function addColor(ds, r, g, b) {
|
|
26
26
|
const size = ds.getPoints().getData().length;
|
|
27
|
-
const rgbArray = new
|
|
27
|
+
const rgbArray = new Uint8ClampedArray(size);
|
|
28
28
|
let offset = 0;
|
|
29
29
|
while (offset < size) {
|
|
30
30
|
rgbArray[offset++] = r;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A helper file to transform RGBA points using CSS filters equivalent
|
|
3
|
+
* The equivalents of CSS filters using SVG filters can be found here:
|
|
4
|
+
* https://www.w3.org/TR/filter-effects-1/#ShorthandEquivalents
|
|
5
|
+
* For each SVG filter, you can look for the maths behind it on the same page:
|
|
6
|
+
* https://www.w3.org/TR/filter-effects-1/#FilterPrimitivesOverview
|
|
7
|
+
*
|
|
8
|
+
* For example, the saturate filter equivalent is here:
|
|
9
|
+
* https://www.w3.org/TR/filter-effects-1/#saturateEquivalent
|
|
10
|
+
* And the maths behind the feColorMatrix of type saturate is here:
|
|
11
|
+
* https://www.w3.org/TR/filter-effects-1/#ref-for-attr-valuedef-type-saturate
|
|
12
|
+
*
|
|
13
|
+
* The transforms are done using matrices of size 5 by 5. They are row major
|
|
14
|
+
* as in vtkMath. The vectors representing the RGBA points uses
|
|
15
|
+
* [R, G, B, A, 1] vectors, with each channel between 0 and 1.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { Matrix, Vector3 } from '../../../types';
|
|
19
|
+
|
|
20
|
+
export const luminanceWeights: Vector3;
|
|
21
|
+
export type FilterMatrix = Matrix;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Create a new filter matrix
|
|
25
|
+
* This is a 5x5 row major array
|
|
26
|
+
* Use applyFilter() function to use it
|
|
27
|
+
* It is NOT the identity
|
|
28
|
+
*/
|
|
29
|
+
export function createCSSFilter(): FilterMatrix;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Convert a filter to an identity matrix or create a new identity filter
|
|
33
|
+
* @param outFilter If specified, the outFilter is converted to identity filter
|
|
34
|
+
*/
|
|
35
|
+
export function createIdentityFilter(outFilter?: FilterMatrix): FilterMatrix;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Combine two filters into a single filter
|
|
39
|
+
* Warning: it is NOT an operation inspired by CSS filters
|
|
40
|
+
* For this, apply filters one by one using applyFilter
|
|
41
|
+
* The clamping step is not applied between each filter when the filters are combined
|
|
42
|
+
* The order of the filters matters
|
|
43
|
+
* @param baseFilter The first filter that will be applied
|
|
44
|
+
* @param newFilter The second filter that will be applied
|
|
45
|
+
* @param outFilter An optional filter that will contain the combined filter
|
|
46
|
+
*/
|
|
47
|
+
export function combineFilters(baseFilter: FilterMatrix, newFilter: FilterMatrix, outFilter?: FilterMatrix): FilterMatrix;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Apply a filter to a rgb(a) point
|
|
51
|
+
* It is a multiplication by the matrix and a clamping
|
|
52
|
+
* @param filter The filter
|
|
53
|
+
* @param r The red channel (between 0 and 1)
|
|
54
|
+
* @param g The green channel (between 0 and 1)
|
|
55
|
+
* @param b The blue channel (between 0 and 1)
|
|
56
|
+
* @param a The optional alpha channel (between 0 and 1), defaults to 1
|
|
57
|
+
* @returns A vector of size 4 [r, g, b, a]
|
|
58
|
+
*/
|
|
59
|
+
export function applyFilter(filter: FilterMatrix, r: number, g: number, b: number, a?: number): [number, number, number, number];
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A generic linear filter
|
|
63
|
+
* See svg equivalent for parameters and a specification
|
|
64
|
+
* https://www.w3.org/TR/filter-effects-1/#attr-valuedef-type-linear
|
|
65
|
+
* @param slope
|
|
66
|
+
* @param intercept
|
|
67
|
+
* @param outFilter Optional output, a new filter is created if not specified
|
|
68
|
+
*/
|
|
69
|
+
export function createLinearFilter(slope: number, intercept: number, outFilter?: FilterMatrix): FilterMatrix;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* A contrast filter
|
|
73
|
+
* See css/svg equivalent for parameters and a specification
|
|
74
|
+
* https://www.w3.org/TR/filter-effects-1/#contrastEquivalent
|
|
75
|
+
* https://www.w3.org/TR/filter-effects-1/#attr-valuedef-type-linear
|
|
76
|
+
* @param contrast
|
|
77
|
+
* @param outFilter Optional output, a new filter is created if not specified
|
|
78
|
+
*/
|
|
79
|
+
export function createContrastFilter(contrast: number, outFilter?: FilterMatrix): FilterMatrix;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* A saturate filter
|
|
83
|
+
* See css/svg equivalent for parameters and a specification
|
|
84
|
+
* https://www.w3.org/TR/filter-effects-1/#saturateEquivalent
|
|
85
|
+
* https://www.w3.org/TR/filter-effects-1/#ref-for-attr-valuedef-type-saturate
|
|
86
|
+
* @param saturate
|
|
87
|
+
* @param outFilter Optional output, a new filter is created if not specified
|
|
88
|
+
*/
|
|
89
|
+
export function createSaturateFilter(saturate: number, outFilter?: FilterMatrix): FilterMatrix;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A brightness filter
|
|
93
|
+
* See css/svg equivalent for parameters and a specification
|
|
94
|
+
* https://www.w3.org/TR/filter-effects-1/#brightnessEquivalent
|
|
95
|
+
* https://www.w3.org/TR/filter-effects-1/#attr-valuedef-type-linear
|
|
96
|
+
* @param brightness
|
|
97
|
+
* @param outFilter Optional output, a new filter is created if not specified
|
|
98
|
+
*/
|
|
99
|
+
export function createBrightnessFilter(brightness: number, outFilter?: FilterMatrix): FilterMatrix;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* An invert filter
|
|
103
|
+
* See css/svg equivalent for parameters and a specification
|
|
104
|
+
* https://www.w3.org/TR/filter-effects-1/#invertEquivalent
|
|
105
|
+
* https://www.w3.org/TR/filter-effects-1/#attr-valuedef-type-table
|
|
106
|
+
* @param invert
|
|
107
|
+
* @param outFilter Optional output, a new filter is created if not specified
|
|
108
|
+
*/
|
|
109
|
+
export function createInvertFilter(invert: number, outFilter?: FilterMatrix): FilterMatrix;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { H as identity, I as multiplyMatrix } from '../../../Common/Core/Math/index.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A helper file to transform RGBA points using CSS filters equivalent
|
|
5
|
+
* The equivalents of CSS filters using SVG filters can be found here:
|
|
6
|
+
* https://www.w3.org/TR/filter-effects-1/#ShorthandEquivalents
|
|
7
|
+
* For each SVG filter, you can look for the maths behind it on the same page:
|
|
8
|
+
* https://www.w3.org/TR/filter-effects-1/#FilterPrimitivesOverview
|
|
9
|
+
*
|
|
10
|
+
* For example, the saturate filter equivalent is here:
|
|
11
|
+
* https://www.w3.org/TR/filter-effects-1/#saturateEquivalent
|
|
12
|
+
* And the maths behind the feColorMatrix of type saturate is here:
|
|
13
|
+
* https://www.w3.org/TR/filter-effects-1/#ref-for-attr-valuedef-type-saturate
|
|
14
|
+
*
|
|
15
|
+
* The transforms are done using matrices of size 5 by 5. They are row major
|
|
16
|
+
* as in vtkMath. The vectors representing the RGBA points uses
|
|
17
|
+
* [R, G, B, A, 1] vectors, with each channel between 0 and 1.
|
|
18
|
+
*/
|
|
19
|
+
const luminanceWeights = [0.213, 0.715, 0.072];
|
|
20
|
+
function createCSSFilter() {
|
|
21
|
+
return new Array(25);
|
|
22
|
+
}
|
|
23
|
+
function createIdentityFilter() {
|
|
24
|
+
let outFilter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : createCSSFilter();
|
|
25
|
+
return identity(5, outFilter);
|
|
26
|
+
}
|
|
27
|
+
function combineFilters(baseFilter, newFilter) {
|
|
28
|
+
let outFilter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createCSSFilter();
|
|
29
|
+
multiplyMatrix(newFilter, baseFilter, 5, 5, 5, 5, outFilter);
|
|
30
|
+
return outFilter;
|
|
31
|
+
}
|
|
32
|
+
function applyFilter(filter, r, g, b) {
|
|
33
|
+
let a = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
|
|
34
|
+
const vec = [r, g, b, a, 1];
|
|
35
|
+
multiplyMatrix(filter, vec, 5, 5, 5, 1, vec);
|
|
36
|
+
// Clamp R, G, B, A
|
|
37
|
+
const output = new Array(4);
|
|
38
|
+
for (let i = 0; i < 4; ++i) {
|
|
39
|
+
const value = vec[i];
|
|
40
|
+
if (value < 0) {
|
|
41
|
+
output[i] = 0;
|
|
42
|
+
} else if (value > 1) {
|
|
43
|
+
output[i] = 1;
|
|
44
|
+
} else {
|
|
45
|
+
output[i] = value;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return output;
|
|
49
|
+
}
|
|
50
|
+
function createLinearFilter(slope, intercept) {
|
|
51
|
+
let outFilter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createCSSFilter();
|
|
52
|
+
createIdentityFilter(outFilter);
|
|
53
|
+
for (let row = 0; row < 3; ++row) {
|
|
54
|
+
outFilter[row * 5 + row] = slope;
|
|
55
|
+
outFilter[row * 5 + 4] = intercept;
|
|
56
|
+
}
|
|
57
|
+
return outFilter;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// https://www.w3.org/TR/filter-effects-1/#contrastEquivalent
|
|
61
|
+
// https://www.w3.org/TR/filter-effects-1/#attr-valuedef-type-linear
|
|
62
|
+
function createContrastFilter(contrast) {
|
|
63
|
+
let outFilter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createCSSFilter();
|
|
64
|
+
const slope = contrast;
|
|
65
|
+
const intercept = -(0.5 * contrast) + 0.5;
|
|
66
|
+
return createLinearFilter(slope, intercept, outFilter);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// https://www.w3.org/TR/filter-effects-1/#saturateEquivalent
|
|
70
|
+
// https://www.w3.org/TR/filter-effects-1/#ref-for-attr-valuedef-type-saturate
|
|
71
|
+
function createSaturateFilter(saturate) {
|
|
72
|
+
let outFilter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createCSSFilter();
|
|
73
|
+
createIdentityFilter(outFilter);
|
|
74
|
+
for (let col = 0; col < 3; ++col) {
|
|
75
|
+
const columnLuminance = luminanceWeights[col];
|
|
76
|
+
const diagonalValue = columnLuminance + (1 - columnLuminance) * saturate;
|
|
77
|
+
const nonDiagonalValue = columnLuminance - columnLuminance * saturate;
|
|
78
|
+
for (let row = 0; row < 3; ++row) {
|
|
79
|
+
outFilter[row * 5 + col] = row === col ? diagonalValue : nonDiagonalValue;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return outFilter;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// https://www.w3.org/TR/filter-effects-1/#brightnessEquivalent
|
|
86
|
+
// https://www.w3.org/TR/filter-effects-1/#attr-valuedef-type-linear
|
|
87
|
+
function createBrightnessFilter(brightness) {
|
|
88
|
+
let outFilter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createCSSFilter();
|
|
89
|
+
const slope = brightness;
|
|
90
|
+
const intercept = 0;
|
|
91
|
+
return createLinearFilter(slope, intercept, outFilter);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// https://www.w3.org/TR/filter-effects-1/#invertEquivalent
|
|
95
|
+
// https://www.w3.org/TR/filter-effects-1/#attr-valuedef-type-table
|
|
96
|
+
function createInvertFilter(invert) {
|
|
97
|
+
let outFilter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createCSSFilter();
|
|
98
|
+
const slope = 1 - 2 * invert;
|
|
99
|
+
const intercept = invert;
|
|
100
|
+
return createLinearFilter(slope, intercept, outFilter);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { applyFilter, combineFilters, createBrightnessFilter, createCSSFilter, createContrastFilter, createIdentityFilter, createInvertFilter, createLinearFilter, createSaturateFilter, luminanceWeights };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
|
-
import { h as hsv2rgb, i as isNan,
|
|
2
|
+
import { h as hsv2rgb, i as isNan, J as floor, K as isInf, L as rgb2hsv, M as rgb2lab, N as lab2rgb } from '../../Common/Core/Math/index.js';
|
|
3
3
|
import vtkScalarsToColors from '../../Common/Core/ScalarsToColors.js';
|
|
4
4
|
import Constants from './ColorTransferFunction/Constants.js';
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
2
|
import Constants from './Coordinate/Constants.js';
|
|
3
|
-
import {
|
|
3
|
+
import { O as round, J as floor } from '../../Common/Core/Math/index.js';
|
|
4
4
|
|
|
5
5
|
const {
|
|
6
6
|
Coordinate
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { vec3, mat4 } from 'gl-matrix';
|
|
2
2
|
import * as d3 from 'd3-scale';
|
|
3
|
-
import {
|
|
3
|
+
import { P as normalize2D, Q as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
|
|
4
4
|
import { m as macro } from '../../macros2.js';
|
|
5
5
|
import vtkActor from './Actor.js';
|
|
6
6
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
@@ -2,7 +2,7 @@ import Constants from './ImageMapper/Constants.js';
|
|
|
2
2
|
import { m as macro } from '../../macros2.js';
|
|
3
3
|
import vtkAbstractImageMapper from './AbstractImageMapper.js';
|
|
4
4
|
import { intersectWithLineForPointPicking, intersectWithLineForCellPicking } from './AbstractImageMapper/helper.js';
|
|
5
|
-
import { C as clampValue,
|
|
5
|
+
import { C as clampValue, R as multiply3x3_vect3, F as createUninitializedBounds, S as getSparseOrthogonalMatrix } from '../../Common/Core/Math/index.js';
|
|
6
6
|
import CoincidentTopologyHelper from './Mapper/CoincidentTopologyHelper.js';
|
|
7
7
|
|
|
8
8
|
const {
|
|
@@ -396,6 +396,11 @@ export interface vtkRenderWindowInteractor extends vtkObject {
|
|
|
396
396
|
*/
|
|
397
397
|
invokeEndInteractionEvent(callData: IRenderWindowInteractorEvent): void;
|
|
398
398
|
|
|
399
|
+
/**
|
|
400
|
+
*
|
|
401
|
+
*/
|
|
402
|
+
invokeRenderEvent(): void;
|
|
403
|
+
|
|
399
404
|
/**
|
|
400
405
|
*
|
|
401
406
|
* @param cb The callback to be called
|
|
@@ -659,6 +664,13 @@ export interface vtkRenderWindowInteractor extends vtkObject {
|
|
|
659
664
|
*/
|
|
660
665
|
onEndInteractionEvent(cb: InteractorEventCallback, priority?: number): Readonly<vtkSubscription>;
|
|
661
666
|
|
|
667
|
+
/**
|
|
668
|
+
*
|
|
669
|
+
* @param {Function} cb The callback to be called.
|
|
670
|
+
* @param {Number} [priority] The priority of the event.
|
|
671
|
+
*/
|
|
672
|
+
onRenderEvent(cb: () => void, priority?: number): Readonly<vtkSubscription>;
|
|
673
|
+
|
|
662
674
|
/**
|
|
663
675
|
*
|
|
664
676
|
* @param args
|
|
@@ -2,7 +2,7 @@ import { mat4, vec3 } from 'gl-matrix';
|
|
|
2
2
|
import { n as newInstance$1, g as get, e as setGet, k as getArray, l as setGetArray, i as moveToProtected, c as macro } from '../../macros2.js';
|
|
3
3
|
import vtkCamera from './Camera.js';
|
|
4
4
|
import vtkLight from './Light.js';
|
|
5
|
-
import {
|
|
5
|
+
import { T as areBoundsInitialized, u as uninitializeBounds, r as radiansFromDegrees, d as dot, F as createUninitializedBounds } from '../../Common/Core/Math/index.js';
|
|
6
6
|
import vtkViewport from './Viewport.js';
|
|
7
7
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as d3 from 'd3-scale';
|
|
2
|
-
import {
|
|
2
|
+
import { Q as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
|
|
3
3
|
import { m as macro } from '../../macros2.js';
|
|
4
4
|
import vtkActor from './Actor.js';
|
|
5
5
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
|
-
import { F as createUninitializedBounds, C as clampValue,
|
|
2
|
+
import { F as createUninitializedBounds, C as clampValue, J as floor } from '../../Common/Core/Math/index.js';
|
|
3
3
|
import Constants from './VolumeMapper/Constants.js';
|
|
4
4
|
import vtkAbstractMapper from './AbstractMapper.js';
|
|
5
5
|
import vtkPiecewiseFunction from '../../Common/DataModel/PiecewiseFunction.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import vtkPiecewiseFunction from './../../Common/DataModel/PiecewiseFunction';
|
|
2
2
|
import { vtkObject } from './../../interfaces';
|
|
3
|
+
import { Nullable } from './../../types';
|
|
3
4
|
import vtkColorTransferFunction from './ColorTransferFunction';
|
|
4
5
|
import { InterpolationType, OpacityMode } from './VolumeProperty/Constants';
|
|
5
6
|
|
|
@@ -279,14 +280,14 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
279
280
|
* @param {Number} index
|
|
280
281
|
* @param {vtkColorTransferFunction} func
|
|
281
282
|
*/
|
|
282
|
-
setRGBTransferFunction(index: number, func
|
|
283
|
+
setRGBTransferFunction(index: number, func?: Nullable<vtkColorTransferFunction>): boolean;
|
|
283
284
|
|
|
284
285
|
/**
|
|
285
286
|
* Set the scalar opacity of a volume to a transfer function
|
|
286
287
|
* @param {Number} index
|
|
287
288
|
* @param {vtkPiecewiseFunction} func
|
|
288
289
|
*/
|
|
289
|
-
setScalarOpacity(index: number, func
|
|
290
|
+
setScalarOpacity(index: number, func?: Nullable<vtkPiecewiseFunction>): boolean;
|
|
290
291
|
|
|
291
292
|
/**
|
|
292
293
|
* Set the scalar component weights.
|
|
@@ -188,7 +188,7 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
|
|
|
188
188
|
if (model.colorTextureString !== cfunToString) {
|
|
189
189
|
const cWidth = 1024;
|
|
190
190
|
const cSize = cWidth * textureHeight * 3;
|
|
191
|
-
const cTable = new
|
|
191
|
+
const cTable = new Uint8ClampedArray(cSize);
|
|
192
192
|
let cfun = ppty.getRGBTransferFunction();
|
|
193
193
|
if (cfun) {
|
|
194
194
|
const tmpTable = new Float32Array(cWidth * 3);
|
|
@@ -228,7 +228,7 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
|
|
|
228
228
|
if (model.pwfTextureString !== pwfunToString) {
|
|
229
229
|
const pwfWidth = 1024;
|
|
230
230
|
const pwfSize = pwfWidth * textureHeight;
|
|
231
|
-
const pwfTable = new
|
|
231
|
+
const pwfTable = new Uint8ClampedArray(pwfSize);
|
|
232
232
|
let pwfun = ppty.getPiecewiseFunction();
|
|
233
233
|
// support case where pwfun is added/removed
|
|
234
234
|
model.pwfTexture.releaseGraphicsResources(model._openGLRenderWindow);
|
|
@@ -582,7 +582,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
|
|
|
582
582
|
if (reBuildC) {
|
|
583
583
|
const cWidth = 1024;
|
|
584
584
|
const cSize = cWidth * textureHeight * 3;
|
|
585
|
-
const cTable = new
|
|
585
|
+
const cTable = new Uint8ClampedArray(cSize);
|
|
586
586
|
if (!model.colorTexture) {
|
|
587
587
|
model.colorTexture = vtkOpenGLTexture.newInstance({
|
|
588
588
|
resizable: true
|
|
@@ -645,7 +645,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
|
|
|
645
645
|
if (reBuildPwf) {
|
|
646
646
|
const pwfWidth = 1024;
|
|
647
647
|
const pwfSize = pwfWidth * textureHeight;
|
|
648
|
-
const pwfTable = new
|
|
648
|
+
const pwfTable = new Uint8ClampedArray(pwfSize);
|
|
649
649
|
if (!model.pwfTexture) {
|
|
650
650
|
model.pwfTexture = vtkOpenGLTexture.newInstance({
|
|
651
651
|
resizable: true
|
|
@@ -213,7 +213,7 @@ function vtkOpenGLImageResliceMapper(publicAPI, model) {
|
|
|
213
213
|
if (reBuildC) {
|
|
214
214
|
const cWidth = 1024;
|
|
215
215
|
const cSize = cWidth * textureHeight * 3;
|
|
216
|
-
const cTable = new
|
|
216
|
+
const cTable = new Uint8ClampedArray(cSize);
|
|
217
217
|
if (!model.colorTexture) {
|
|
218
218
|
model.colorTexture = vtkOpenGLTexture.newInstance();
|
|
219
219
|
model.colorTexture.setOpenGLRenderWindow(model._openGLRenderWindow);
|
|
@@ -268,7 +268,7 @@ function vtkOpenGLImageResliceMapper(publicAPI, model) {
|
|
|
268
268
|
if (reBuildPwf) {
|
|
269
269
|
const pwfWidth = 1024;
|
|
270
270
|
const pwfSize = pwfWidth * textureHeight;
|
|
271
|
-
const pwfTable = new
|
|
271
|
+
const pwfTable = new Uint8ClampedArray(pwfSize);
|
|
272
272
|
if (!model.pwfTexture) {
|
|
273
273
|
model.pwfTexture = vtkOpenGLTexture.newInstance();
|
|
274
274
|
model.pwfTexture.setOpenGLRenderWindow(model._openGLRenderWindow);
|
|
@@ -8,7 +8,7 @@ import { v as vtkPolyData2DVS } from './glsl/vtkPolyData2DVS.glsl.js';
|
|
|
8
8
|
import vtkReplacementShaderMapper from './ReplacementShaderMapper.js';
|
|
9
9
|
import vtkShaderProgram from './ShaderProgram.js';
|
|
10
10
|
import vtkViewNode from '../SceneGraph/ViewNode.js';
|
|
11
|
-
import {
|
|
11
|
+
import { O as round } from '../../Common/Core/Math/index.js';
|
|
12
12
|
import { DisplayLocation } from '../Core/Property2D/Constants.js';
|
|
13
13
|
import { registerOverride } from './ViewNodeFactory.js';
|
|
14
14
|
|
|
@@ -80,7 +80,7 @@ export interface vtkOpenGLRenderWindow extends vtkOpenGLRenderWindowBase {
|
|
|
80
80
|
*
|
|
81
81
|
* @param {HTMLElement} el The container element.
|
|
82
82
|
*/
|
|
83
|
-
setContainer(el: HTMLElement): void;
|
|
83
|
+
setContainer(el: Nullable<HTMLElement>): void;
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
86
|
* Get the container element.
|
|
@@ -2,7 +2,7 @@ import Constants from './Texture/Constants.js';
|
|
|
2
2
|
import HalfFloat from '../../Common/Core/HalfFloat.js';
|
|
3
3
|
import { n as newInstance$1, o as obj, s as set, e as setGet, g as get, i as moveToProtected, a as newTypedArray, c as macro } from '../../macros2.js';
|
|
4
4
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
5
|
-
import {
|
|
5
|
+
import { U as isPowerOfTwo, Q as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
|
|
6
6
|
import vtkViewNode from '../SceneGraph/ViewNode.js';
|
|
7
7
|
import { registerOverride } from './ViewNodeFactory.js';
|
|
8
8
|
|
|
@@ -1006,7 +1006,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
|
|
|
1006
1006
|
if (model._openGLRenderWindow.getWebgl2() || model.context.getExtension('OES_texture_float') && model.context.getExtension('OES_texture_float_linear')) {
|
|
1007
1007
|
model.opacityTexture.create2DFromRaw(oWidth, 2 * numIComps, 1, VtkDataTypes.FLOAT, ofTable);
|
|
1008
1008
|
} else {
|
|
1009
|
-
const oTable = new
|
|
1009
|
+
const oTable = new Uint8ClampedArray(oSize);
|
|
1010
1010
|
for (let i = 0; i < oSize; ++i) {
|
|
1011
1011
|
oTable[i] = 255.0 * ofTable[i];
|
|
1012
1012
|
}
|
|
@@ -1029,7 +1029,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
|
|
|
1029
1029
|
if (reBuildC) {
|
|
1030
1030
|
const cWidth = 1024;
|
|
1031
1031
|
const cSize = cWidth * 2 * numIComps * 3;
|
|
1032
|
-
const cTable = new
|
|
1032
|
+
const cTable = new Uint8ClampedArray(cSize);
|
|
1033
1033
|
const tmpTable = new Float32Array(cWidth * 3);
|
|
1034
1034
|
for (let c = 0; c < numIComps; ++c) {
|
|
1035
1035
|
const cfun = vprop.getRGBTransferFunction(c);
|
|
@@ -230,7 +230,7 @@ function vtkWebGPUImageMapper(publicAPI, model) {
|
|
|
230
230
|
const cfunToString = computeFnToString(actorProperty, actorProperty.getRGBTransferFunction, numIComps);
|
|
231
231
|
if (model.colorTextureString !== cfunToString) {
|
|
232
232
|
model.numRows = numIComps;
|
|
233
|
-
const colorArray = new
|
|
233
|
+
const colorArray = new Uint8ClampedArray(model.numRows * 2 * model.rowLength * 4);
|
|
234
234
|
let cfun = actorProperty.getRGBTransferFunction();
|
|
235
235
|
if (cfun) {
|
|
236
236
|
const tmpTable = new Float32Array(model.rowLength * 3);
|
|
@@ -245,7 +245,7 @@ function vtkWebGPUSphereMapper(publicAPI, model) {
|
|
|
245
245
|
if (colorComponents !== 4) {
|
|
246
246
|
vtkErrorMacro('this should be 4');
|
|
247
247
|
}
|
|
248
|
-
const tmpVBO = new
|
|
248
|
+
const tmpVBO = new Uint8ClampedArray(3 * numPoints * 4);
|
|
249
249
|
let vboIdx = 0;
|
|
250
250
|
const colorData = c.getData();
|
|
251
251
|
for (let id = 0; id < numPoints; ++id) {
|
|
@@ -362,7 +362,7 @@ function vtkWebGPUStickMapper(publicAPI, model) {
|
|
|
362
362
|
if (colorComponents !== 4) {
|
|
363
363
|
vtkErrorMacro('this should be 4');
|
|
364
364
|
}
|
|
365
|
-
const tmpVBO = new
|
|
365
|
+
const tmpVBO = new Uint8ClampedArray(numPoints * 4);
|
|
366
366
|
let vboIdx = 0;
|
|
367
367
|
const colorData = c.getData();
|
|
368
368
|
for (let id = 0; id < numPoints; ++id) {
|
|
@@ -484,7 +484,7 @@ function vtkWebGPUVolumePassFSQ(publicAPI, model) {
|
|
|
484
484
|
}
|
|
485
485
|
|
|
486
486
|
// allocate the image array
|
|
487
|
-
const colorArray = new
|
|
487
|
+
const colorArray = new Uint8ClampedArray(model.numRows * 2 * model.rowLength * 4);
|
|
488
488
|
const opacityArray = new Float32Array(model.numRows * 2 * model.rowLength);
|
|
489
489
|
let imgRow = 0;
|
|
490
490
|
const tmpTable = new Float32Array(model.rowLength * 3);
|
|
@@ -3,7 +3,7 @@ import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
|
|
|
3
3
|
import vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
|
|
4
4
|
import vtkPolyLineRepresentation from '../Representations/PolyLineRepresentation.js';
|
|
5
5
|
import vtkSphereHandleRepresentation from '../Representations/SphereHandleRepresentation.js';
|
|
6
|
-
import { s as subtract,
|
|
6
|
+
import { s as subtract, V as angleBetweenVectors } from '../../Common/Core/Math/index.js';
|
|
7
7
|
import widgetBehavior from './AngleWidget/behavior.js';
|
|
8
8
|
import generateState from './AngleWidget/state.js';
|
|
9
9
|
import { ViewTypes } from '../Core/WidgetManager/Constants.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { m as macro } from '../../../macros2.js';
|
|
2
2
|
import vtkBoundingBox from '../../../Common/DataModel/BoundingBox.js';
|
|
3
3
|
import vtkLine from '../../../Common/DataModel/Line.js';
|
|
4
|
-
import { k as add, l as normalize, s as subtract, d as dot, j as cross, m as multiplyAccumulate, w as multiplyScalar,
|
|
4
|
+
import { k as add, l as normalize, s as subtract, d as dot, j as cross, m as multiplyAccumulate, w as multiplyScalar, W as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
|
|
5
5
|
import { getLineNames, getOtherLineName, updateState, boundPointOnPlane, getLinePlaneName, getLineInPlaneName, rotateVector } from './helpers.js';
|
|
6
6
|
import { InteractionMethodsName, ScrollingMethods, planeNameToViewType } from './Constants.js';
|
|
7
7
|
|
|
@@ -2,7 +2,7 @@ import vtkBoundingBox, { STATIC } from '../../../Common/DataModel/BoundingBox.js
|
|
|
2
2
|
import vtkCubeSource from '../../../Filters/Sources/CubeSource.js';
|
|
3
3
|
import vtkCutter from '../../../Filters/Core/Cutter.js';
|
|
4
4
|
import vtkPlane from '../../../Common/DataModel/Plane.js';
|
|
5
|
-
import { s as subtract, l as normalize, j as cross, w as multiplyScalar, m as multiplyAccumulate,
|
|
5
|
+
import { s as subtract, l as normalize, j as cross, w as multiplyScalar, m as multiplyAccumulate, W as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
|
|
6
6
|
import vtkMatrixBuilder from '../../../Common/Core/MatrixBuilder.js';
|
|
7
7
|
import { viewTypeToPlaneName, planeNameToViewType, planeNames } from './Constants.js';
|
|
8
8
|
|
package/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
/// <reference path="./Common/Transform/Transform.d.ts" />
|
|
56
56
|
/// <reference path="./Filters/General/AppendPolyData.d.ts" />
|
|
57
57
|
/// <reference path="./Filters/General/ClipClosedSurface.d.ts" />
|
|
58
|
+
/// <reference path="./Filters/General/ContourLoopExtraction.d.ts" />
|
|
58
59
|
/// <reference path="./Filters/General/ContourTriangulator.d.ts" />
|
|
59
60
|
/// <reference path="./Filters/General/ImageCropFilter.d.ts" />
|
|
60
61
|
/// <reference path="./Filters/General/ImageDataOutlineFilter.d.ts" />
|
|
@@ -150,6 +151,7 @@
|
|
|
150
151
|
/// <reference path="./Rendering/Core/CellPicker.d.ts" />
|
|
151
152
|
/// <reference path="./Rendering/Core/ColorTransferFunction/ColorMaps.d.ts" />
|
|
152
153
|
/// <reference path="./Rendering/Core/ColorTransferFunction/Constants.d.ts" />
|
|
154
|
+
/// <reference path="./Rendering/Core/ColorTransferFunction/CssFilters.d.ts" />
|
|
153
155
|
/// <reference path="./Rendering/Core/ColorTransferFunction.d.ts" />
|
|
154
156
|
/// <reference path="./Rendering/Core/Coordinate/Constants.d.ts" />
|
|
155
157
|
/// <reference path="./Rendering/Core/Coordinate.d.ts" />
|