@kitware/vtk.js 23.4.3 → 24.0.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.
Files changed (144) hide show
  1. package/BREAKING_CHANGES.md +33 -0
  2. package/Common/Core/DataArray.js +4 -0
  3. package/Common/Core/Math/index.js +2 -2
  4. package/Common/Core/Math.js +1 -1
  5. package/Common/DataModel/DataSetAttributes/FieldData.js +9 -5
  6. package/Common/DataModel/ImageData.d.ts +23 -6
  7. package/Common/DataModel/ImageData.js +8 -1
  8. package/Common/DataModel/PolyData.d.ts +8 -1
  9. package/Common/DataModel/PolyData.js +5 -3
  10. package/Common/DataModel/Triangle.js +217 -2
  11. package/Common/Transform/LandmarkTransform.js +1 -1
  12. package/Filters/General/OBBTree/OBBNode.js +82 -0
  13. package/Filters/General/OBBTree/helper.js +92 -0
  14. package/Filters/General/OBBTree.js +1249 -0
  15. package/Filters/General/WindowedSincPolyDataFilter.js +1 -1
  16. package/Filters/General.js +2 -0
  17. package/Filters/Sources/CircleSource.js +1 -1
  18. package/Filters/Sources/PointSource.js +1 -1
  19. package/Filters/Texture/TextureMapToPlane.js +1 -1
  20. package/Interaction/Manipulators/KeyboardCameraManipulator.js +1 -1
  21. package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +1 -1
  22. package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -1
  23. package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
  24. package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
  25. package/Interaction/Style/InteractorStyleImage.js +3 -3
  26. package/Interaction/Style/InteractorStyleMPRSlice.js +12 -6
  27. package/Interaction/Style/InteractorStyleManipulator.js +42 -28
  28. package/Interaction/Style/InteractorStyleRemoteMouse.js +32 -14
  29. package/Interaction/Style/InteractorStyleTrackballCamera.js +7 -7
  30. package/Interaction/Widgets/OrientationMarkerWidget.js +18 -13
  31. package/Interaction/Widgets/PiecewiseGaussianWidget.js +1 -1
  32. package/Interaction/Widgets.js +1 -35
  33. package/Proxy/Core/View2DProxy.js +1 -1
  34. package/Rendering/Core/ColorTransferFunction.js +1 -1
  35. package/Rendering/Core/Coordinate.js +1 -1
  36. package/Rendering/Core/CubeAxesActor.js +1 -1
  37. package/Rendering/Core/Glyph3DMapper.js +1 -1
  38. package/Rendering/Core/ImageMapper.js +1 -1
  39. package/Rendering/Core/InteractorObserver.js +11 -10
  40. package/Rendering/Core/InteractorStyle.js +9 -4
  41. package/Rendering/Core/Mapper.js +1 -1
  42. package/Rendering/Core/Prop.js +6 -4
  43. package/Rendering/Core/Prop3D.js +1 -1
  44. package/Rendering/Core/RenderWindowInteractor.js +24 -17
  45. package/Rendering/Core/Renderer.js +24 -19
  46. package/Rendering/Core/ScalarBarActor.js +1 -1
  47. package/Rendering/Core/Viewport.js +1 -1
  48. package/Rendering/Core/VolumeMapper.js +1 -1
  49. package/Rendering/OpenGL/Actor.js +2 -2
  50. package/Rendering/OpenGL/Actor2D.js +2 -2
  51. package/Rendering/OpenGL/BufferObject.js +6 -5
  52. package/Rendering/OpenGL/Camera.js +3 -3
  53. package/Rendering/OpenGL/CellArrayBufferObject.js +1 -1
  54. package/Rendering/OpenGL/Framebuffer.js +13 -12
  55. package/Rendering/OpenGL/Glyph3DMapper.js +10 -8
  56. package/Rendering/OpenGL/HardwareSelector.js +35 -25
  57. package/Rendering/OpenGL/ImageMapper.js +51 -45
  58. package/Rendering/OpenGL/ImageSlice.js +2 -2
  59. package/Rendering/OpenGL/PixelSpaceCallbackMapper.js +4 -2
  60. package/Rendering/OpenGL/PolyDataMapper.js +14 -11
  61. package/Rendering/OpenGL/PolyDataMapper2D.js +7 -6
  62. package/Rendering/OpenGL/Renderer.js +11 -7
  63. package/Rendering/OpenGL/ReplacementShaderMapper.js +1 -1
  64. package/Rendering/OpenGL/ScalarBarActor.js +2 -2
  65. package/Rendering/OpenGL/ShaderCache.js +7 -5
  66. package/Rendering/OpenGL/Skybox.js +11 -9
  67. package/Rendering/OpenGL/SphereMapper.js +2 -2
  68. package/Rendering/OpenGL/StickMapper.js +2 -2
  69. package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/pingpong.js +13 -12
  70. package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D.js +11 -9
  71. package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +19 -12
  72. package/Rendering/OpenGL/SurfaceLIC/SurfaceLICMapper.js +9 -6
  73. package/Rendering/OpenGL/Texture.js +44 -31
  74. package/Rendering/OpenGL/VertexArrayObject.js +7 -7
  75. package/Rendering/OpenGL/Volume.js +3 -2
  76. package/Rendering/OpenGL/VolumeMapper.js +30 -26
  77. package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
  78. package/Rendering/SceneGraph/ViewNode.js +8 -7
  79. package/Rendering/WebGPU/Renderer.js +18 -10
  80. package/Widgets/Core/AbstractWidget.js +5 -4
  81. package/Widgets/Core/AbstractWidgetFactory.js +2 -1
  82. package/Widgets/Core/WidgetManager.js +66 -49
  83. package/Widgets/Manipulators/LineManipulator.js +1 -1
  84. package/Widgets/Representations/CircleContextRepresentation.js +1 -1
  85. package/Widgets/Representations/ImplicitPlaneRepresentation.js +5 -5
  86. package/Widgets/Representations/PolyLineRepresentation.js +1 -1
  87. package/Widgets/Representations/ResliceCursorContextRepresentation.js +7 -7
  88. package/Widgets/SVG/SVGLandmarkRepresentation/Constants.js +2 -2
  89. package/Widgets/SVG/SVGLandmarkRepresentation.js +21 -8
  90. package/Widgets/SVG/SVGRepresentation.js +1 -1
  91. package/Widgets/Widgets3D/AngleWidget/behavior.js +14 -6
  92. package/Widgets/Widgets3D/DistanceWidget/behavior.js +14 -6
  93. package/Widgets/Widgets3D/EllipseWidget.js +0 -1
  94. package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +6 -2
  95. package/Widgets/Widgets3D/ImplicitPlaneWidget.js +4 -2
  96. package/Widgets/Widgets3D/LabelWidget/behavior.js +138 -0
  97. package/Widgets/Widgets3D/LabelWidget/state.js +22 -0
  98. package/Widgets/Widgets3D/LabelWidget.js +79 -0
  99. package/Widgets/Widgets3D/LineWidget/behavior.js +18 -9
  100. package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
  101. package/Widgets/Widgets3D/LineWidget.js +0 -1
  102. package/Widgets/Widgets3D/PaintWidget/behavior.js +5 -3
  103. package/Widgets/Widgets3D/PolyLineWidget/behavior.js +18 -8
  104. package/Widgets/Widgets3D/RectangleWidget.js +0 -1
  105. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
  106. package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
  107. package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
  108. package/Widgets/Widgets3D/ShapeWidget/behavior.js +18 -11
  109. package/Widgets/Widgets3D/SplineWidget/behavior.js +33 -21
  110. package/interfaces.d.ts +11 -0
  111. package/macros.d.ts +26 -1
  112. package/macros.js +51 -19
  113. package/package.json +1 -1
  114. package/types.d.ts +1 -0
  115. package/Interaction/Widgets/AbstractWidget.js +0 -104
  116. package/Interaction/Widgets/DistanceRepresentation.js +0 -116
  117. package/Interaction/Widgets/DistanceWidget.js +0 -77
  118. package/Interaction/Widgets/HandleRepresentation/Constants.js +0 -12
  119. package/Interaction/Widgets/HandleRepresentation.js +0 -100
  120. package/Interaction/Widgets/HandleWidget/Constants.js +0 -9
  121. package/Interaction/Widgets/HandleWidget.js +0 -194
  122. package/Interaction/Widgets/ImageCroppingRegionsRepresentation.js +0 -233
  123. package/Interaction/Widgets/ImageCroppingRegionsWidget/Constants.js +0 -16
  124. package/Interaction/Widgets/ImageCroppingRegionsWidget.js +0 -573
  125. package/Interaction/Widgets/LabelRepresentation/Constants.js +0 -17
  126. package/Interaction/Widgets/LabelRepresentation.js +0 -325
  127. package/Interaction/Widgets/LabelWidget.js +0 -65
  128. package/Interaction/Widgets/LineRepresentation/Constants.js +0 -21
  129. package/Interaction/Widgets/LineRepresentation.js +0 -498
  130. package/Interaction/Widgets/LineWidget/Constants.js +0 -11
  131. package/Interaction/Widgets/LineWidget.js +0 -296
  132. package/Interaction/Widgets/PointPlacer.js +0 -51
  133. package/Interaction/Widgets/ResliceCursor/ResliceCursor/Constants.js +0 -10
  134. package/Interaction/Widgets/ResliceCursor/ResliceCursor.js +0 -269
  135. package/Interaction/Widgets/ResliceCursor/ResliceCursorActor/Constants.js +0 -10
  136. package/Interaction/Widgets/ResliceCursor/ResliceCursorActor.js +0 -146
  137. package/Interaction/Widgets/ResliceCursor/ResliceCursorLineRepresentation.js +0 -332
  138. package/Interaction/Widgets/ResliceCursor/ResliceCursorPolyDataAlgorithm.js +0 -134
  139. package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation/Constants.js +0 -16
  140. package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +0 -371
  141. package/Interaction/Widgets/ResliceCursor/ResliceCursorWidget/Constants.js +0 -10
  142. package/Interaction/Widgets/ResliceCursor/ResliceCursorWidget.js +0 -157
  143. package/Interaction/Widgets/SphereHandleRepresentation.js +0 -370
  144. package/Interaction/Widgets/WidgetRepresentation.js +0 -121
