@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.
Files changed (46) hide show
  1. package/BREAKING_CHANGES.md +7 -0
  2. package/Common/Core/ClassHierarchy.js +6 -11
  3. package/Common/Core/Math/Constants.js +12 -0
  4. package/Common/Core/Math/index.js +48 -29
  5. package/Common/Core/Math.d.ts +34 -4
  6. package/Common/Core/Math.js +2 -1
  7. package/Common/Core/MatrixBuilder.d.ts +13 -2
  8. package/Common/Core/MatrixBuilder.js +14 -2
  9. package/Common/Core/ScalarsToColors.d.ts +1 -3
  10. package/Common/Core/ScalarsToColors.js +1 -1
  11. package/Common/DataModel/BoundingBox.js +7 -7
  12. package/Common/DataModel/EdgeLocator.d.ts +79 -0
  13. package/Common/DataModel/EdgeLocator.js +85 -0
  14. package/Common/DataModel/ImageData.js +2 -50
  15. package/Common/DataModel/IncrementalOctreeNode.d.ts +15 -0
  16. package/Common/DataModel/IncrementalOctreeNode.js +27 -8
  17. package/Common/DataModel/IncrementalOctreePointLocator.js +61 -5
  18. package/Common/DataModel/Polygon.js +2 -2
  19. package/Common/Transform/Transform.js +51 -0
  20. package/Common/Transform.js +3 -1
  21. package/Filters/General/ClipClosedSurface.js +21 -18
  22. package/Filters/General/ContourTriangulator/helper.js +1 -1
  23. package/Filters/General/ImageMarchingCubes.js +5 -22
  24. package/Filters/General/ImageMarchingSquares.js +6 -23
  25. package/Filters/General.js +6 -0
  26. package/Imaging/Core/ImageReslice.js +84 -36
  27. package/Rendering/Core/ColorTransferFunction.d.ts +20 -0
  28. package/Rendering/Core/ColorTransferFunction.js +76 -7
  29. package/Rendering/Core/Prop3D.js +6 -1
  30. package/Rendering/Core/VolumeProperty.js +3 -2
  31. package/Rendering/OpenGL/PolyDataMapper.js +7 -5
  32. package/Rendering/OpenGL/RenderWindow.d.ts +25 -1
  33. package/Rendering/OpenGL/Texture.js +22 -6
  34. package/Rendering/OpenGL/VolumeMapper.js +3 -1
  35. package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
  36. package/Rendering/SceneGraph/RenderWindowViewNode.js +8 -2
  37. package/Rendering/SceneGraph/ViewNode.js +11 -0
  38. package/Widgets/Core/AbstractWidget.js +1 -1
  39. package/Widgets/Core/WidgetManager.js +25 -19
  40. package/Widgets/Representations/WidgetRepresentation.js +19 -7
  41. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +13 -7
  42. package/index.d.ts +1 -0
  43. package/macros.d.ts +5 -3
  44. package/macros.js +41 -8
  45. package/package.json +3 -1
  46. package/Filters/General/ClipClosedSurface/ccsEdgeLocator.js +0 -40
@@ -56,6 +56,20 @@ function vtkIncrementalOctreeNode(publicAPI, model) {
56
56
  bounds[3] = model.maxBounds[1];
57
57
  bounds[4] = model.minBounds[2];
58
58
  bounds[5] = model.maxBounds[2];
59
+ };
60
+
61
+ publicAPI.getChildIndex = function (point) {
62
+ return Number(point[0] > model.children[0].getMaxBoundsByReference()[0]) + ( // eslint-disable-next-line no-bitwise
63
+ Number(point[1] > model.children[0].getMaxBoundsByReference()[1]) << 1) + ( // eslint-disable-next-line no-bitwise
64
+ Number(point[2] > model.children[0].getMaxBoundsByReference()[2]) << 2);
65
+ };
66
+
67
+ publicAPI.containsPoint = function (pnt) {
68
+ return model.minBounds[0] < pnt[0] && pnt[0] <= model.maxBounds[0] && model.minBounds[1] < pnt[1] && pnt[1] <= model.maxBounds[1] && model.minBounds[2] < pnt[2] && pnt[2] <= model.maxBounds[2] ? 1 : 0;
69
+ };
70
+
71
+ publicAPI.containsPointByData = function (pnt) {
72
+ return model.minDataBounds[0] <= pnt[0] && pnt[0] <= model.maxDataBounds[0] && model.minDataBounds[1] <= pnt[1] && pnt[1] <= model.maxDataBounds[1] && model.minDataBounds[2] <= pnt[2] && pnt[2] <= model.maxDataBounds[2] ? 1 : 0;
59
73
  }; //------------------------------------------------------------------------------
