@kitware/vtk.js 24.16.3 → 24.16.6

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.
@@ -1,4 +1,5 @@
1
1
  import { vtkObject, vtkSubscription } from './../../interfaces';
2
+ import vtkImageStream from './ImageStream';
2
3
 
3
4
  /**
4
5
  * Bind optional dependency from WSLink to our current class.
@@ -134,7 +135,7 @@ export interface vtkWSLinkClient extends vtkObject {
134
135
  /**
135
136
  *
136
137
  */
137
- getImageStream(): object;
138
+ getImageStream(): vtkImageStream;
138
139
 
139
140
  /**
140
141
  *
@@ -199,7 +199,10 @@ function vtkMouseRangeManipulator(publicAPI, model) {
199
199
  // and the last `onMouseMove` event, we must make sure the pointer
200
200
  // is still locked before we run this logic otherwise we may
201
201
  // get a `onMouseMove` call after the pointer has been unlocked.
202
- if (!interactor.isPointerLocked()) return;
202
+ if (!interactor.isPointerLocked()) return; // previousPosition could be undefined if for some reason the
203
+ // `startPointerLockEvent` method is called before the `onButtonDown` one.
204
+
205
+ if (model.previousPosition == null) return;
203
206
  model.previousPosition.x += event.movementX;
204
207
  model.previousPosition.y += event.movementY;
205
208
  publicAPI.onMouseMove(interactor, renderer, model.previousPosition);
@@ -47,10 +47,10 @@ export interface vtkImageMapper extends vtkAbstractMapper {
47
47
  /**
48
48
  * Get the bounds for a given slice as [xmin, xmax, ymin, ymax,zmin, zmax].
49
49
  * @param {Number} [slice] The slice index.
50
- * @param {Number} [thickness] The slice thickness.
50
+ * @param {Number} [halfThickness] Half the slice thickness in index space (unit voxel spacing).
51
51
  * @return {Number[]} The bounds for a given slice.
52
52
  */
53
- getBoundsForSlice(slice?: number, thickness?: number): number[];
53
+ getBoundsForSlice(slice?: number, halfThickness?: number): number[];
54
54
 
55
55
  /**
56
56
  *
@@ -296,14 +296,14 @@ function vtkImageMapper(publicAPI, model) {
296
296
 
297
297
  publicAPI.getBoundsForSlice = function () {
298
298
  var slice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : model.slice;
299
- var thickness = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
299
+ var halfThickness = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
300
300
  var image = publicAPI.getInputData();
301
301
 
302
302
  if (!image) {
303
303
  return createUninitializedBounds();
304
304
  }
305
305
 
306
- var extent = image.getExtent();
306
+ var extent = image.getSpatialExtent();
307
307
 
308
308
  var _publicAPI$getClosest3 = publicAPI.getClosestIJKAxis(),
309
309
  ijkMode = _publicAPI$getClosest3.ijkMode;
@@ -317,18 +317,18 @@ function vtkImageMapper(publicAPI, model) {
317
317
 
318
318
  switch (ijkMode) {
319
319
  case SlicingMode.I:
320
- extent[0] = nSlice - thickness;
321
- extent[1] = nSlice + thickness;
320
+ extent[0] = nSlice - halfThickness;
321
+ extent[1] = nSlice + halfThickness;
322
322
  break;
323
323
 
324
324
  case SlicingMode.J:
325
- extent[2] = nSlice - thickness;
326
- extent[3] = nSlice + thickness;
325
+ extent[2] = nSlice - halfThickness;
326
+ extent[3] = nSlice + halfThickness;
327
327
  break;
328
328
 
329
329
  case SlicingMode.K:
330
- extent[4] = nSlice - thickness;
331
- extent[5] = nSlice + thickness;
330
+ extent[4] = nSlice - halfThickness;
331
+ extent[5] = nSlice + halfThickness;
332
332
  break;
333
333
  }
334
334
 
@@ -11,6 +11,7 @@ interface IRemoteViewInitialValues {
11
11
  rpcMouseEvent?: string;
12
12
  rpcGestureEvent?: any;
13
13
  rpcWheelEvent?: any;
14
+ viewStream?: vtkViewStream;
14
15
  }
15
16
 
16
17
  export interface vtkRemoteView extends vtkObject {
@@ -363,7 +363,9 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
363
363
  translateZ *= physicalScale;
364
364
  physicalTranslation[2] += translateZ;
365
365
  camera.setPhysicalScale(physicalScale);
366
- camera.setPhysicalTranslation(physicalTranslation);
366
+ camera.setPhysicalTranslation(physicalTranslation); // Clip at 0.1m, 100.0m in physical space by default
367
+
368
+ camera.setClippingRange(0.1 * physicalScale, 100.0 * physicalScale);
367
369
  };
368
370
 
369
371
  publicAPI.stopXR = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
@@ -67,7 +67,7 @@ function vtkWebGPURenderWindow(publicAPI, model) {
67
67
  publicAPI.recreateSwapChain = function () {
68
68
  if (model.context) {
69
69
  model.context.unconfigure();
70
- var presentationFormat = model.context.getPreferredFormat(model.adapter);
70
+ var presentationFormat = navigator.gpu.getPreferredCanvasFormat(model.adapter);
71
71
  /* eslint-disable no-undef */
72
72
 
73
73
  /* eslint-disable no-bitwise */
@@ -75,8 +75,10 @@ function vtkWebGPURenderWindow(publicAPI, model) {
75
75
  model.context.configure({
76
76
  device: model.device.getHandle(),
77
77
  format: presentationFormat,
78
+ alphaMode: 'premultiplied',
78
79
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_DST,
79
- size: model.size
80
+ width: model.size[0],
81
+ height: model.size[1]
80
82
  });
81
83
  model._configured = true;
82
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "24.16.3",
3
+ "version": "24.16.6",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",