@kitware/vtk.js 26.4.1 → 26.5.1

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.
@@ -38,25 +38,43 @@ function formatAnnotationValue(value) {
38
38
 
39
39
 
40
40
  function getPropCoarseHull(prop) {
41
- var _prop$getMapper, _prop$getMapper$call, _prop$getMapper$call$;
41
+ var _prop$getMapper, _mapper$getBounds;
42
42
 
43
43
  if (!prop.getVisibility() || !prop.getUseBounds()) {
44
44
  return [];
45
45
  }
46
46
 
47
- var mapperBounds = prop === null || prop === void 0 ? void 0 : (_prop$getMapper = prop.getMapper) === null || _prop$getMapper === void 0 ? void 0 : (_prop$getMapper$call = _prop$getMapper.call(prop)) === null || _prop$getMapper$call === void 0 ? void 0 : (_prop$getMapper$call$ = _prop$getMapper$call.getBounds) === null || _prop$getMapper$call$ === void 0 ? void 0 : _prop$getMapper$call$.call(_prop$getMapper$call);
48
- var corners = [];
47
+ var finestBounds = prop.getBounds();
48
+ var finestMatrix = null; // Better bounds using mapper bounds and prop matrix
49
+
50
+ var mapper = prop === null || prop === void 0 ? void 0 : (_prop$getMapper = prop.getMapper) === null || _prop$getMapper === void 0 ? void 0 : _prop$getMapper.call(prop);
51
+ var mapperBounds = mapper === null || mapper === void 0 ? void 0 : (_mapper$getBounds = mapper.getBounds) === null || _mapper$getBounds === void 0 ? void 0 : _mapper$getBounds.call(mapper);
49
52
 
50
53
  if (mapperBounds && vtkBoundingBox.isValid(mapperBounds) && prop.getMatrix) {
51
- vtkBoundingBox.getCorners(mapperBounds, corners);
52
- var matrix = prop.getMatrix().slice();
53
- mat4.transpose(matrix, matrix);
54
+ var _mapper$getInputData;
55
+
56
+ finestBounds = mapperBounds;
57
+ finestMatrix = prop.getMatrix().slice();
58
+ mat4.transpose(finestMatrix, finestMatrix); // Better bounds using the image data matrix and prop matrix + imageData matrix
59
+
60
+ if (mapper.isA('vtkImageMapper') && (_mapper$getInputData = mapper.getInputData()) !== null && _mapper$getInputData !== void 0 && _mapper$getInputData.isA('vtkImageData')) {
61
+ prop.computeMatrix();
62
+ var imageData = mapper.getInputData();
63
+ finestBounds = imageData.getSpatialExtent();
64
+ var imageDataMatrix = imageData.getIndexToWorld();
65
+ mat4.mul(finestMatrix, finestMatrix, imageDataMatrix);
66
+ }
67
+ } // Compute corners and transform them if needed
68
+ // It gives a more accurate hull than computing the corners of a transformed bounding box
69
+
70
+
71
+ var corners = [];
72
+ vtkBoundingBox.getCorners(finestBounds, corners);
73
+
74
+ if (finestMatrix) {
54
75
  corners.forEach(function (pt) {
55
- return vec3.transformMat4(pt, pt, matrix);
76
+ return vec3.transformMat4(pt, pt, finestMatrix);
56
77
  });
57
- } else {
58
- var propBounds = prop.getBounds();
59
- vtkBoundingBox.getCorners(propBounds, corners);
60
78
  }
61
79
 
62
80
  return corners;
@@ -213,7 +213,7 @@ export interface vtkImageMapper extends vtkAbstractMapper {
213
213
  * Set the slice from a given focal point.
214
214
  * @param {Boolean} sliceAtFocalPoint
215
215
  */
216
- sliceAtFocalPoint(sliceAtFocalPoint: boolean): boolean;
216
+ setSliceAtFocalPoint(sliceAtFocalPoint: boolean): boolean;
217
217
 
218
218
  /**
219
219
  * Set the slice for the X axis.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "26.4.1",
3
+ "version": "26.5.1",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",