60
74
 
61
75
 
@@ -118,6 +132,8 @@ function vtkIncrementalOctreeNode(publicAPI, model) {
118
132
  return model.children[i];
119
133
  }; //------------------------------------------------------------------------------
120
134
 
135
+ /* eslint-disable no-use-before-define */
136
+
121
137
 
122
138
  publicAPI.separateExactlyDuplicatePointsFromNewInsertion = function (points, pntIds, newPnt, pntIdx, maxPts, ptMode) {
123
139
  // the number of points already maintained in this leaf node
@@ -148,7 +164,7 @@ function vtkIncrementalOctreeNode(publicAPI, model) {
148
164
  boxPtr[2] = ocNode.maxBounds; // create eight child nodes
149
165
  // FIXME: May be too slow to use vtk newInstance()
150
166
 
151
- ocNode.children = [vtkIncrementalOctreeNode.newInstance(), vtkIncrementalOctreeNode.newInstance(), vtkIncrementalOctreeNode.newInstance(), vtkIncrementalOctreeNode.newInstance(), vtkIncrementalOctreeNode.newInstance(), vtkIncrementalOctreeNode.newInstance(), vtkIncrementalOctreeNode.newInstance(), vtkIncrementalOctreeNode.newInstance()];
167
+ ocNode.children = [newInstance(), newInstance(), newInstance(), newInstance(), newInstance(), newInstance(), newInstance(), newInstance()];
152
168
 
153
169
  for (i = 0; i < 8; i++) {
154
170
  // x-bound: axis 0
@@ -160,7 +176,7 @@ function vtkIncrementalOctreeNode(publicAPI, model) {
160
176
 
161
177
  octMin[2] = boxPtr[OCTREE_CHILD_BOUNDS_LUT[i][2][0]][2];
162
178
  octMax[2] = boxPtr[OCTREE_CHILD_BOUNDS_LUT[i][2][1]][2];
163
- ocNode.children[i] = vtkIncrementalOctreeNode.newInstance();
179
+ ocNode.children[i] = newInstance();
164
180
  ocNode.children[i].setParent(ocNode);
165
181
  ocNode.children[i].setBounds(octMin[0], octMax[0], octMin[1], octMax[1], octMin[2], octMax[2]);
166
182
  } // determine the leaf node of the duplicate points & that of the new point
@@ -186,7 +202,9 @@ function vtkIncrementalOctreeNode(publicAPI, model) {
186
202
  duplic.setPointIdSet(pntIds);
187
203
  duplic.updateCounterAndDataBoundsRecursively(dupPnt, pntIds.length, 1, publicAPI);
188
204
  return pointIdx;
189
- }; //------------------------------------------------------------------------------
205
+ };
206
+ /* eslint-enable no-use-before-define */
207
+ //------------------------------------------------------------------------------
190
208
 
191
209
 
192
210
  publicAPI.createChildNodes = function (points, pntIds, newPnt, pntIdx, maxPts, ptMode, numberOfNodes) {
@@ -240,9 +258,10 @@ function vtkIncrementalOctreeNode(publicAPI, model) {
240
258
 
241
259
  octMin[2] = boxPtr[OCTREE_CHILD_BOUNDS_LUT[i][2][0]][2];
242
260
  octMax[2] = boxPtr[OCTREE_CHILD_BOUNDS_LUT[i][2][1]][2]; // This call internally sets the cener and default data bounding box, too.
261
+ // eslint-disable-next-line no-use-before-define
262
+
263
+ model.children[i] = newInstance(); // model.children[i].iD = nbNodes++;
243
264
 
244
- model.children[i] = vtkIncrementalOctreeNode.newInstance();
245
- model.children[i].iD = nbNodes++;
246
265
  model.children[i].setParent(publicAPI);
247
266
  model.children[i].setBounds(octMin[0], octMax[0], octMin[1], octMax[1], octMin[2], octMax[2]); // allocate a list of point-indices (size = 2^n) for index registration
248
267
  // eslint-disable-next-line no-bitwise
@@ -258,7 +277,7 @@ function vtkIncrementalOctreeNode(publicAPI, model) {
258
277
  tempId = pntIds[i];
259
278
  points.getPoint(tempId, tempPt);
260
279
  target = publicAPI.getChildIndex(tempPt);
261
- model.children[target].getPointIdSet().insertNextId(tempId);
280
+ model.children[target].getPointIdSet().push(tempId);
262
281
  model.children[target].updateCounterAndDataBounds(tempPt);
263
282
  numIds[target]++;
264
283
  } // locate the full child, just if any
@@ -301,7 +320,7 @@ function vtkIncrementalOctreeNode(publicAPI, model) {
301
320
 
302
321
  for (i = 0; i < 8; i++) {
303
322
  if (numIds[i] === 0 || i === dvidId) {
304
- model.children[i].deletePointIdSet();
323
+ model.children[i].getPointIdSet().length = 0;
305
324
  }
306
325
  } // notify vtkIncrementalOctreeNode::InsertPoint() to destroy pntIds
307
326
 
@@ -604,7 +623,7 @@ function extend(publicAPI, model) {
604
623
 
605
624
  macro.obj(publicAPI, model);
606
625
  macro.setGetArray(publicAPI, model, ['minBounds', 'maxBounds', 'minDataBounds', 'maxDataBounds'], 6);
607
- macro.get(publicAPI, model, ['pointIdSet']); // TODO: No get?
626
+ macro.get(publicAPI, model, ['pointIdSet', 'numberOfPoints']); // TODO: No get?
608
627
 
609
628
  macro.set(publicAPI, model, ['parent']); // Object specific methods
610
629
 
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
2
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
3
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
4
  import macro from '../../macros.js';
5
5
  import { g as vtkMath } from '../Core/Math/index.js';
6
6
  import vtkBoundingBox from './BoundingBox.js';
@@ -65,6 +65,58 @@ function vtkIncrementalOctreePointLocator(publicAPI, model) {
65
65
 
66
66
  idList = null;
67
67
  return [pntIdx, dist2];
68
+ };
69
+
70
+ publicAPI.findClosestPointInSphere = function (point, radius2, maskNode, refDist2) {
71
+ var pointIndx = -1;
72
+ var minDist2 = Number.MAX_VALUE;
73
+ var nodesBase = [];
74
+ nodesBase.push(model.octreeRootNode);
75
+ var checkNode;
76
+ var childNode;
77
+ var distToData;
78
+ var tempDist2;
79
+ var tempPntId;
80
+
81
+ while (!nodesBase.length === 0 && minDist2 > 0.0) {
82
+ checkNode = nodesBase.top();
83
+ nodesBase.pop();
84
+
85
+ if (!checkNode.isLeaf()) {
86
+ for (var i = 0; i < 8; i++) {
87
+ childNode = checkNode.getChild(i); // use ( radius2 + radius2 ) to skip empty nodes
88
+
89
+ distToData = childNode.getNumberOfPoints() ? childNode.getDistance2ToBoundary(point, model.octreeRootNode, 1) : radius2 + radius2; // If a child node is not the mask node AND its distance, specifically
90
+ // the data bounding box (determined by the points inside or under) to
91
+ // the point, is less than the threshold radius (one exception is the
92
+ // point's container nodes), it is pushed to the stack as a suspect.
93
+
94
+ if (childNode !== maskNode && (distToData <= refDist2 || childNode.containsPoint(point) === 1)) {
95
+ nodesBase.push(childNode);
96
+ }
97
+
98
+ childNode = null;
99
+ }
100
+ } else {
101
+ // now that the node under check is a leaf, let's find the closest
102
+ // point therein and the minimum distance
103
+ var _publicAPI$findCloses = publicAPI.findClosestPointInLeafNode(checkNode, point);
104
+
105
+ var _publicAPI$findCloses2 = _slicedToArray(_publicAPI$findCloses, 2);
106
+
107
+ tempPntId = _publicAPI$findCloses2[0];
108
+ tempDist2 = _publicAPI$findCloses2[1];
109
+
110
+ if (tempDist2 < minDist2) {
111
+ minDist2 = tempDist2;
112
+ pointIndx = tempPntId;
113
+ }
114
+ }
115
+
116
+ checkNode = null;
117
+ }
118
+
119
+ return [minDist2 <= radius2 ? pointIndx : -1, minDist2];
68
120
  }; //------------------------------------------------------------------------------
69
121
 
70
122
 
@@ -130,6 +182,10 @@ function vtkIncrementalOctreePointLocator(publicAPI, model) {
130
182
  (_model$octreeRootNode = model.octreeRootNode).setBounds.apply(_model$octreeRootNode, _toConsumableArray(tmpBbox));
131
183
 
132
184
  return true;
185
+ };
186
+
187
+ publicAPI.findClosestPointInSphereWithTolerance = function (point, radius2, maskNode) {
188
+ return publicAPI.findClosestPointInSphere(point, radius2, maskNode, model.octreeMaxDimSize * model.octreeMaxDimSize * 4.0, radius2);
133
189
  }; //------------------------------------------------------------------------------
134
190
 
135
191
 
@@ -265,10 +321,10 @@ function vtkIncrementalOctreePointLocator(publicAPI, model) {
265
321
 
266
322
  var leafContainer = getLeafContainer(model.octreeRootNode, x);
267
323
 
268
- var _publicAPI$findCloses = publicAPI.findClosestPointInLeafNode(leafContainer, x),
269
- _publicAPI$findCloses2 = _slicedToArray(_publicAPI$findCloses, 2),
270
- pointIdx = _publicAPI$findCloses2[0],
271
- minDist2 = _publicAPI$findCloses2[1];
324
+ var _publicAPI$findCloses3 = publicAPI.findClosestPointInLeafNode(leafContainer, x),
325
+ _publicAPI$findCloses4 = _slicedToArray(_publicAPI$findCloses3, 2),
326
+ pointIdx = _publicAPI$findCloses4[0],
327
+ minDist2 = _publicAPI$findCloses4[1];
272
328
 
273
329
  if (minDist2 === 0.0) {
274
330
  return {
@@ -156,10 +156,10 @@ function getBounds(poly, points, bounds) {
156
156
 
157
157
  for (var j = 1; j < n; j++) {
158
158
  points.getPoint(poly[j], p);
159
- vtkBoundingBox.addPoint(bounds, p);
159
+ vtkBoundingBox.addPoint.apply(vtkBoundingBox, [bounds].concat(p));
160
160
  }
161
161
 
162
- var length = vtkBoundingBox.getLength(bounds);
162
+ var length = vtkBoundingBox.getLengths(bounds);
163
163
  return dot(length, length);
164
164
  } // ---------------------------------------------------
165
165
 
@@ -0,0 +1,51 @@
1
+ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
2
+ import { vec3 } from 'gl-matrix';
3
+ import macro from '../../macros.js';
4
+ import { g as vtkMath } from '../Core/Math/index.js';
5
+ import { IDENTITY } from '../Core/Math/Constants.js';
6
+
7
+ // vtkTransform methods
8
+ // ----------------------------------------------------------------------------
9
+ // eslint-disable-next-line import/no-mutable-exports
10
+
11
+ var newInstance;
12
+
13
+ function vtkTransform(publicAPI, model) {
14
+ // Set our className
15
+ model.classHierarchy.push('vtkAbstractTransform', 'vtkHomogeneousTransform', 'vtkTransform');
16
+
17
+ publicAPI.transformPoint = function (point, out) {
18
+ vec3.transformMat4(out, point, model.matrix);
19
+ return out;
20
+ };
21
+
22
+ publicAPI.getInverse = function () {
23
+ return newInstance({
24
+ matrix: vtkMath.invertMatrix(Array.from(model.matrix), [], 4)
25
+ });
26
+ };
27
+ } // ----------------------------------------------------------------------------
28
+ // Object factory
29
+ // ----------------------------------------------------------------------------
30
+
31
+
32
+ var DEFAULT_VALUES = {
33
+ matrix: _toConsumableArray(IDENTITY)
34
+ }; // ----------------------------------------------------------------------------
35
+
36
+ function extend(publicAPI, model) {
37
+ var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
38
+ Object.assign(model, DEFAULT_VALUES, initialValues);
39
+ macro.obj(publicAPI, model);
40
+ macro.setGetArray(publicAPI, model, ['matrix'], 16);
41
+ vtkTransform(publicAPI, model);
42
+ } // ----------------------------------------------------------------------------
43
+
44
+ newInstance = macro.newInstance(extend, 'vtkTransform');
45
+
46
+ var vtkTransform$1 = {
47
+ newInstance: newInstance,
48
+ extend: extend
49
+ };
50
+
51
+ export { vtkTransform$1 as default, extend, newInstance };
@@ -1,7 +1,9 @@
1
1
  import vtkLandmarkTransform from './Transform/LandmarkTransform.js';
2
+ import vtkTransform from './Transform/Transform.js';
2
3
 
3
4
  var Transform = {
4
- vtkLandmarkTransform: vtkLandmarkTransform
5
+ vtkLandmarkTransform: vtkLandmarkTransform,
6
+ vtkTransform: vtkTransform
5
7
  };
6
8
 
7
9
  export { Transform as default };
@@ -9,8 +9,8 @@ import vtkPoints from '../../Common/Core/Points.js';
9
9
  import vtkDataSetAttributes from '../../Common/DataModel/DataSetAttributes.js';
10
10
  import vtkPolyData from '../../Common/DataModel/PolyData.js';
11
11
  import vtkContourTriangulator from './ContourTriangulator.js';
12
+ import vtkEdgeLocator from '../../Common/DataModel/EdgeLocator.js';
12
13
  import Constants from './ClipClosedSurface/Constants.js';
13
- import CCSEdgeLocator from './ClipClosedSurface/ccsEdgeLocator.js';
14
14
 
15
15
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
16
 
@@ -84,10 +84,10 @@ function vtkClipClosedSurface(publicAPI, model) {
84
84
  // Check to see if this point has already been computed
85
85
 
86
86
 
87
- var node = locator.insertUniqueEdge(i0, i1);
87
+ var edge = locator.insertUniqueEdge(i0, i1);
88
88
 
89
- if (node.edgeId !== -1) {
90
- return node.edgeId;
89
+ if (edge.value != null) {
90
+ return edge.value;
91
91
  } // Get the edge and interpolate the new point
92
92
 
93
93
 
@@ -100,26 +100,26 @@ function vtkClipClosedSurface(publicAPI, model) {
100
100
  var tol2 = tol * tol; // Make sure that new point is far enough from kept point
101
101
 
102
102
  if (distance2BetweenPoints(p, p0) < tol2) {
103
- node.edgeId = i0;
103
+ edge.value = i0;
104
104
  return i0;
105
105
  }
106
106
 
107
107
  if (distance2BetweenPoints(p, p1) < tol2) {
108
- node.edgeId = i1;
108
+ edge.value = i1;
109
109
  return i1;
110
110
  }
111
111
 
112
- node.edgeId = points.insertNextTuple(p);
113
- pointData.interpolateData(pointData, i0, i1, node.edgeId, t);
114
- return node.edgeId;
112
+ edge.value = points.insertNextTuple(p);
113
+ pointData.interpolateData(pointData, i0, i1, edge.value, t);
114
+ return edge.value;
115
115
  }
116
116
  /**
117
117
  * Method for clipping lines and copying the scalar data.
118
118
  *
119
119
  * @param {vtkPoints} points
120
120
  * @param {vtkDataArray} pointScalars
121
- * @param {vtvtkDataSetAttributesk} pointData
122
- * @param {CCSEdgeLocator} edgeLocator
121
+ * @param {vtkDataSetAttributesk} pointData
122
+ * @param {vtkEdgeLocator} edgeLocator
123
123
  * @param {vtkCellArray} inputLines
124
124
  * @param {vtkCellArray} outputLines
125
125
  * @param {vtkDataSetAttributes} inLineData
@@ -353,7 +353,7 @@ function vtkClipClosedSurface(publicAPI, model) {
353
353
  * @param {vtkPoints} points
354
354
  * @param {vtkDataArray} pointScalars
355
355
  * @param {vtkDataSetAttributes} pointData
356
- * @param {CCSEdgeLocator} edgeLocator
356
+ * @param {vtkEdgeLocator} edgeLocator
357
357
  * @param {Number} triangulate
358
358
  * @param {vtkCellArray} inputPolys
359
359
  * @param {vtkCellArray} outputPolys
@@ -611,7 +611,7 @@ function vtkClipClosedSurface(publicAPI, model) {
611
611
  } // An edge locator to avoid point duplication while clipping
612
612
 
613
613
 
614
- var edgeLocator = new CCSEdgeLocator(); // A temporary polydata for the contour lines that are triangulated
614
+ var edgeLocator = vtkEdgeLocator.newInstance(); // A temporary polydata for the contour lines that are triangulated
615
615
 
616
616
  var tmpContourData = vtkPolyData.newInstance(); // The cell scalars
617
617
 
@@ -939,9 +939,12 @@ var DEFAULT_VALUES = {
939
939
  generateOutline: false,
940
940
  generateFaces: true,
941
941
  activePlaneId: -1,
942
- baseColor: null,
943
- clipColor: null,
944
- activePlaneColor: null,
942
+ baseColor: [255 / 255, 99 / 255, 71 / 255],
943
+ // Tomato
944
+ clipColor: [244 / 255, 164 / 255, 96 / 255],
945
+ // Sandy brown
946
+ activePlaneColor: [227 / 255, 207 / 255, 87 / 255],
947
+ // Banana
945
948
  triangulationErrorDisplay: false // _idList: null,
946
949
 
947
950
  }; // ----------------------------------------------------------------------------
@@ -961,9 +964,9 @@ function extend(publicAPI, model) {
961
964
 
962
965
  var newInstance = macro.newInstance(extend, 'vtkClipClosedSurface'); // ----------------------------------------------------------------------------
963
966
 
964
- var index = _objectSpread({
967
+ var vtkClipClosedSurface$1 = _objectSpread({
965
968
  newInstance: newInstance,
966
969
  extend: extend
967
970
  }, Constants);
968
971
 
969
- export { index as default, extend, newInstance };
972
+ export { vtkClipClosedSurface$1 as default, extend, newInstance };
@@ -411,7 +411,7 @@ function vtkCCSMakePolysFromLines(polyData, firstLine, endLine, oriented, newPol
411
411
  }
412
412
  }
413
413
 
414
- if (!matches.length === 0) {
414
+ if (matches.length > 0) {
415
415
  // Multiple matches mean we need to decide which path to take
416
416
  if (matches.length > 1) {
417
417
  // Remove double-backs
@@ -1,5 +1,6 @@
1
1
  import macro from '../../macros.js';
2
2
  import vtkDataArray from '../../Common/Core/DataArray.js';
3
+ import vtkEdgeLocator from '../../Common/DataModel/EdgeLocator.js';
3
4
  import vtkPolyData from '../../Common/DataModel/PolyData.js';
4
5
  import { m as normalize } from '../../Common/Core/Math/index.js';
5
6
  import vtkCaseTable from './ImageMarchingCubes/caseTable.js';
@@ -16,7 +17,7 @@ function vtkImageMarchingCubes(publicAPI, model) {
16
17
  var voxelScalars = [];
17
18
  var voxelGradients = [];
18
19
  var voxelPts = [];
19
- var edgeMap = new Map(); // Retrieve scalars and voxel coordinates. i-j-k is origin of voxel.
20
+ var edgeLocator = vtkEdgeLocator.newInstance(); // Retrieve scalars and voxel coordinates. i-j-k is origin of voxel.
20
21
 
21
22
  publicAPI.getVoxelScalars = function (i, j, k, slice, dims, origin, spacing, s) {
22
23
  // First get the indices for the voxel
@@ -172,8 +173,6 @@ function vtkImageMarchingCubes(publicAPI, model) {
172
173
  var xyz = [];
173
174
  var n = [];
174
175
  var pId;
175
- var tmp;
176
- var edge = [];
177
176
  publicAPI.getVoxelScalars(i, j, k, slice, dims, origin, spacing, scalars);
178
177
  var index = 0;
179
178
 
@@ -203,16 +202,9 @@ function vtkImageMarchingCubes(publicAPI, model) {
203
202
  pId = undefined;
204
203
 
205
204
  if (model.mergePoints) {
206
- edge[0] = ids[edgeVerts[0]];
207
- edge[1] = ids[edgeVerts[1]];
205
+ var _edgeLocator$isInsert;
208
206
 
209
- if (edge[0] > edge[1]) {
210
- tmp = edge[0];
211
- edge[0] = edge[1];
212
- edge[1] = tmp;
213
- }
214
-
215
- pId = edgeMap.get(edge);
207
+ pId = (_edgeLocator$isInsert = edgeLocator.isInsertedEdge(ids[edgeVerts[0]], ids[edgeVerts[1]])) === null || _edgeLocator$isInsert === void 0 ? void 0 : _edgeLocator$isInsert.value;
216
208
  }
217
209
 
218
210
  if (pId === undefined) {
@@ -236,16 +228,7 @@ function vtkImageMarchingCubes(publicAPI, model) {
236
228
  }
237
229
 
238
230
  if (model.mergePoints) {
239
- edge[0] = ids[edgeVerts[0]];
240
- edge[1] = ids[edgeVerts[1]];
241
-
242
- if (edge[0] > edge[1]) {
243
- tmp = edge[0];
244
- edge[0] = edge[1];
245
- edge[1] = tmp;
246
- }
247
-
248
- edgeMap[edge] = pId;
231
+ edgeLocator.insertEdge(ids[edgeVerts[0]], ids[edgeVerts[1]], pId);
249
232
  }
250
233
  }
251
234
 
@@ -1,5 +1,6 @@
1
1
  import macro from '../../macros.js';
2
2
  import vtkPolyData from '../../Common/DataModel/PolyData.js';
3
+ import vtkEdgeLocator from '../../Common/DataModel/EdgeLocator.js';
3
4
  import vtkCaseTable from './ImageMarchingSquares/caseTable.js';
4
5
 
5
6
  var vtkErrorMacro = macro.vtkErrorMacro,
@@ -23,7 +24,7 @@ function vtkImageMarchingSquares(publicAPI, model) {
23
24
  var ids = [];
24
25
  var pixelScalars = [];
25
26
  var pixelPts = [];
26
- var edgeMap = new Map(); // Retrieve scalars and pixel coordinates. i-j-k is origin of pixel.
27
+ var edgeLocator = vtkEdgeLocator.newInstance(); // Retrieve scalars and pixel coordinates. i-j-k is origin of pixel.
27
28
 
28
29
  publicAPI.getPixelScalars = function (i, j, k, slice, dims, origin, spacing, s) {
29
30
  // First get the indices for the pixel
@@ -63,8 +64,6 @@ function vtkImageMarchingSquares(publicAPI, model) {
63
64
 
64
65
  var xyz = [];
65
66
  var pId;
66
- var tmp;
67
- var edge = [];
68
67
  publicAPI.getPixelScalars(i, j, k, slice, dims, origin, spacing, scalars);
69
68
  var index = 0;
70
69
 
@@ -91,16 +90,9 @@ function vtkImageMarchingSquares(publicAPI, model) {
91
90
  pId = undefined;
92
91
 
93
92
  if (model.mergePoints) {
94
- edge[0] = ids[edgeVerts[0]];
95
- edge[1] = ids[edgeVerts[1]];
93
+ var _edgeLocator$isInsert;
96
94
 
97
- if (edge[0] > edge[1]) {
98
- tmp = edge[0];
99
- edge[0] = edge[1];
100
- edge[1] = tmp;
101
- }
102
-
103
- pId = edgeMap.get(edge);
95
+ pId = (_edgeLocator$isInsert = edgeLocator.isInsertedEdge(ids[edgeVerts[0]], ids[edgeVerts[1]])) === null || _edgeLocator$isInsert === void 0 ? void 0 : _edgeLocator$isInsert.value;
104
96
  }
105
97
 
106
98
  if (pId === undefined) {
@@ -113,16 +105,7 @@ function vtkImageMarchingSquares(publicAPI, model) {
113
105
  points.push(xyz[0], xyz[1], z);
114
106
 
115
107
  if (model.mergePoints) {
116
- edge[0] = ids[edgeVerts[0]];
117
- edge[1] = ids[edgeVerts[1]];
118
-
119
- if (edge[0] > edge[1]) {
120
- tmp = edge[0];
121
- edge[0] = edge[1];
122
- edge[1] = tmp;
123
- }
124
-
125
- edgeMap[edge] = pId;
108
+ edgeLocator.insertEdge(ids[edgeVerts[0]], ids[edgeVerts[1]], pId);
126
109
  }
127
110
  }
128
111
 
@@ -166,7 +149,7 @@ function vtkImageMarchingSquares(publicAPI, model) {
166
149
  }
167
150
  }
168
151
 
169
- edgeMap.clear();
152
+ edgeLocator.initialize();
170
153
  } // Update output
171
154
 
172
155
 
@@ -1,12 +1,15 @@
1
1
  import vtkAppendPolyData from './General/AppendPolyData.js';
2
2
  import vtkCalculator from './General/Calculator.js';
3
+ import vtkClipClosedSurface from './General/ClipClosedSurface.js';
3
4
  import vtkClosedPolyLineToSurfaceFilter from './General/ClosedPolyLineToSurfaceFilter.js';
5
+ import vtkContourTriangulator from './General/ContourTriangulator.js';
4
6
  import vtkImageCropFilter from './General/ImageCropFilter.js';
5
7
  import vtkImageMarchingCubes from './General/ImageMarchingCubes.js';
6
8
  import vtkImageMarchingSquares from './General/ImageMarchingSquares.js';
7
9
  import vtkImageOutlineFilter from './General/ImageOutlineFilter.js';
8
10
  import vtkImageSliceFilter from './General/ImageSliceFilter.js';
9
11
  import vtkImageStreamline from './General/ImageStreamline.js';
12
+ import vtkLineFilter from './General/LineFilter.js';
10
13
  import vtkMoleculeToRepresentation from './General/MoleculeToRepresentation.js';
11
14
  import vtkOBBTree from './General/OBBTree.js';
12
15
  import vtkOutlineFilter from './General/OutlineFilter.js';
@@ -20,13 +23,16 @@ import vtkWindowedSincPolyDataFilter from './General/WindowedSincPolyDataFilter.
20
23
  var General = {
21
24
  vtkAppendPolyData: vtkAppendPolyData,
22
25
  vtkCalculator: vtkCalculator,
26
+ vtkClipClosedSurface: vtkClipClosedSurface,
23
27
  vtkClosedPolyLineToSurfaceFilter: vtkClosedPolyLineToSurfaceFilter,
28
+ vtkContourTriangulator: vtkContourTriangulator,
24
29
  vtkImageCropFilter: vtkImageCropFilter,
25
30
  vtkImageMarchingCubes: vtkImageMarchingCubes,
26
31
  vtkImageMarchingSquares: vtkImageMarchingSquares,
27
32
  vtkImageOutlineFilter: vtkImageOutlineFilter,
28
33
  vtkImageSliceFilter: vtkImageSliceFilter,
29
34
  vtkImageStreamline: vtkImageStreamline,
35
+ vtkLineFilter: vtkLineFilter,
30
36
  vtkMoleculeToRepresentation: vtkMoleculeToRepresentation,
31
37
  vtkOBBTree: vtkOBBTree,
32
38
  vtkOutlineFilter: vtkOutlineFilter,