@@ -1,3 +1,36 @@
1
+ ## From 23.x to 24
2
+
3
+ All old-style widgets except OrientationMarkerWidget and PiecewiseGaussianWidget have been removed.
4
+
5
+ | **Old-style/deprecated widget** | **New-style widget** |
6
+ |-----------------------------------|---------------------------------|
7
+ | `Sources/Interaction/Widgets/...` | `Sources/Widgets/Widgets3D/...` |
8
+ | DistanceWidget | DistanceWidget |
9
+ | HandleWidget | PolyLineWidget |
10
+ | ImageCroppingRegionsWidget | ImageCroppingWidget |
11
+ | LabelWidget | LabelWidget |
12
+ | LineWidget | LineWidget |
13
+ | OrientationMarkerWidget (kept) | *not implemented* |
14
+ | PiecewiseGaussianWidget (kept) | *not implemented* |
15
+ | ResliceCursor | ResliceCursorWidget |
16
+
17
+ - In SVGLandmarkRepresentation: `model.showCircle` is replaced by `model.circleProps.visible`
18
+
19
+ ## From 22.x to 23
20
+
21
+ - **imagemapper**: The original behavior of the image mapper was that if a lookup table is provided,
22
+ it mapped the lookup table's scalar range by default. The new behavior disables using the lookup
23
+ table scalar range by default. Instead, the window/level values are used.
24
+
25
+ ## From 21.x to 22
26
+
27
+ - `config/rules-linter.js` is now gone.
28
+ - **AbstractMapper**: Changed removeClippingPlane to use instance instead of index.
29
+
30
+ ## From 20.x to 21
31
+
32
+ SplineWidget's handles now scale up automatically.
33
+
1
34
  ## From 19.x to 20
