@kitware/vtk.js 22.1.3 → 22.1.7
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/Filters/Sources/Arrow2DSource.js +1 -1
- package/Filters/Sources/ArrowSource.js +1 -1
- package/Filters/Sources/CircleSource.js +1 -1
- package/Filters/Sources/ConcentricCylinderSource.js +1 -1
- package/Filters/Sources/ConeSource.js +1 -1
- package/Filters/Sources/CubeSource.js +2 -2
- package/Filters/Sources/CylinderSource.js +1 -1
- package/Filters/Sources/LineSource.js +3 -3
- package/Filters/Sources/PlaneSource.js +4 -4
- package/Filters/Sources/PointSource.js +2 -2
- package/Filters/Sources/SLICSource.js +3 -3
- package/Filters/Sources/SphereSource.js +2 -2
- package/Filters/Sources/ViewFinderSource.js +1 -1
- package/Interaction/Manipulators/MouseBoxSelectorManipulator.js +12 -9
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +15 -5
- package/package.json +1 -1
|
@@ -72,7 +72,7 @@ var DEFAULT_VALUES = {
|
|
|
72
72
|
shaftRadius: 0.03,
|
|
73
73
|
invert: false,
|
|
74
74
|
direction: [1.0, 0.0, 0.0],
|
|
75
|
-
pointType: '
|
|
75
|
+
pointType: 'Float64Array'
|
|
76
76
|
}; // ----------------------------------------------------------------------------
|
|
77
77
|
|
|
78
78
|
function extend(publicAPI, model) {
|
|
@@ -386,7 +386,7 @@ var DEFAULT_VALUES = {
|
|
|
386
386
|
skipInnerFaces: true,
|
|
387
387
|
mask: null,
|
|
388
388
|
// If present, array to know if a layer should be skipped(=true)
|
|
389
|
-
pointType: '
|
|
389
|
+
pointType: 'Float64Array'
|
|
390
390
|
}; // ----------------------------------------------------------------------------
|
|
391
391
|
|
|
392
392
|
function extend(publicAPI, model) {
|
|
@@ -81,7 +81,7 @@ var DEFAULT_VALUES = {
|
|
|
81
81
|
center: [0, 0, 0],
|
|
82
82
|
direction: [1.0, 0.0, 0.0],
|
|
83
83
|
capping: true,
|
|
84
|
-
pointType: '
|
|
84
|
+
pointType: 'Float64Array'
|
|
85
85
|
}; // ----------------------------------------------------------------------------
|
|
86
86
|
|
|
87
87
|
function extend(publicAPI, model) {
|
|
@@ -178,7 +178,7 @@ function vtkCubeSource(publicAPI, model) {
|
|
|
178
178
|
(_vtkMatrixBuilder$bui = vtkMatrixBuilder.buildFromRadian()).translate.apply(_vtkMatrixBuilder$bui, _toConsumableArray(model.center)).apply(points); // Define quads
|
|
179
179
|
|
|
180
180
|
|
|
181
|
-
var polys =
|
|
181
|
+
var polys = new Uint16Array(numberOfPolys * 5);
|
|
182
182
|
polyData.getPolys().setData(polys, 1);
|
|
183
183
|
var polyIndex = 0;
|
|
184
184
|
polys[polyIndex++] = 4;
|
|
@@ -247,7 +247,7 @@ var DEFAULT_VALUES = {
|
|
|
247
247
|
zLength: 1.0,
|
|
248
248
|
center: [0.0, 0.0, 0.0],
|
|
249
249
|
rotations: [0.0, 0.0, 0.0],
|
|
250
|
-
pointType: '
|
|
250
|
+
pointType: 'Float64Array',
|
|
251
251
|
generate3DTextureCoordinates: false
|
|
252
252
|
}; // ----------------------------------------------------------------------------
|
|
253
253
|
|
|
@@ -180,7 +180,7 @@ var DEFAULT_VALUES = {
|
|
|
180
180
|
center: [0, 0, 0],
|
|
181
181
|
direction: [0.0, 1.0, 0.0],
|
|
182
182
|
capping: true,
|
|
183
|
-
pointType: '
|
|
183
|
+
pointType: 'Float64Array'
|
|
184
184
|
}; // ----------------------------------------------------------------------------
|
|
185
185
|
|
|
186
186
|
function extend(publicAPI, model) {
|
|
@@ -17,9 +17,9 @@ function vtkLineSource(publicAPI, model) {
|
|
|
17
17
|
|
|
18
18
|
var dataset = outData[0]; // Check input
|
|
19
19
|
|
|
20
|
-
var pointDataType = dataset ? dataset.getPoints().getDataType() :
|
|
20
|
+
var pointDataType = dataset ? dataset.getPoints().getDataType() : model.pointType;
|
|
21
21
|
var pd = vtkPolyData.newInstance();
|
|
22
|
-
var v21 =
|
|
22
|
+
var v21 = [];
|
|
23
23
|
subtract(model.point2, model.point1, v21);
|
|
24
24
|
|
|
25
25
|
if (norm(v21) <= 0.0) {
|
|
@@ -68,7 +68,7 @@ var DEFAULT_VALUES = {
|
|
|
68
68
|
resolution: 10,
|
|
69
69
|
point1: [-1, 0, 0],
|
|
70
70
|
point2: [1, 0, 0],
|
|
71
|
-
pointType: '
|
|
71
|
+
pointType: 'Float64Array'
|
|
72
72
|
}; // ----------------------------------------------------------------------------
|
|
73
73
|
|
|
74
74
|
function extend(publicAPI, model) {
|
|
@@ -22,10 +22,10 @@ function vtkPlaneSource(publicAPI, model) {
|
|
|
22
22
|
|
|
23
23
|
var dataset = outData[0]; // Check input
|
|
24
24
|
|
|
25
|
-
var pointDataType = dataset ? dataset.getPoints().getDataType() :
|
|
25
|
+
var pointDataType = dataset ? dataset.getPoints().getDataType() : model.pointType;
|
|
26
26
|
var pd = vtkPolyData.newInstance();
|
|
27
|
-
var v10 =
|
|
28
|
-
var v20 =
|
|
27
|
+
var v10 = [];
|
|
28
|
+
var v20 = [];
|
|
29
29
|
subtract(model.point1, model.origin, v10);
|
|
30
30
|
subtract(model.point2, model.origin, v20);
|
|
31
31
|
|
|
@@ -242,7 +242,7 @@ var DEFAULT_VALUES = {
|
|
|
242
242
|
origin: [0, 0, 0],
|
|
243
243
|
point1: [1, 0, 0],
|
|
244
244
|
point2: [0, 1, 0],
|
|
245
|
-
pointType: '
|
|
245
|
+
pointType: 'Float64Array'
|
|
246
246
|
}; // ----------------------------------------------------------------------------
|
|
247
247
|
|
|
248
248
|
function extend(publicAPI, model) {
|
|
@@ -16,7 +16,7 @@ function vtkPointSource(publicAPI, model) {
|
|
|
16
16
|
|
|
17
17
|
var dataset = outData[0]; // Check input
|
|
18
18
|
|
|
19
|
-
var pointDataType = dataset ? dataset.getPoints().getDataType() :
|
|
19
|
+
var pointDataType = dataset ? dataset.getPoints().getDataType() : model.pointType;
|
|
20
20
|
var pd = vtkPolyData.newInstance(); // hand create a point cloud
|
|
21
21
|
|
|
22
22
|
var numPts = model.numberOfPoints; // Points
|
|
@@ -63,7 +63,7 @@ var DEFAULT_VALUES = {
|
|
|
63
63
|
numberOfPoints: 10,
|
|
64
64
|
center: [0, 0, 0],
|
|
65
65
|
radius: 0.5,
|
|
66
|
-
pointType: '
|
|
66
|
+
pointType: 'Float64Array'
|
|
67
67
|
}; // ----------------------------------------------------------------------------
|
|
68
68
|
|
|
69
69
|
function extend(publicAPI, model) {
|
|
@@ -7,7 +7,7 @@ import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
|
7
7
|
// ----------------------------------------------------------------------------
|
|
8
8
|
|
|
9
9
|
function generateCoordinates(origin, dimensions, spacing) {
|
|
10
|
-
var coordinates = new
|
|
10
|
+
var coordinates = new Float64Array(dimensions[0] * dimensions[1] * dimensions[2] * 3);
|
|
11
11
|
var offset = 0;
|
|
12
12
|
|
|
13
13
|
for (var k = 0; k < dimensions[2]; k++) {
|
|
@@ -37,7 +37,7 @@ function vtkSLICSource(publicAPI, model) {
|
|
|
37
37
|
|
|
38
38
|
publicAPI.addCluster = function (centerX, centerY, centerZ, fnConst, fnDfDx, fnDfDy, fnDfDz) {
|
|
39
39
|
var id = model.clusters.length;
|
|
40
|
-
model.clusters.push(new
|
|
40
|
+
model.clusters.push(new Float64Array([centerX, centerY, centerZ, fnConst, fnDfDx, fnDfDy, fnDfDz]));
|
|
41
41
|
publicAPI.modified();
|
|
42
42
|
return id;
|
|
43
43
|
};
|
|
@@ -54,7 +54,7 @@ function vtkSLICSource(publicAPI, model) {
|
|
|
54
54
|
|
|
55
55
|
publicAPI.updateCluster = function (id, centerX, centerY, centerZ, fnConst, fnDfDx, fnDfDy, fnDfDz) {
|
|
56
56
|
if (!model.clusters[id]) {
|
|
57
|
-
model.clusters[id] = new
|
|
57
|
+
model.clusters[id] = new Float64Array(7);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
model.clusters[id][0] = centerX;
|
|
@@ -15,7 +15,7 @@ function vtkSphereSource(publicAPI, model) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
var dataset = outData[0];
|
|
18
|
-
var pointDataType = dataset ? dataset.getPoints().getDataType() :
|
|
18
|
+
var pointDataType = dataset ? dataset.getPoints().getDataType() : model.pointType;
|
|
19
19
|
dataset = vtkPolyData.newInstance(); // ----------------------------------------------------------------------
|
|
20
20
|
|
|
21
21
|
var numPoles = 0; // Check data, determine increments, and convert to radians
|
|
@@ -180,7 +180,7 @@ var DEFAULT_VALUES = {
|
|
|
180
180
|
startPhi: 0.0,
|
|
181
181
|
endPhi: 180.0,
|
|
182
182
|
center: [0, 0, 0],
|
|
183
|
-
pointType: '
|
|
183
|
+
pointType: 'Float64Array'
|
|
184
184
|
}; // ----------------------------------------------------------------------------
|
|
185
185
|
|
|
186
186
|
function extend(publicAPI, model) {
|
|
@@ -56,9 +56,7 @@ function vtkMouseBoxSelectionManipulator(publicAPI, model) {
|
|
|
56
56
|
|
|
57
57
|
var _container$getBoundin = container.getBoundingClientRect(),
|
|
58
58
|
width = _container$getBoundin.width,
|
|
59
|
-
height = _container$getBoundin.height
|
|
60
|
-
top = _container$getBoundin.top,
|
|
61
|
-
left = _container$getBoundin.left;
|
|
59
|
+
height = _container$getBoundin.height;
|
|
62
60
|
|
|
63
61
|
var _getBounds = getBounds(),
|
|
64
62
|
_getBounds2 = _slicedToArray(_getBounds, 4),
|
|
@@ -67,10 +65,8 @@ function vtkMouseBoxSelectionManipulator(publicAPI, model) {
|
|
|
67
65
|
yMin = _getBounds2[2],
|
|
68
66
|
yMax = _getBounds2[3];
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
div.style.left = "".concat(xShift + width * xMin / viewWidth, "px");
|
|
73
|
-
div.style.top = "".concat(yShift + height - height * yMax / viewHeight, "px");
|
|
68
|
+
div.style.left = "".concat(width * xMin / viewWidth, "px");
|
|
69
|
+
div.style.top = "".concat(height - height * yMax / viewHeight, "px");
|
|
74
70
|
div.style.width = "".concat(width * (xMax - xMin) / viewWidth, "px");
|
|
75
71
|
div.style.height = "".concat(height * (yMax - yMin) / viewHeight, "px");
|
|
76
72
|
} //-------------------------------------------------------------------------
|
|
@@ -80,15 +76,21 @@ function vtkMouseBoxSelectionManipulator(publicAPI, model) {
|
|
|
80
76
|
previousPosition = position;
|
|
81
77
|
|
|
82
78
|
if (model.renderSelection) {
|
|
79
|
+
var _view;
|
|
80
|
+
|
|
83
81
|
// Need window size and location to convert to style
|
|
84
82
|
if (!view) {
|
|
85
83
|
view = interactor.getView();
|
|
86
84
|
}
|
|
87
85
|
|
|
88
|
-
if (!container && view) {
|
|
86
|
+
if (!container && (_view = view) !== null && _view !== void 0 && _view.getContainer) {
|
|
89
87
|
container = view.getContainer();
|
|
90
88
|
}
|
|
91
89
|
|
|
90
|
+
if (!container) {
|
|
91
|
+
container = model.container;
|
|
92
|
+
}
|
|
93
|
+
|
|
92
94
|
if (!div) {
|
|
93
95
|
div = document.createElement('div');
|
|
94
96
|
applyStyle(div, model.selectionStyle);
|
|
@@ -155,6 +157,7 @@ function vtkMouseBoxSelectionManipulator(publicAPI, model) {
|
|
|
155
157
|
|
|
156
158
|
function DEFAULT_VALUES(initialValues) {
|
|
157
159
|
return _objectSpread(_objectSpread({
|
|
160
|
+
// container: null,
|
|
158
161
|
renderSelection: true
|
|
159
162
|
}, initialValues), {}, {
|
|
160
163
|
selectionStyle: _objectSpread(_objectSpread({}, DEFAULT_STYLE), initialValues.selectionStyle)
|
|
@@ -172,7 +175,7 @@ function extend(publicAPI, model) {
|
|
|
172
175
|
|
|
173
176
|
event(publicAPI, model, 'BoxSelectInput'); // Trigger while dragging
|
|
174
177
|
|
|
175
|
-
setGet(publicAPI, model, ['renderSelection', 'selectionStyle']); // Object specific methods
|
|
178
|
+
setGet(publicAPI, model, ['renderSelection', 'selectionStyle', 'container']); // Object specific methods
|
|
176
179
|
|
|
177
180
|
vtkMouseBoxSelectionManipulator(publicAPI, model);
|
|
178
181
|
} // ----------------------------------------------------------------------------
|
|
@@ -3,11 +3,11 @@ import vtkBoundingBox, { STATIC } from '../../../Common/DataModel/BoundingBox.js
|
|
|
3
3
|
import vtkCubeSource from '../../../Filters/Sources/CubeSource.js';
|
|
4
4
|
import vtkCutter from '../../../Filters/Core/Cutter.js';
|
|
5
5
|
import vtkPlane from '../../../Common/DataModel/Plane.js';
|
|
6
|
-
import { g as subtract, l as normalize, j as cross, Q as multiplyAccumulate, S as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
|
|
6
|
+
import { g as subtract, l as normalize, j as cross, t as multiplyScalar, Q as multiplyAccumulate, S as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
|
|
7
7
|
import vtkMatrixBuilder from '../../../Common/Core/MatrixBuilder.js';
|
|
8
8
|
import { ViewTypes } from '../../Core/WidgetManager/Constants.js';
|
|
9
9
|
|
|
10
|
-
var EPSILON =
|
|
10
|
+
var EPSILON = 10e-7;
|
|
11
11
|
/**
|
|
12
12
|
* Fit the plane defined by origin, p1, p2 onto the bounds.
|
|
13
13
|
* Plane is untouched if does not intersect bounds.
|
|
@@ -15,6 +15,7 @@ var EPSILON = 0.00001;
|
|
|
15
15
|
* @param {Array} origin
|
|
16
16
|
* @param {Array} p1
|
|
17
17
|
* @param {Array} p2
|
|
18
|
+
* @return {Boolean} false if no bounds have been found, else true
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
21
|
function boundPlane(bounds, origin, p1, p2) {
|
|
@@ -26,19 +27,26 @@ function boundPlane(bounds, origin, p1, p2) {
|
|
|
26
27
|
normalize(v2);
|
|
27
28
|
var n = [0, 0, 1];
|
|
28
29
|
cross(v1, v2, n);
|
|
29
|
-
normalize(n);
|
|
30
|
+
normalize(n); // Inflate bounds in order to avoid precision error when cutting cubesource
|
|
31
|
+
|
|
32
|
+
var inflatedBounds = _toConsumableArray(bounds);
|
|
33
|
+
|
|
34
|
+
var eps = [].concat(n);
|
|
35
|
+
multiplyScalar(eps, EPSILON);
|
|
36
|
+
vtkBoundingBox.addBounds(inflatedBounds, bounds[0] + eps[0], bounds[1] + eps[0], bounds[2] + eps[1], bounds[3] + eps[1], bounds[4] + eps[2], bounds[5] + eps[2]);
|
|
37
|
+
vtkBoundingBox.addBounds(inflatedBounds, bounds[0] - eps[0], bounds[1] - eps[0], bounds[2] - eps[1], bounds[3] - eps[1], bounds[4] - eps[2], bounds[5] - eps[2]);
|
|
30
38
|
var plane = vtkPlane.newInstance();
|
|
31
39
|
plane.setOrigin.apply(plane, _toConsumableArray(origin));
|
|
32
40
|
plane.setNormal.apply(plane, n);
|
|
33
41
|
var cubeSource = vtkCubeSource.newInstance();
|
|
34
|
-
cubeSource.setBounds(
|
|
42
|
+
cubeSource.setBounds(inflatedBounds);
|
|
35
43
|
var cutter = vtkCutter.newInstance();
|
|
36
44
|
cutter.setCutFunction(plane);
|
|
37
45
|
cutter.setInputConnection(cubeSource.getOutputPort());
|
|
38
46
|
var cutBounds = cutter.getOutputData();
|
|
39
47
|
|
|
40
48
|
if (cutBounds.getNumberOfPoints() === 0) {
|
|
41
|
-
return;
|
|
49
|
+
return false;
|
|
42
50
|
}
|
|
43
51
|
|
|
44
52
|
var localBounds = STATIC.computeLocalBounds(cutBounds.getPoints(), v1, v2, n);
|
|
@@ -48,6 +56,8 @@ function boundPlane(bounds, origin, p1, p2) {
|
|
|
48
56
|
p1[i] = localBounds[1] * v1[i] + localBounds[2] * v2[i] + localBounds[4] * n[i];
|
|
49
57
|
p2[i] = localBounds[0] * v1[i] + localBounds[3] * v2[i] + localBounds[4] * n[i];
|
|
50
58
|
}
|
|
59
|
+
|
|
60
|
+
return true;
|
|
51
61
|
} // Project point (inPoint) to the bounds of the image according to a plane
|
|
52
62
|
// defined by two vectors (v1, v2)
|
|
53
63
|
|