@kitware/vtk.js 26.0.0-beta.2 → 26.0.0-beta.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/BREAKING_CHANGES.md +7 -0
- package/Common/Core/ClassHierarchy.js +6 -11
- package/Common/Core/Math/Constants.js +12 -0
- package/Common/Core/Math/index.js +48 -29
- package/Common/Core/Math.d.ts +34 -4
- package/Common/Core/Math.js +2 -1
- package/Common/Core/MatrixBuilder.d.ts +13 -2
- package/Common/Core/MatrixBuilder.js +14 -2
- package/Common/Core/ScalarsToColors.d.ts +1 -3
- package/Common/Core/ScalarsToColors.js +1 -1
- package/Common/DataModel/BoundingBox.js +7 -7
- package/Common/DataModel/EdgeLocator.d.ts +79 -0
- package/Common/DataModel/EdgeLocator.js +85 -0
- package/Common/DataModel/ImageData.js +2 -50
- package/Common/DataModel/IncrementalOctreeNode.d.ts +15 -0
- package/Common/DataModel/IncrementalOctreeNode.js +27 -8
- package/Common/DataModel/IncrementalOctreePointLocator.js +61 -5
- package/Common/DataModel/Polygon.js +2 -2
- package/Common/Transform/Transform.js +51 -0
- package/Common/Transform.js +3 -1
- package/Filters/General/ClipClosedSurface.js +21 -18
- package/Filters/General/ContourTriangulator/helper.js +1 -1
- package/Filters/General/ImageMarchingCubes.js +5 -22
- package/Filters/General/ImageMarchingSquares.js +6 -23
- package/Filters/General.js +6 -0
- package/Imaging/Core/ImageReslice.js +84 -36
- package/Rendering/Core/ColorTransferFunction.d.ts +20 -0
- package/Rendering/Core/ColorTransferFunction.js +76 -7
- package/Rendering/Core/Prop3D.js +6 -1
- package/Rendering/Core/VolumeProperty.js +3 -2
- package/Rendering/OpenGL/PolyDataMapper.js +7 -5
- package/Rendering/OpenGL/RenderWindow.d.ts +25 -1
- package/Rendering/OpenGL/Texture.js +22 -6
- package/Rendering/OpenGL/VolumeMapper.js +3 -1
- package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
- package/Rendering/SceneGraph/RenderWindowViewNode.js +8 -2
- package/Rendering/SceneGraph/ViewNode.js +11 -0
- package/Widgets/Core/AbstractWidget.js +1 -1
- package/Widgets/Core/WidgetManager.js +25 -19
- package/Widgets/Representations/WidgetRepresentation.js +19 -7
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +13 -7
- package/index.d.ts +1 -0
- package/macros.d.ts +5 -3
- package/macros.js +41 -8
- package/package.json +3 -1
- package/Filters/General/ClipClosedSurface/ccsEdgeLocator.js +0 -40
package/macros.js
CHANGED
|
@@ -3,6 +3,7 @@ import _typeof from '@babel/runtime/helpers/typeof';
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
5
5
|
import _construct from '@babel/runtime/helpers/construct';
|
|
6
|
+
import DeepEqual from 'fast-deep-equal';
|
|
6
7
|
import vtk, { vtkGlobal } from './vtk.js';
|
|
7
8
|
import ClassHierarchy from './Common/Core/ClassHierarchy.js';
|
|
8
9
|
|
|
@@ -233,7 +234,13 @@ function obj() {
|
|
|
233
234
|
if (!('classHierarchy' in model)) {
|
|
234
235
|
model.classHierarchy = new ClassHierarchy('vtkObject');
|
|
235
236
|
} else if (!(model.classHierarchy instanceof ClassHierarchy)) {
|
|
236
|
-
|
|
237
|
+
var hierarchy = new ClassHierarchy();
|
|
238
|
+
|
|
239
|
+
for (var i = 0; i < model.classHierarchy.length; i++) {
|
|
240
|
+
hierarchy.push(model.classHierarchy[i]);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
model.classHierarchy = hierarchy;
|
|
237
244
|
}
|
|
238
245
|
|
|
239
246
|
function off(index) {
|
|
@@ -437,12 +444,25 @@ function obj() {
|
|
|
437
444
|
// getXXX: add getters
|
|
438
445
|
// ----------------------------------------------------------------------------
|
|
439
446
|
|
|
447
|
+
var objectGetterMap = {
|
|
448
|
+
object: function object(publicAPI, model, field) {
|
|
449
|
+
return function getter() {
|
|
450
|
+
return _objectSpread({}, model[field.name]);
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
};
|
|
440
454
|
function get(publicAPI, model, fieldNames) {
|
|
441
455
|
fieldNames.forEach(function (field) {
|
|
442
456
|
if (_typeof(field) === 'object') {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
457
|
+
var getter = objectGetterMap[field.type];
|
|
458
|
+
|
|
459
|
+
if (getter) {
|
|
460
|
+
publicAPI["get".concat(_capitalize(field.name))] = getter(publicAPI, model, field);
|
|
461
|
+
} else {
|
|
462
|
+
publicAPI["get".concat(_capitalize(field.name))] = function () {
|
|
463
|
+
return model[field.name];
|
|
464
|
+
};
|
|
465
|
+
}
|
|
446
466
|
} else {
|
|
447
467
|
publicAPI["get".concat(_capitalize(field))] = function () {
|
|
448
468
|
return model[field];
|
|
@@ -491,6 +511,17 @@ var objectSetterMap = {
|
|
|
491
511
|
vtkErrorMacro("Set Enum with invalid argument (String/Number) ".concat(field, ", ").concat(value));
|
|
492
512
|
throw new TypeError('Set Enum with invalid argument (String/Number)');
|
|
493
513
|
};
|
|
514
|
+
},
|
|
515
|
+
object: function object(publicAPI, model, field) {
|
|
516
|
+
return function (value) {
|
|
517
|
+
if (!DeepEqual(model[field.name], value)) {
|
|
518
|
+
model[field.name] = value;
|
|
519
|
+
publicAPI.modified();
|
|
520
|
+
return true;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
return false;
|
|
524
|
+
};
|
|
494
525
|
}
|
|
495
526
|
};
|
|
496
527
|
|
|
@@ -549,7 +580,7 @@ function setGet(publicAPI, model, fieldNames) {
|
|
|
549
580
|
function getArray(publicAPI, model, fieldNames) {
|
|
550
581
|
fieldNames.forEach(function (field) {
|
|
551
582
|
publicAPI["get".concat(_capitalize(field))] = function () {
|
|
552
|
-
return model[field] ?
|
|
583
|
+
return model[field] ? Array.from(model[field]) : model[field];
|
|
553
584
|
};
|
|
554
585
|
|
|
555
586
|
publicAPI["get".concat(_capitalize(field), "ByReference")] = function () {
|
|
@@ -607,9 +638,11 @@ function setArray(publicAPI, model, fieldNames, size) {
|
|
|
607
638
|
}
|
|
608
639
|
}
|
|
609
640
|
|
|
610
|
-
changeDetected = model[field] == null || model[field].
|
|
611
|
-
|
|
612
|
-
|
|
641
|
+
changeDetected = model[field] == null || model[field].length !== array.length;
|
|
642
|
+
|
|
643
|
+
for (var i = 0; !changeDetected && i < array.length; ++i) {
|
|
644
|
+
changeDetected = model[field][i] !== array[i];
|
|
645
|
+
}
|
|
613
646
|
|
|
614
647
|
if (changeDetected && needCopy) {
|
|
615
648
|
array = Array.from(array);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitware/vtk.js",
|
|
3
|
-
"version": "26.0.0-beta.
|
|
3
|
+
"version": "26.0.0-beta.4",
|
|
4
4
|
"description": "Visualization Toolkit for the Web",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"3d",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@babel/runtime": "7.17.9",
|
|
34
34
|
"commander": "9.2.0",
|
|
35
35
|
"d3-scale": "4.0.2",
|
|
36
|
+
"fast-deep-equal": "^3.1.3",
|
|
36
37
|
"fflate": "0.7.3",
|
|
37
38
|
"gl-matrix": "3.4.3",
|
|
38
39
|
"globalthis": "1.0.3",
|
|
@@ -141,6 +142,7 @@
|
|
|
141
142
|
"doc:publish": "kw-doc -c ./Documentation/config.js -mp",
|
|
142
143
|
"doc:generate-api": "node ./Documentation/generate-api-docs.js",
|
|
143
144
|
"example": "node ./Utilities/ExampleRunner/example-runner-cli.js -c ./Documentation/config.js",
|
|
145
|
+
"example:webgpu": "cross-env WEBGPU=1 NO_WEBGL=1 node ./Utilities/ExampleRunner/example-runner-cli.js -c ./Documentation/config.js",
|
|
144
146
|
"dev:esm": "npm run build:esm -- -w",
|
|
145
147
|
"dev:umd": "webpack --watch --config webpack.dev.js --progress",
|
|
146
148
|
"build": "npm run build:release",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
2
|
-
import _createClass from '@babel/runtime/helpers/createClass';
|
|
3
|
-
|
|
4
|
-
var CCSEdgeLocator = /*#__PURE__*/function () {
|
|
5
|
-
function CCSEdgeLocator() {
|
|
6
|
-
_classCallCheck(this, CCSEdgeLocator);
|
|
7
|
-
|
|
8
|
-
this._edgeMap = new Map();
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
_createClass(CCSEdgeLocator, [{
|
|
12
|
-
key: "initialize",
|
|
13
|
-
value: function initialize() {
|
|
14
|
-
this._edgeMap.clear();
|
|
15
|
-
}
|
|
16
|
-
}, {
|
|
17
|
-
key: "insertUniqueEdge",
|
|
18
|
-
value: function insertUniqueEdge(i0, i1) {
|
|
19
|
-
// Generate key, which is unique, since we order the edges
|
|
20
|
-
var key = i1 < i0 ? "".concat(i1, "-").concat(i0) : "".concat(i0, "-").concat(i1);
|
|
21
|
-
|
|
22
|
-
var node = this._edgeMap.get(key);
|
|
23
|
-
|
|
24
|
-
if (!node) {
|
|
25
|
-
// Didn't find key, so add a new edge entry
|
|
26
|
-
node = {
|
|
27
|
-
edgeId: -1
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
this._edgeMap.set(key, node);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return node;
|
|
34
|
-
}
|
|
35
|
-
}]);
|
|
36
|
-
|
|
37
|
-
return CCSEdgeLocator;
|
|
38
|
-
}();
|
|
39
|
-
|
|
40
|
-
export { CCSEdgeLocator as default };
|