2
35
 
3
36
  In ShapeWidget:
@@ -337,6 +337,10 @@ function vtkDataArray(publicAPI, model) {
337
337
 
338
338
 
339
339
  publicAPI.getState = function () {
340
+ if (model.deleted) {
341
+ return null;
342
+ }
343
+
340
344
  var jsonArchive = _objectSpread(_objectSpread({}, model), {}, {
341
345
  vtkClass: publicAPI.getClassName()
342
346
  }); // Convert typed array to regular array
@@ -829,7 +829,7 @@ function jacobiN(a, n, w, v) {
829
829
 
830
830
  for (i = j + 1; i < n; i++) {
831
831
  // boundary incorrect, shifted already
832
- if (w[i] >= tmp) {
832
+ if (w[i] >= tmp || Math.abs(w[i] - tmp) < VTK_SMALL_NUMBER) {
833
833
  // why exchange if same?
834
834
  k = i;
835
835
  tmp = w[k];
@@ -2329,4 +2329,4 @@ var vtkMath$1 = /*#__PURE__*/Object.freeze({
2329
2329
  'default': vtkMath
2330
2330
  });
2331
2331
 
2332
- export { binomial as $, clampValue as A, projectVector as B, arrayRange as C, getMajorAxisIndex as D, isInf as E, rgb2hsv as F, rgb2lab as G, lab2rgb as H, floor as I, round as J, normalize2D as K, nearestPowerOfTwo as L, createUninitializedBounds as M, multiply3x3_vect3 as N, areBoundsInitialized as O, isPowerOfTwo as P, multiplyAccumulate as Q, angleBetweenVectors as R, signedAngleBetweenVectors as S, Pi as T, ceil as U, min as V, max as W, arrayMin as X, arrayMax as Y, ceilLog2 as Z, factorial as _, areMatricesEqual as a, beginCombination as a0, nextCombination as a1, randomSeed as a2, getSeed as a3, gaussian as a4, multiplyScalar2D as a5, multiplyAccumulate2D as a6, outer as a7, dot2D as a8, projectVector2D as a9, hex2float as aA, lab2xyz as aB, xyz2lab as aC, xyz2rgb as aD, rgb2xyz as aE, clampAndNormalizeValue as aF, getScalarTypeFittingRange as aG, getAdjustedScalarRange as aH, extentIsWithinOtherExtent as aI, boundsIsWithinOtherBounds as aJ, pointIsWithinBounds as aK, solve3PointCircle as aL, inf as aM, negInf as aN, isFinite as aO, isNaN as aP, floatToHex2 as aQ, floatRGB2HexCode as aR, float2CssRGBA as aS, gaussianAmplitude as aa, gaussianWeight as ab, outer2D as ac, norm2D as ad, LUFactor3x3 as ae, LUSolve3x3 as af, linearSolve3x3 as ag, multiply3x3_mat3 as ah, multiplyMatrix as ai, transpose3x3 as aj, invert3x3 as ak, identity3x3 as al, quaternionToMatrix3x3 as am, roundNumber as an, matrix3x3ToQuaternion as ao, multiplyQuaternion as ap, orthogonalize3x3 as aq, diagonalize3x3 as ar, singularValueDecomposition3x3 as as, luFactorLinearSystem as at, luSolveLinearSystem as au, invertMatrix as av, estimateMatrixCondition as aw, jacobi as ax, solveHomogeneousLeastSquares as ay, solveLeastSquares as az, roundVector as b, computeBoundsFromPoints as c, dot as d, clampVector as e, distance2BetweenPoints as f, subtract as g, hsv2rgb as h, isNan as i, cross as j, add as k, normalize as l, determinant2x2 as m, norm as n, jacobiN as o, perpendiculars as p, vtkMath as q, radiansFromDegrees as r, solveLinearSystem as s, multiplyScalar as t, uninitializeBounds as u, vtkMath$1 as v, random as w, determinant3x3 as x, degreesFromRadians as y, areEquals as z };
2332
+ export { binomial as $, degreesFromRadians as A, areEquals as B, clampValue as C, arrayRange as D, getMajorAxisIndex as E, isInf as F, rgb2hsv as G, rgb2lab as H, lab2rgb as I, floor as J, round as K, normalize2D as L, nearestPowerOfTwo as M, createUninitializedBounds as N, multiply3x3_vect3 as O, areBoundsInitialized as P, isPowerOfTwo as Q, angleBetweenVectors as R, signedAngleBetweenVectors as S, Pi as T, ceil as U, min as V, max as W, arrayMin as X, arrayMax as Y, ceilLog2 as Z, factorial as _, areMatricesEqual as a, beginCombination as a0, nextCombination as a1, randomSeed as a2, getSeed as a3, gaussian as a4, multiplyScalar2D as a5, multiplyAccumulate2D as a6, outer as a7, projectVector as a8, dot2D as a9, hex2float as aA, lab2xyz as aB, xyz2lab as aC, xyz2rgb as aD, rgb2xyz as aE, clampAndNormalizeValue as aF, getScalarTypeFittingRange as aG, getAdjustedScalarRange as aH, extentIsWithinOtherExtent as aI, boundsIsWithinOtherBounds as aJ, pointIsWithinBounds as aK, solve3PointCircle as aL, inf as aM, negInf as aN, isFinite as aO, isNaN as aP, floatToHex2 as aQ, floatRGB2HexCode as aR, float2CssRGBA as aS, projectVector2D as aa, gaussianAmplitude as ab, gaussianWeight as ac, outer2D as ad, norm2D as ae, LUFactor3x3 as af, LUSolve3x3 as ag, linearSolve3x3 as ah, multiply3x3_mat3 as ai, multiplyMatrix as aj, transpose3x3 as ak, invert3x3 as al, identity3x3 as am, quaternionToMatrix3x3 as an, roundNumber as ao, matrix3x3ToQuaternion as ap, multiplyQuaternion as aq, orthogonalize3x3 as ar, diagonalize3x3 as as, singularValueDecomposition3x3 as at, luFactorLinearSystem as au, luSolveLinearSystem as av, invertMatrix as aw, estimateMatrixCondition as ax, solveHomogeneousLeastSquares as ay, solveLeastSquares as az, roundVector as b, computeBoundsFromPoints as c, dot as d, clampVector as e, distance2BetweenPoints as f, subtract 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, solveLinearSystem as s, jacobi as t, uninitializeBounds as u, vtkMath$1 as v, vtkMath as w, multiplyScalar as x, random as y, determinant3x3 as z };
@@ -1,4 +1,4 @@
1
1
  import '@babel/runtime/helpers/slicedToArray';
2
2
  import 'seedrandom';
3
3
  import '../../macros.js';
4
- export { ae as LUFactor3x3, af as LUSolve3x3, T as Pi, k as add, R as angleBetweenVectors, O as areBoundsInitialized, z as areEquals, a as areMatricesEqual, Y as arrayMax, X as arrayMin, C as arrayRange, a0 as beginCombination, $ as binomial, aJ as boundsIsWithinOtherBounds, U as ceil, Z as ceilLog2, aF as clampAndNormalizeValue, A as clampValue, e as clampVector, c as computeBoundsFromPoints, M as createUninitializedBounds, j as cross, q as default, y as degreesFromRadians, m as determinant2x2, x as determinant3x3, ar as diagonalize3x3, f as distance2BetweenPoints, d as dot, a8 as dot2D, aw as estimateMatrixCondition, aI as extentIsWithinOtherExtent, _ as factorial, aS as float2CssRGBA, aR as floatRGB2HexCode, aQ as floatToHex2, I as floor, a4 as gaussian, aa as gaussianAmplitude, ab as gaussianWeight, aH as getAdjustedScalarRange, D as getMajorAxisIndex, aG as getScalarTypeFittingRange, a3 as getSeed, aA as hex2float, h as hsv2rgb, al as identity3x3, aM as inf, ak as invert3x3, av as invertMatrix, aO as isFinite, E as isInf, aP as isNaN, i as isNan, P as isPowerOfTwo, ax as jacobi, o as jacobiN, H as lab2rgb, aB as lab2xyz, ag as linearSolve3x3, at as luFactorLinearSystem, au as luSolveLinearSystem, ao as matrix3x3ToQuaternion, W as max, V as min, ah as multiply3x3_mat3, N as multiply3x3_vect3, Q as multiplyAccumulate, a6 as multiplyAccumulate2D, ai as multiplyMatrix, ap as multiplyQuaternion, t as multiplyScalar, a5 as multiplyScalar2D, L as nearestPowerOfTwo, aN as negInf, a1 as nextCombination, n as norm, ad as norm2D, l as normalize, K as normalize2D, aq as orthogonalize3x3, a7 as outer, ac as outer2D, p as perpendiculars, aK as pointIsWithinBounds, B as projectVector, a9 as projectVector2D, am as quaternionToMatrix3x3, r as radiansFromDegrees, w as random, a2 as randomSeed, F as rgb2hsv, G as rgb2lab, aE as rgb2xyz, J as round, an as roundNumber, b as roundVector, S as signedAngleBetweenVectors, as as singularValueDecomposition3x3, aL as solve3PointCircle, ay as solveHomogeneousLeastSquares, az as solveLeastSquares, s as solveLinearSystem, g as subtract, aj as transpose3x3, u as uninitializeBounds, aC as xyz2lab, aD as xyz2rgb } from './Math/index.js';
4
+ export { af as LUFactor3x3, ag as LUSolve3x3, T as Pi, k as add, R as angleBetweenVectors, P as areBoundsInitialized, B as areEquals, a as areMatricesEqual, Y as arrayMax, X as arrayMin, D as arrayRange, a0 as beginCombination, $ as binomial, aJ as boundsIsWithinOtherBounds, U as ceil, Z as ceilLog2, aF as clampAndNormalizeValue, C as clampValue, e as clampVector, c as computeBoundsFromPoints, N as createUninitializedBounds, j as cross, w as default, A as degreesFromRadians, o as determinant2x2, z as determinant3x3, as as diagonalize3x3, f as distance2BetweenPoints, d as dot, a9 as dot2D, ax as estimateMatrixCondition, aI as extentIsWithinOtherExtent, _ as factorial, aS as float2CssRGBA, aR as floatRGB2HexCode, aQ as floatToHex2, J as floor, a4 as gaussian, ab as gaussianAmplitude, ac as gaussianWeight, aH as getAdjustedScalarRange, E as getMajorAxisIndex, aG as getScalarTypeFittingRange, a3 as getSeed, aA as hex2float, h as hsv2rgb, am as identity3x3, aM as inf, al as invert3x3, aw as invertMatrix, aO as isFinite, F as isInf, aP as isNaN, i as isNan, Q as isPowerOfTwo, t as jacobi, p as jacobiN, I as lab2rgb, aB as lab2xyz, ah as linearSolve3x3, au as luFactorLinearSystem, av as luSolveLinearSystem, ap as matrix3x3ToQuaternion, W as max, V as min, ai as multiply3x3_mat3, O as multiply3x3_vect3, m as multiplyAccumulate, a6 as multiplyAccumulate2D, aj as multiplyMatrix, aq as multiplyQuaternion, x as multiplyScalar, a5 as multiplyScalar2D, M as nearestPowerOfTwo, aN as negInf, a1 as nextCombination, n as norm, ae as norm2D, l as normalize, L as normalize2D, ar as orthogonalize3x3, a7 as outer, ad as outer2D, q as perpendiculars, aK as pointIsWithinBounds, a8 as projectVector, aa as projectVector2D, an as quaternionToMatrix3x3, r as radiansFromDegrees, y as random, a2 as randomSeed, G as rgb2hsv, H as rgb2lab, aE as rgb2xyz, K as round, ao as roundNumber, b as roundVector, S as signedAngleBetweenVectors, at as singularValueDecomposition3x3, aL as solve3PointCircle, ay as solveHomogeneousLeastSquares, az as solveLeastSquares, s as solveLinearSystem, g as subtract, ak as transpose3x3, u as uninitializeBounds, aC as xyz2lab, aD as xyz2rgb } from './Math/index.js';
@@ -242,11 +242,15 @@ function vtkFieldData(publicAPI, model) {
242
242
 
243
243
  publicAPI.getState = function () {
244
244
  var result = superGetState();
245
- result.arrays = model.arrays.map(function (item) {
246
- return {
247
- data: item.data.getState()
248
- };
249
- });
245
+
246
+ if (result) {
247
+ result.arrays = model.arrays.map(function (item) {
248
+ return {
249
+ data: item.data.getState()
250
+ };
251
+ });
252
+ }
253
+
250
254
  return result;
251
255
  };
252
256
  }
@@ -69,18 +69,31 @@ export interface vtkImageData extends vtkDataSet {
69
69
  extentToBounds(ex: Extent): Bounds;
70
70
 
71
71
  /**
72
- * The Bounds of a vtkImage are returned as pairs of world coordinates
72
+ * Get image extents without translation (i.e. with origin set to [0,0,0]) and under unit spacing
73
+ * (i.e. spacing = [1, 1, 1]).
74
+ * This includes a padding of 0.5 pixel/voxel in each principal direction.
75
+ * The padding is necessary for conventional images (textures, png, bmp)
76
+ * as well as medical images and volumes, since each pixel/voxel has a pre-defined width
77
+ * (based on specified spacing) including the ones on the boundary of the image.
78
+ * @internal
79
+ */
80
+ getSpatialExtent(): Extent;
81
+
82
+ /**
83
+ * Returns the axis-aligned bounds of vtkImageData in world coordinates.
84
+ * The axis-aligned Bounds of a vtkImage are returned as pairs of world coordinates
73
85
  * ```[x_min, x_max, y_min, y_max, z_min, z_max]``` these are calculated
74
86
  * from the Extent, Origin, and Spacing, defined
75
87
  * through
76
88
  * ```js
77
- * bounds[6] =
78
89
  * [
79
- * i_min*Spacing[0] + Origin[0], i_max*Spacing[0] + Origin[0],
80
- * j_min*Spacing[1] + Origin[1], j_max*Spacing[1] + Origin[1],
81
- * k_min*Spacing[2] + Origin[2], k_max*Spacing[2] + Origin[2]
90
+ * (i_min - 0.5)*Spacing[0] + Origin[0], (i_max + 0.5)*Spacing[0] + Origin[0],
91
+ * (j_min - 0.5)*Spacing[1] + Origin[1], (j_max + 0.5)*Spacing[1] + Origin[1],
92
+ * (k_min - 0.5)*Spacing[2] + Origin[2], (k_max + 0.5)*Spacing[2] + Origin[2]
82
93
  * ];
83
94
  * ```
95
+ * Note that this includes a padding of 0.5 voxel spacing in each principal direction,
96
+ * as well as any orientation of the image.
84
97
  * You can't directly set the bounds. First you need to decide how many
85
98
  * pixels across your image will be (i.e. what the extent should be), and
86
99
  * then you must find the origin and spacing that will produce the bounds
@@ -89,6 +102,8 @@ export interface vtkImageData extends vtkDataSet {
89
102
  * 9]` for a 10x10x10 image. Calling `setDimensions(10,10,10)` does exactly
90
103
  * the same thing as `setExtent(0,9,0,9,0,9)` but you should always do the
91
104
  * latter to be explicit about where your extent starts.
105
+ * Such an image of dimensions [10, 10, 10], origin [0, 0, 0] and voxel-spacing of 1.0,
106
+ * will result in bounds equal to [-0.5, 9.5, -0.5, 9.5, -0.5, 9.5].
92
107
  * @return {Bounds} The bounds for the mapper.
93
108
  */
94
109
  getBounds(): Bounds;
@@ -217,7 +232,9 @@ export interface vtkImageData extends vtkDataSet {
217
232
  /**
218
233
  * Calculate the corresponding world bounds for the given index bounds
219
234
  * `[i_min, i_max, j_min, j_max, k_min, k_max]`. Modifies `out` in place if
220
- * provided, or returns a new array.
235
+ * provided, or returns a new array. Returned bounds are NOT padded based
236
+ * on voxel spacing (see getBounds). The output is merely a bounding box
237
+ * calculated considering voxels as grid points.
221
238
  * @param {Bounds} bin
222
239
  * @param {Bounds} [bout]
223
240
  */
@@ -191,7 +191,7 @@ function vtkImageData(publicAPI, model) {
191
191
 
192
192
 
193
193
  publicAPI.getBounds = function () {
194
- return publicAPI.extentToBounds(model.extent);
194
+ return publicAPI.extentToBounds(publicAPI.getSpatialExtent());
195
195
  };
196
196
 
197
197
  publicAPI.extentToBounds = function (ex) {
@@ -232,6 +232,13 @@ function vtkImageData(publicAPI, model) {
232
232
  }
233
233
 
234
234
  return bounds;
235
+ };
236
+
237
+ publicAPI.getSpatialExtent = function () {
238
+ var boundingBox = vtkBoundingBox.newInstance();
239
+ boundingBox.setBounds(model.extent);
240
+ boundingBox.inflate(0.5);
241
+ return boundingBox.getBounds();
235
242
  }; // Internal, shouldn't need to call this manually.
236
243
 
237
244
 
@@ -1,4 +1,4 @@
1
- import { Vector3 } from '../../types';
1
+ import { CellType, Vector3 } from '../../types';
2
2
  import vtkCellArray from '../Core/CellArray';
3
3
  import vtkPointSet, { IPointSetInitialValues } from './PointSet';
4
4
 
@@ -45,6 +45,13 @@ export interface vtkPolyData extends vtkPointSet {
45
45
  */
46
46
  getCellPoints(cellId: number): object;
47
47
 
48
+ /**
49
+ * Get the type of the cell
50
+ * @param {Number} cellId The Id of the cell.
51
+ * @return CellType The type of the cell.
52
+ */
53
+ getCellType(cellId: number): CellType;
54
+
48
55
  /**
49
56
  * Get the cell array defining cells.
50
57
  */
@@ -164,12 +164,14 @@ function vtkPolyData(publicAPI, model) {
164
164
  }
165
165
 
166
166
  model.links.buildLinks(publicAPI);
167
- }; // Returns an object made of the cellType and a subarray `cellPointIds` of
168
- // the cell points.
167
+ };
169
168
 
169
+ publicAPI.getCellType = function (cellId) {
170
+ return model.cells.getCellType(cellId);
171
+ };
170
172
 
171
173
  publicAPI.getCellPoints = function (cellId) {
172
- var cellType = model.cells.getCellType(cellId);
174
+ var cellType = publicAPI.getCellType(cellId);
173
175
  var cells = null;
174
176
 
175
177
  switch (cellType) {
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import macro from '../../macros.js';
3
3
  import vtkCell from './Cell.js';
4
- import { f as distance2BetweenPoints, d as dot, m as determinant2x2 } from '../Core/Math/index.js';
4
+ import { d as dot, j as cross, l as normalize, m as multiplyAccumulate, f as distance2BetweenPoints, o as determinant2x2 } from '../Core/Math/index.js';
5
5
  import vtkLine from './Line.js';
6
6
  import vtkPlane from './Plane.js';
7
7
 
@@ -33,6 +33,220 @@ function computeNormal(v1, v2, v3, n) {
33
33
  n[1] /= length;
34
34
  n[2] /= length;
35
35
  }
36
+ }
37
+
38
+ function intersectWithTriangle(p1, q1, r1, p2, q2, r2) {
39
+ var tolerance = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 1e-6;
40
+ var coplanar = false;
41
+ var pt1 = [];
42
+ var pt2 = [];
43
+ var surfaceId = [];
44
+ var n1 = [];
45
+ var n2 = []; // Compute supporting plane normals.
46
+
47
+ computeNormal(p1, q1, r1, n1);
48
+ computeNormal(p2, q2, r2, n2);
49
+ var s1 = -dot(n1, p1);
50
+ var s2 = -dot(n2, p2); // Compute signed distances of points p1, q1, r1 from supporting
51
+ // plane of second triangle.
52
+
53
+ var dist1 = [dot(n2, p1) + s2, dot(n2, q1) + s2, dot(n2, r1) + s2]; // If signs of all points are the same, all the points lie on the
54
+ // same side of the supporting plane, and we can exit early.
55
+
56
+ if (dist1[0] * dist1[1] > tolerance && dist1[0] * dist1[2] > tolerance) {
57
+ // vtkDebugMacro(<<"Same side supporting plane 1!");
58
+ return {
59
+ intersect: false,
60
+ coplanar: coplanar,
61
+ pt1: pt1,
62
+ pt2: pt2,
63
+ surfaceId: surfaceId
64
+ };
65
+ } // Do the same for p2, q2, r2 and supporting plane of first
66
+ // triangle.
67
+
68
+
69
+ var dist2 = [dot(n1, p2) + s1, dot(n1, q2) + s1, dot(n1, r2) + s1]; // If signs of all points are the same, all the points lie on the
70
+ // same side of the supporting plane, and we can exit early.
71
+
72
+ if (dist2[0] * dist2[1] > tolerance && dist2[0] * dist2[2] > tolerance) {
73
+ // vtkDebugMacro(<<"Same side supporting plane 2!");
74
+ return {
75
+ intersect: false,
76
+ coplanar: coplanar,
77
+ pt1: pt1,
78
+ pt2: pt2,
79
+ surfaceId: surfaceId
80
+ };
81
+ } // Check for coplanarity of the supporting planes.
82
+
83
+
84
+ if (Math.abs(n1[0] - n2[0]) < 1e-9 && Math.abs(n1[1] - n2[1]) < 1e-9 && Math.abs(n1[2] - n2[2]) < 1e-9 && Math.abs(s1 - s2) < 1e-9) {
85
+ coplanar = true; // vtkDebugMacro(<<"Coplanar!");
86
+
87
+ return {
88
+ intersect: false,
89
+ coplanar: coplanar,
90
+ pt1: pt1,
91
+ pt2: pt2,
92
+ surfaceId: surfaceId
93
+ };
94
+ } // There are more efficient ways to find the intersection line (if
95
+ // it exists), but this is clear enough.
96
+
97
+
98
+ var pts1 = [p1, q1, r1];
99
+ var pts2 = [p2, q2, r2]; // Find line of intersection (L = p + t*v) between two planes.
100
+
101
+ var n1n2 = dot(n1, n2);
102
+ var a = (s1 - s2 * n1n2) / (n1n2 * n1n2 - 1.0);
103
+ var b = (s2 - s1 * n1n2) / (n1n2 * n1n2 - 1.0);
104
+ var p = [a * n1[0] + b * n2[0], a * n1[1] + b * n2[1], a * n1[2] + b * n2[2]];
105
+ var v = cross(n1, n2, []);
106
+ normalize(v);
107
+ var index1 = 0;
108
+ var index2 = 0;
109
+ var t1 = [];
110
+ var t2 = [];
111
+ var ts1 = 50;
112
+ var ts2 = 50;
113
+
114
+ for (var i = 0; i < 3; i++) {
115
+ var id1 = i;
116
+ var id2 = (i + 1) % 3; // Find t coordinate on line of intersection between two planes.
117
+
118
+ var val1 = vtkPlane.intersectWithLine(pts1[id1], pts1[id2], p2, n2);
119
+
120
+ if (val1.intersection && val1.t > 0 - tolerance && val1.t < 1 + tolerance) {
121
+ if (val1.t < 1 + tolerance && val1.t > 1 - tolerance) {
122
+ ts1 = index1;
123
+ }
124
+
125
+ t1[index1++] = dot(val1.x, v) - dot(p, v);
126
+ }
127
+
128
+ var val2 = vtkPlane.intersectWithLine(pts2[id1], pts2[id2], p1, n1);
129
+
130
+ if (val2.intersection && val2.t > 0 - tolerance && val2.t < 1 + tolerance) {
131
+ if (val2.t < 1 + tolerance && val2.t > 1 - tolerance) {
132
+ ts2 = index2;
133
+ }
134
+
135
+ t2[index2++] = dot(val2.x, v) - dot(p, v);
136
+ }
137
+ } // If the value of the index is greater than 2, the intersecting point
138
+ // actually is intersected by all three edges. In this case, set the two
139
+ // edges to the two edges where the intersecting point is not the end point
140
+
141
+
142
+ if (index1 > 2) {
143
+ index1--; // swap
144
+
145
+ var t12 = t1[2];
146
+ t1[2] = t1[ts1];
147
+ t1[ts1] = t12;
148
+ }
149
+
150
+ if (index2 > 2) {
151
+ index2--;
152
+ var t22 = t2[2];
153
+ t2[2] = t2[ts2];
154
+ t2[ts2] = t22;
155
+ } // Check if only one edge or all edges intersect the supporting
156
+ // planes intersection.
157
+
158
+
159
+ if (index1 !== 2 || index2 !== 2) {
160
+ // vtkDebugMacro(<<"Only one edge intersecting!");
161
+ return {
162
+ intersect: false,
163
+ coplanar: coplanar,
164
+ pt1: pt1,
165
+ pt2: pt2,
166
+ surfaceId: surfaceId
167
+ };
168
+ } // Check for NaNs
169
+
170
+
171
+ if (Number.isNaN(t1[0]) || Number.isNaN(t1[1]) || Number.isNaN(t2[0]) || Number.isNaN(t2[1])) {
172
+ // vtkWarningMacro(<<"NaNs!");
173
+ return {
174
+ intersect: false,
175
+ coplanar: coplanar,
176
+ pt1: pt1,
177
+ pt2: pt2,
178
+ surfaceId: surfaceId
179
+ };
180
+ }
181
+
182
+ if (t1[0] > t1[1]) {
183
+ // swap
184
+ var t11 = t1[1];
185
+ t1[1] = t1[0];
186
+ t1[0] = t11;
187
+ }
188
+
189
+ if (t2[0] > t2[1]) {
190
+ // swap
191
+ var t21 = t2[1];
192
+ t2[1] = t2[0];
193
+ t2[0] = t21;
194
+ } // Handle the different interval configuration cases.
195
+
196
+
197
+ var tt1;
198
+ var tt2;
199
+
200
+ if (t1[1] < t2[0] || t2[1] < t1[0]) {
201
+ // vtkDebugMacro(<<"No Overlap!");
202
+ return {
203
+ intersect: false,
204
+ coplanar: coplanar,
205
+ pt1: pt1,
206
+ pt2: pt2,
207
+ surfaceId: surfaceId
208
+ }; // No overlap
209
+ }
210
+
211
+ if (t1[0] < t2[0]) {
212
+ if (t1[1] < t2[1]) {
213
+ // First point on surface 2, second point on surface 1
214
+ surfaceId[0] = 2;
215
+ surfaceId[1] = 1;
216
+ tt1 = t2[0];
217
+ tt2 = t1[1];
218
+ } else {
219
+ // Both points belong to lines on surface 2
220
+ surfaceId[0] = 2;
221
+ surfaceId[1] = 2;
222
+ tt1 = t2[0];
223
+ tt2 = t2[1];
224
+ }
225
+ } // t1[0] >= t2[0]
226
+ else if (t1[1] < t2[1]) {
227
+ // Both points belong to lines on surface 1
228
+ surfaceId[0] = 1;
229
+ surfaceId[1] = 1;
230
+ tt1 = t1[0];
231
+ tt2 = t1[1];
232
+ } else {
233
+ // First point on surface 1, second point on surface 2
234
+ surfaceId[0] = 1;
235
+ surfaceId[1] = 2;
236
+ tt1 = t1[0];
237
+ tt2 = t2[1];
238
+ } // Create actual intersection points.
239
+
240
+
241
+ multiplyAccumulate(p, v, tt1, pt1);
242
+ multiplyAccumulate(p, v, tt2, pt2);
243
+ return {
244
+ intersect: true,
245
+ coplanar: coplanar,
246
+ pt1: pt1,
247
+ pt2: pt2,
248
+ surfaceId: surfaceId
249
+ };
36
250
  } // ----------------------------------------------------------------------------
37
251
  // Static API
38
252
  // ----------------------------------------------------------------------------
@@ -40,7 +254,8 @@ function computeNormal(v1, v2, v3, n) {
40
254
 
41
255
  var STATIC = {
42
256
  computeNormalDirection: computeNormalDirection,
43
- computeNormal: computeNormal
257
+ computeNormal: computeNormal,
258
+ intersectWithTriangle: intersectWithTriangle
44
259
  }; // ----------------------------------------------------------------------------
45
260
  // vtkTriangle methods
46
261
  // ----------------------------------------------------------------------------
@@ -2,7 +2,7 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import { mat4, mat3 } from 'gl-matrix';
3
3
  import Constants from './LandmarkTransform/Constants.js';
4
4
  import macro from '../../macros.js';
5
- import { o as jacobiN, p as perpendiculars } from '../Core/Math/index.js';
5
+ import { p as jacobiN, q as perpendiculars } from '../Core/Math/index.js';
6
6
 
7
7
  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; }
8
8
 
@@ -0,0 +1,82 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
+ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
3
+ import macro from '../../../macros.js';
4
+
5
+ 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; }
6
+
7
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
+ // vtkOBBNode methods
9
+ // ----------------------------------------------------------------------------
10
+
11
+ function vtkOBBNode(publicAPI, model) {
12
+ // Set our classname
13
+ model.classHierarchy.push('vtkOBBNode');
14
+ /**
15
+ * Copy a vtkOBBNode into an other one
16
+ * @param {vtkOBBNode} nodeSource
17
+ * @param {vtkOBBNode} nodeTarget
18
+ */
19
+
20
+ publicAPI.deepCopy = function (nodeSource) {
21
+ publicAPI.setCorner(nodeSource.getCorner());
22
+ var axes = nodeSource.getAxes();
23
+ publicAPI.setAxes([_toConsumableArray(axes[0]), _toConsumableArray(axes[1]), _toConsumableArray(axes[2])]);
24
+ publicAPI.setCells(_toConsumableArray(nodeSource.getCells()));
25
+
26
+ if (nodeSource.getKids()) {
27
+ var kids0 = vtkOBBNode.newInstance();
28
+ kids0.setParent(publicAPI);
29
+ var kids1 = vtkOBBNode.newInstance();
30
+ kids1.setParent(publicAPI);
31
+ kids0.deepCopy(nodeSource.getKids()[0]);
32
+ kids1.deepCopy(nodeSource.getKids()[1], kids1);
33
+ publicAPI.setKids(kids0, kids1);
34
+ }
35
+ };
36
+
37
+ publicAPI.getAxis = function (axis) {
38
+ return model.axes[axis];
39
+ };
40
+ } // ----------------------------------------------------------------------------
41
+
42
+
43
+ function defaultValues(initialValues) {
44
+ return _objectSpread({
45
+ corner: [0, 0, 0],
46
+ // center point of this node
47
+ axes: [[0, 0, 0], [0, 0, 0], [0, 0, 0]],
48
+ // the axes defining the OBB - ordered from long->short
49
+ cells: []
50
+ }, initialValues);
51
+ } // ----------------------------------------------------------------------------
52
+
53
+
54
+ function extend(publicAPI, model) {
55
+ var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
56
+ Object.assign(model, defaultValues(initialValues));
57
+ model.corner = [0, 0, 0];
58
+ model.axes = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];
59
+ model.parent = null; // parent node; null if root
60
+
61
+ model.kids = null; // two children of this node; nullptr if leaf
62
+
63
+ model.cells = []; // list of cells in node
64
+ // Build VTK API
65
+
66
+ macro.setGet(publicAPI, model, ['parent', 'cells', 'kids']); // macro.setGetArray(publicAPI, model, ['kids'], 2);
67
+
68
+ macro.setGetArray(publicAPI, model, ['corner', 'axes'], 3); // Make this a VTK object
69
+
70
+ macro.obj(publicAPI, model); // Object specific methods
71
+
72
+ vtkOBBNode(publicAPI, model);
73
+ } // ----------------------------------------------------------------------------
74
+
75
+ var newInstance = macro.newInstance(extend, 'vtkOBBNode'); // ----------------------------------------------------------------------------
76
+
77
+ var vtkOBBNode$1 = {
78
+ newInstance: newInstance,
79
+ extend: extend
80
+ };
81
+
82
+ export { vtkOBBNode$1 as default, extend, newInstance };
@@ -0,0 +1,92 @@
1
+ import { CellType } from '../../../Common/DataModel/CellTypes/Constants.js';
2
+ import vtkOBJReader from '../../../IO/Misc/OBJReader.js';
3
+
4
+ /**
5
+ * Get the correct point ID from a cell id
6
+ * @param {Array} cellPtsIds
7
+ * @param {CellType} type
8
+ * @param {Number} idx
9
+ * @returns {Object} Contains three point's id of cells as 'ptId0', 'ptId1', 'ptId2'
10
+ */
11
+
12
+ function getCellTriangles(cellPtsIds, type, idx) {
13
+ var ptId0 = -1;
14
+ var ptId1 = -1;
15
+ var ptId2 = -1;
16
+ var cellListLength = cellPtsIds.length;
17
+
18
+ switch (type) {
19
+ case CellType.VTK_TRIANGLE:
20
+ case CellType.VTK_POLYGON:
21
+ case CellType.VTK_QUAD:
22
+ {
23
+ if (idx > cellListLength) break;
24
+ ptId0 = cellPtsIds[0];
25
+ ptId1 = cellPtsIds[idx + 1];
26
+ ptId2 = cellPtsIds[idx + 2];
27
+ break;
28
+ }
29
+
30
+ case CellType.VTK_TRIANGLE_STRIP:
31
+ {
32
+ // eslint-disable-next-line no-bitwise
33
+ var idx1 = idx + 1 + (idx & 1); // eslint-disable-next-line no-bitwise
34
+
35
+ var idx2 = idx + 2 - (idx & 1);
36
+ if (idx1 > cellListLength || idx2 > cellListLength) break;
37
+ ptId0 = cellPtsIds[idx];
38
+ ptId1 = cellPtsIds[idx1];
39
+ ptId2 = cellPtsIds[idx2];
40
+ break;
41
+ }
42
+
43
+ default:
44
+ ptId0 = -1;
45
+ ptId1 = -1;
46
+ ptId2 = -1;
47
+ break;
48
+ }
49
+
50
+ return {
51
+ ptId0: ptId0,
52
+ ptId1: ptId1,
53
+ ptId2: ptId2
54
+ };
55
+ }
56
+ /**
57
+ * Concatenate second typed array to the first typed array.
58
+ * @param {TypedArray} first
59
+ * @param {TypedArray} second Must be of the same type as first
60
+ * @return {TypedArray}
61
+ */
62
+
63
+ function pushArray(first, second) {
64
+ var firstLength = first.length;
65
+ var result = new first.constructor(firstLength + second.length);
66
+ result.set(first);
67
+ result.set(second, firstLength);
68
+ return result;
69
+ }
70
+ /**
71
+ * Load an obj with point's colors
72
+ *
73
+ * @param {string} url path to the OBJ file
74
+ * @return Promise
75
+ * ---> success : Return vtkPolyData
76
+ * ---> failed : Error message
77
+ */
78
+
79
+ function loadOBJ(url) {
80
+ return new Promise(function (resolve, reject) {
81
+ var reader = vtkOBJReader.newInstance();
82
+ reader.setUrl(url).then(function () {
83
+ var data = reader.getOutputData();
84
+ resolve(data);
85
+ }, function () {
86
+ // eslint-disable-next-line prefer-promise-reject-errors
87
+ reject('Error when loading ', url);
88
+ });
89
+ });
90
+ }
91
+
92
+ export { getCellTriangles, loadOBJ, pushArray };