@kitware/vtk.js 22.6.0 → 23.0.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.
Files changed (41) hide show
  1. package/Common/Core/MatrixBuilder.d.ts +3 -3
  2. package/Common/DataModel/ITKHelper.js +16 -20
  3. package/Common/DataModel/ImageData.d.ts +48 -46
  4. package/Filters/General/ImageSliceFilter.d.ts +1 -1
  5. package/Filters/General/ImageStreamline.d.ts +135 -0
  6. package/IO/Core/DataAccessHelper/HtmlDataAccessHelper.d.ts +9 -0
  7. package/IO/Core/DataAccessHelper/HttpDataAccessHelper.d.ts +9 -0
  8. package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.d.ts +13 -0
  9. package/IO/Core/DataAccessHelper/LiteHttpDataAccessHelper.d.ts +9 -0
  10. package/IO/Core/DataAccessHelper.d.ts +32 -0
  11. package/IO/Core/HttpDataSetReader.d.ts +226 -0
  12. package/IO/Geometry/DracoReader.d.ts +12 -8
  13. package/IO/Geometry/PLYReader.d.ts +12 -8
  14. package/IO/Geometry/STLReader.d.ts +13 -8
  15. package/IO/Misc/ElevationReader.d.ts +10 -5
  16. package/IO/Misc/JSONNucleoReader.d.ts +12 -8
  17. package/IO/Misc/JSONReader.d.ts +3 -3
  18. package/IO/Misc/MTLReader.d.ts +9 -5
  19. package/IO/Misc/OBJReader.d.ts +9 -5
  20. package/IO/Misc/PDBReader.d.ts +9 -5
  21. package/IO/XML/XMLReader.d.ts +19 -15
  22. package/Interaction/Widgets/OrientationMarkerWidget.d.ts +12 -0
  23. package/Interaction/Widgets/OrientationMarkerWidget.js +62 -37
  24. package/LICENSE +21 -18
  25. package/Rendering/Core/Actor.d.ts +17 -14
  26. package/Rendering/Core/ImageProperty.d.ts +9 -0
  27. package/Rendering/Core/ImageProperty.js +3 -2
  28. package/Rendering/Core/RenderWindowInteractor.js +30 -5
  29. package/Rendering/Core/Renderer.d.ts +5 -5
  30. package/Rendering/OpenGL/ImageMapper.js +1 -1
  31. package/Rendering/OpenGL/VolumeMapper.js +16 -1
  32. package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
  33. package/Rendering/WebGPU/HardwareSelectionPass.js +0 -1
  34. package/Rendering/WebGPU/ImageMapper.js +1 -1
  35. package/Rendering/WebGPU/OrderIndependentTranslucentPass.js +1 -3
  36. package/Rendering/WebGPU/RenderEncoder.js +1 -4
  37. package/Widgets/Core/AbstractWidgetFactory.js +5 -3
  38. package/index.d.ts +146 -0
  39. package/package.json +3 -2
  40. package/tsconfig.json +8 -0
  41. package/vtk.d.ts +15 -0
@@ -1,4 +1,8 @@
1
1
  import { vtkAlgorithm, vtkObject } from '@kitware/vtk.js/interfaces';
2
+ import HtmlDataAccessHelper from '@kitware/vtk.js/IO/Core/DataAccessHelper/HtmlDataAccessHelper';
3
+ import HttpDataAccessHelper from '@kitware/vtk.js/IO/Core/DataAccessHelper/HttpDataAccessHelper';
4
+ import JSZipDataAccessHelper from '@kitware/vtk.js/IO/Core/DataAccessHelper/JSZipDataAccessHelper';
5
+ import LiteHttpDataAccessHelper from '@kitware/vtk.js/IO/Core/DataAccessHelper/LiteHttpDataAccessHelper';
2
6
 
3
7
 
4
8
  interface IXMLReaderOptions {
@@ -36,7 +40,7 @@ export interface vtkXMLReader extends vtkXMLReaderBase {
36
40
  /**
37
41
  *
38
42
  */
39
- getDataAccessHelper(): any;
43
+ getDataAccessHelper(): HtmlDataAccessHelper | HttpDataAccessHelper | JSZipDataAccessHelper | LiteHttpDataAccessHelper;
40
44
 
41
45
  /**
42
46
  * Get the url of the object to load.
@@ -74,17 +78,17 @@ export interface vtkXMLReader extends vtkXMLReaderBase {
74
78
  requestData(inData: any, outData: any): void;
75
79
 
76
80
  /**
77
- * Set the url of the object to load.
78
- * @param {String} url the url of the object to load.
79
- * @param {IXMLReaderOptions} [option] The XML reader options.
81
+ *
82
+ * @param dataAccessHelper
80
83
  */
81
- setUrl(url: string, option?: IXMLReaderOptions): boolean;
84
+ setDataAccessHelper(dataAccessHelper: HtmlDataAccessHelper | HttpDataAccessHelper | JSZipDataAccessHelper | LiteHttpDataAccessHelper): boolean;
82
85
 
83
86
  /**
84
- *
85
- * @param dataAccessHelper
87
+ * Set the url of the object to load.
88
+ * @param {String} url the url of the object to load.
89
+ * @param {IXMLReaderOptions} [option] The XML reader options.
86
90
  */
87
- setDataAccessHelper(dataAccessHelper: any): boolean;
91
+ setUrl(url: string, option?: IXMLReaderOptions): Promise<any>;
88
92
  }
89
93
 
90
94
  /**
@@ -98,34 +102,34 @@ export function extend(publicAPI: object, model: object, initialValues?: IXMLRea
98
102
 
99
103
  /**
100
104
  * @param {Number} size
101
- * @param dataArrayElem
105
+ * @param {HTMLElement} dataArrayElem
102
106
  * @param {String} compressor
103
107
  * @param {String} byteOrder
104
108
  * @param {String} headerType
105
109
  * @param {ArrayBuffer} binaryBuffer
106
110
  */
107
- export function processDataArray(size: number, dataArrayElem: any, compressor: string, byteOrder: string, headerType: string, binaryBuffer: ArrayBuffer): IRet;
111
+ export function processDataArray(size: number, dataArrayElem: HTMLElement, compressor: string, byteOrder: string, headerType: string, binaryBuffer: ArrayBuffer): IRet;
108
112
 
109
113
  /**
110
114
  * @param {Number} size
111
- * @param containerElem
115
+ * @param {HTMLElement} containerElem
112
116
  * @param {String} compressor
113
117
  * @param {String} byteOrder
114
118
  * @param {String} headerType
115
119
  * @param {ArrayBuffer} binaryBuffer
116
120
  */
117
- export function processCells(size: number, containerElem: any, compressor: string, byteOrder: string, headerType: string, binaryBuffer: ArrayBuffer): Uint32Array;
121
+ export function processCells(size: number, containerElem: HTMLElement, compressor: string, byteOrder: string, headerType: string, binaryBuffer: ArrayBuffer): Uint32Array;
118
122
 
119
123
  /**
120
124
  * @param {Number} size
121
- * @param fieldElem
122
- * @param fieldContainer
125
+ * @param {HTMLElement} fieldElem
126
+ * @param {HTMLElement} fieldContainer
123
127
  * @param {String} compressor
124
128
  * @param {String} byteOrder
125
129
  * @param {String} headerType
126
130
  * @param {ArrayBuffer} binaryBuffer
127
131
  */
128
- export function processFieldData(size: number, fieldElem: any, fieldContainer: any, compressor: string, byteOrder: string, headerType: string, binaryBuffer: ArrayBuffer): void;
132
+ export function processFieldData(size: number, fieldElem: HTMLElement, fieldContainer: HTMLElement, compressor: string, byteOrder: string, headerType: string, binaryBuffer: ArrayBuffer): void;
129
133
 
130
134
 
131
135
  /**
@@ -17,6 +17,7 @@ export enum Corners {
17
17
  export interface IOrientationMarkerWidgetInitialValues {
18
18
  actor?: vtkAnnotatedCubeActor | vtkAxesActor,
19
19
  interactor?: vtkRenderWindowInteractor,
20
+ parentRenderer?: vtkRenderer,
20
21
  viewportCorner?: Corners,
21
22
  viewportSize?: number,
22
23
  minPixelSize?: number,
@@ -44,6 +45,11 @@ export interface vtkOrientationMarkerWidget extends vtkObject {
44
45
  */
45
46
  getActor(): vtkAnnotatedCubeActor | vtkAxesActor;
46
47
 
48
+ /**
49
+ * Gets the parent renderer, if any.
50
+ */
51
+ getParentRenderer(): vtkRenderer | null;
52
+
47
53
  /**
48
54
  * Get wheter the orientation marker is enabled.
49
55
  */
@@ -87,6 +93,12 @@ export interface vtkOrientationMarkerWidget extends vtkObject {
87
93
  */
88
94
  setActor(actor: vtkAnnotatedCubeActor | vtkAxesActor): void;
89
95
 
96
+ /**
97
+ * Sets the parent renderer
98
+ * @param ren The parent renderer
99
+ */
100
+ setParentRenderer(ren: vtkRenderer): boolean;
101
+
90
102
  /**
91
103
  * Set the widget enabled status, i.e. to show the widget or not.
92
104
  * @param {Boolean} enabled
@@ -23,38 +23,49 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
23
23
  var previousCameraInput = [];
24
24
  var selfRenderer = vtkRenderer.newInstance();
25
25
  var resizeObserver = new ResizeObserver(function (entries) {
26
- if (entries.length === 1) {
27
- publicAPI.updateViewport();
28
- }
26
+ publicAPI.updateViewport();
29
27
  });
30
- var interactorUnsubscribe = null;
28
+ var onAnimationSub = null;
29
+ var onEndAnimationSub = null;
31
30
  var selfSubscription = null;
32
31
 
33
32
  publicAPI.computeViewport = function () {
34
- var _model$interactor$get = model.interactor.getView().getSize(),
35
- _model$interactor$get2 = _slicedToArray(_model$interactor$get, 2),
36
- viewXSize = _model$interactor$get2[0],
37
- viewYSize = _model$interactor$get2[1];
33
+ var parentRen = model.parentRenderer || model.interactor.getCurrentRenderer();
34
+
35
+ var _parentRen$getViewpor = parentRen.getViewport(),
36
+ _parentRen$getViewpor2 = _slicedToArray(_parentRen$getViewpor, 4),
37
+ xMin = _parentRen$getViewpor2[0],
38
+ yMin = _parentRen$getViewpor2[1],
39
+ xMax = _parentRen$getViewpor2[2],
40
+ yMax = _parentRen$getViewpor2[3];
41
+
42
+ var view = model.interactor.getView();
43
+ var canvasSize = view.getSize();
44
+
45
+ var _view$getViewportSize = view.getViewportSize(parentRen),
46
+ _view$getViewportSize2 = _slicedToArray(_view$getViewportSize, 2),
47
+ viewXSize = _view$getViewportSize2[0],
48
+ viewYSize = _view$getViewportSize2[1];
38
49
 
39
50
  var minViewSize = Math.min(viewXSize, viewYSize);
40
51
  var pixelSize = model.viewportSize * minViewSize; // clamp pixel size
41
52
 
42
53
  pixelSize = Math.max(Math.min(model.minPixelSize, minViewSize), Math.min(model.maxPixelSize, pixelSize));
43
- var xFrac = pixelSize / viewXSize;
44
- var yFrac = pixelSize / viewYSize; // [left bottom right top]
54
+ var xFrac = pixelSize / canvasSize[0];
55
+ var yFrac = pixelSize / canvasSize[1]; // [left bottom right top]
45
56
 
46
57
  switch (model.viewportCorner) {
47
58
  case Corners.TOP_LEFT:
48
- return [0, 1 - yFrac, xFrac, 1];
59
+ return [xMin, yMax - yFrac, xMin + xFrac, yMax];
49
60
 
50
61
  case Corners.TOP_RIGHT:
51
- return [1 - xFrac, 1 - yFrac, 1, 1];
62
+ return [xMax - xFrac, yMax - yFrac, xMax, yMax];
52
63
 
53
64
  case Corners.BOTTOM_LEFT:
54
- return [0, 0, xFrac, yFrac];
65
+ return [xMin, yMin, xMin + xFrac, yMin + yFrac];
55
66
 
56
67
  case Corners.BOTTOM_RIGHT:
57
- return [1 - xFrac, 0, 1, yFrac];
68
+ return [xMax - xFrac, yMin, xMax, yMin + yFrac];
58
69
 
59
70
  default:
60
71
  vtkErrorMacro('Invalid widget corner');
@@ -63,12 +74,15 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
63
74
  };
64
75
 
65
76
  publicAPI.updateViewport = function () {
66
- selfRenderer.setViewport.apply(selfRenderer, _toConsumableArray(publicAPI.computeViewport()));
67
- model.interactor.render();
77
+ if (model.enabled) {
78
+ selfRenderer.setViewport.apply(selfRenderer, _toConsumableArray(publicAPI.computeViewport()));
79
+ model.interactor.render();
80
+ }
68
81
  };
69
82
 
70
83
  publicAPI.updateMarkerOrientation = function () {
71
- var currentCamera = model.interactor.findPokedRenderer().getActiveCamera();
84
+ var ren = model.parentRenderer || model.interactor.getCurrentRenderer();
85
+ var currentCamera = ren.getActiveCamera();
72
86
 
73
87
  if (!currentCamera) {
74
88
  return;
@@ -116,7 +130,8 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
116
130
  return;
117
131
  }
118
132
 
119
- var renderWindow = model.interactor.findPokedRenderer().getRenderWindow();
133
+ var ren = model.parentRenderer || model.interactor.getCurrentRenderer();
134
+ var renderWindow = ren.getRenderWindow();
120
135
  renderWindow.addRenderer(selfRenderer);
121
136
 
122
137
  if (renderWindow.getNumberOfLayers() < 2) {
@@ -128,10 +143,8 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
128
143
  selfRenderer.setInteractive(false);
129
144
  selfRenderer.addViewProp(model.actor);
130
145
  model.actor.setVisibility(true);
131
-
132
- var _model$interactor$onA = model.interactor.onAnimation(publicAPI.updateMarkerOrientation);
133
-
134
- interactorUnsubscribe = _model$interactor$onA.unsubscribe;
146
+ onAnimationSub = model.interactor.onAnimation(publicAPI.updateMarkerOrientation);
147
+ onEndAnimationSub = model.interactor.onEndAnimation(publicAPI.updateMarkerOrientation);
135
148
  resizeObserver.observe(model.interactor.getView().getCanvas());
136
149
  publicAPI.updateViewport();
137
150
  publicAPI.updateMarkerOrientation();
@@ -143,8 +156,10 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
143
156
 
144
157
  model.enabled = false;
145
158
  resizeObserver.disconnect();
146
- interactorUnsubscribe();
147
- interactorUnsubscribe = null;
159
+ onAnimationSub.unsubscribe();
160
+ onAnimationSub = null;
161
+ onEndAnimationSub.unsubscribe();
162
+ onEndAnimationSub = null;
148
163
  model.actor.setVisibility(false);
149
164
  selfRenderer.removeViewProp(model.actor);
150
165
 
@@ -168,10 +183,7 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
168
183
  }
169
184
 
170
185
  model.viewportCorner = corner;
171
-
172
- if (model.enabled) {
173
- publicAPI.updateViewport();
174
- }
186
+ publicAPI.updateViewport();
175
187
  };
176
188
  /**
177
189
  * Sets the viewport size.
@@ -186,10 +198,7 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
186
198
  }
187
199
 
188
200
  model.viewportSize = viewportSize;
189
-
190
- if (model.enabled) {
191
- publicAPI.updateViewport();
192
- }
201
+ publicAPI.updateViewport();
193
202
  };
194
203
 
195
204
  publicAPI.setActor = function (actor) {
@@ -199,6 +208,16 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
199
208
  publicAPI.setEnabled(previousState);
200
209
  };
201
210
 
211
+ publicAPI.setParentRenderer = function (ren) {
212
+ var changed = superClass.setParentRenderer(ren);
213
+
214
+ if (changed) {
215
+ publicAPI.updateViewport();
216
+ }
217
+
218
+ return changed;
219
+ };
220
+
202
221
  publicAPI.getRenderer = function () {
203
222
  return selfRenderer;
204
223
  };
@@ -211,9 +230,14 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
211
230
  selfSubscription = null;
212
231
  }
213
232
 
214
- if (interactorUnsubscribe) {
215
- interactorUnsubscribe();
216
- interactorUnsubscribe = null;
233
+ if (onAnimationSub) {
234
+ onAnimationSub.unsubscribe();
235
+ onAnimationSub = null;
236
+ }
237
+
238
+ if (onEndAnimationSub) {
239
+ onEndAnimationSub.unsubscribe();
240
+ onEndAnimationSub = null;
217
241
  }
218
242
 
219
243
  resizeObserver.disconnect();
@@ -233,7 +257,8 @@ var DEFAULT_VALUES = {
233
257
  viewportCorner: Constants.Corners.BOTTOM_LEFT,
234
258
  viewportSize: 0.2,
235
259
  minPixelSize: 50,
236
- maxPixelSize: 200
260
+ maxPixelSize: 200,
261
+ parentRenderer: null
237
262
  }; // ----------------------------------------------------------------------------
238
263
 
239
264
  function extend(publicAPI, model) {
@@ -244,7 +269,7 @@ function extend(publicAPI, model) {
244
269
  macro.get(publicAPI, model, ['enabled', 'viewportCorner', 'viewportSize']); // NOTE: setting these while the widget is enabled will
245
270
  // not update the widget.
246
271
 
247
- macro.setGet(publicAPI, model, ['interactor', 'minPixelSize', 'maxPixelSize']);
272
+ macro.setGet(publicAPI, model, ['interactor', 'minPixelSize', 'maxPixelSize', 'parentRenderer']);
248
273
  macro.get(publicAPI, model, ['actor']); // Object methods
249
274
 
250
275
  vtkOrientationMarkerWidget(publicAPI, model);
package/LICENSE CHANGED
@@ -3,22 +3,25 @@ All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
5
5
  modification, are permitted provided that the following conditions are met:
6
- * Redistributions of source code must retain the above copyright
7
- notice, this list of conditions and the following disclaimer.
8
- * Redistributions in binary form must reproduce the above copyright
9
- notice, this list of conditions and the following disclaimer in the
10
- documentation and/or other materials provided with the distribution.
11
- * Neither the name of the <organization> nor the
12
- names of its contributors may be used to endorse or promote products
13
- derived from this software without specific prior written permission.
14
6
 
15
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
- DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
19
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7
+ - Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ - Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ - Neither the name of the copyright holder nor the names of its
15
+ contributors may be used to endorse or promote products derived from
16
+ this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -31,7 +31,8 @@ export interface vtkActor extends vtkProp3D {
31
31
  getActors(): vtkActor[];
32
32
 
33
33
  /**
34
- *
34
+ * Get the property object that controls this actors backface surface
35
+ * properties.
35
36
  * @return {vtkProperty} the backface property.
36
37
  */
37
38
  getBackfaceProperty(): vtkProperty;
@@ -59,7 +60,7 @@ export interface vtkActor extends vtkProp3D {
59
60
  getIsOpaque(): boolean;
60
61
 
61
62
  /**
62
- *
63
+ * Get the Mapper that this actor is getting its data from.
63
64
  */
64
65
  getMapper(): null | vtkMapper;
65
66
 
@@ -85,32 +86,34 @@ export interface vtkActor extends vtkProp3D {
85
86
  makeProperty(): vtkProperty;
86
87
 
87
88
  /**
88
- *
89
- * @param backfaceProperty
89
+ * Set the property object that controls this actors backface surface
90
+ * properties.
91
+ * @param {vtkProperty} backfaceProperty The backfaceProperty instance.
90
92
  */
91
93
  setBackfaceProperty(backfaceProperty: vtkProperty): boolean;
92
94
 
93
95
  /**
94
- *
95
- * @param forceOpaque
96
+ * Force the actor to be treated as opaque or translucent.
97
+ * @param {Boolean} forceOpaque
96
98
  */
97
- setForceOpaque(forceOpaque: vtkProperty): boolean;
99
+ setForceOpaque(forceOpaque: boolean): boolean;
98
100
 
99
101
  /**
100
- *
101
- * @param forceTranslucent
102
+ * Force the actor to be treated as opaque or translucent.
103
+ * @param {Boolean} forceTranslucent
102
104
  */
103
105
  setForceTranslucent(forceTranslucent: boolean): boolean;
104
106
 
105
107
  /**
106
- *
107
- * @param mapper
108
+ * This is the method that is used to connect an actor to the end of a
109
+ * visualization pipeline, i.e. the mapper.
110
+ * @param {vtkMapper} mapper The vtkMapper instance.
108
111
  */
109
- setMapper(mapper: null | vtkMapper): boolean;
112
+ setMapper(mapper: vtkMapper): boolean;
110
113
 
111
114
  /**
112
- *
113
- * @param property
115
+ * Set the property object that controls this actors surface properties.
116
+ * @param {vtkProperty} property The vtkProperty instance.
114
117
  */
115
118
  setProperty(property: vtkProperty): boolean;
116
119
  }
@@ -20,6 +20,7 @@ export interface IImageMapperInitialValues {
20
20
  diffuse?: number;
21
21
  opacity?: number;
22
22
  componentData?: IComponentData[];
23
+ useLookupTableScalarRange?: boolean;
23
24
  }
24
25
 
25
26
  export interface vtkImageProperty extends vtkObject {
@@ -173,6 +174,14 @@ export interface vtkImageProperty extends vtkObject {
173
174
  * @param func
174
175
  */
175
176
  setScalarOpacity(index: any, func: any): boolean;
177
+
178
+ /**
179
+ * Use the range that is set on the lookup table, instead of setting the range from the
180
+ * ColorWindow/ColorLevel settings
181
+ * @default false
182
+ * @param {Boolean} useLookupTableScalarRange
183
+ */
184
+ setUseLookupTableScalarRange(useLookupTableScalarRange: boolean): boolean;
176
185
  }
177
186
 
178
187
  /**
@@ -154,7 +154,8 @@ var DEFAULT_VALUES = {
154
154
  colorLevel: 127.5,
155
155
  ambient: 1.0,
156
156
  diffuse: 0.0,
157
- opacity: 1.0
157
+ opacity: 1.0,
158
+ useLookupTableScalarRange: false
158
159
  }; // ----------------------------------------------------------------------------
159
160
 
160
161
  function extend(publicAPI, model) {
@@ -175,7 +176,7 @@ function extend(publicAPI, model) {
175
176
  }
176
177
  }
177
178
 
178
- macro.setGet(publicAPI, model, ['independentComponents', 'interpolationType', 'colorWindow', 'colorLevel', 'ambient', 'diffuse', 'opacity']); // Object methods
179
+ macro.setGet(publicAPI, model, ['independentComponents', 'interpolationType', 'colorWindow', 'colorLevel', 'ambient', 'diffuse', 'opacity', 'useLookupTableScalarRange']); // Object methods
179
180
 
180
181
  vtkImageProperty(publicAPI, model);
181
182
  } // ----------------------------------------------------------------------------
@@ -325,7 +325,21 @@ function vtkRenderWindowInteractor(publicAPI, model) {
325
325
 
326
326
  animationRequesters.add(requestor);
327
327
 
328
- if (animationRequesters.size === 1 && !model.xrAnimation) {
328
+ if (!model.animationRequest && animationRequesters.size === 1 && !model.xrAnimation) {
329
+ model._animationStartTime = Date.now();
330
+ model._animationFrameCount = 0;
331
+ model.animationRequest = requestAnimationFrame(publicAPI.handleAnimation);
332
+ publicAPI.startAnimationEvent();
333
+ }
334
+ }; // continue animating for at least the specified duration of
335
+ // milliseconds.
336
+
337
+
338
+ publicAPI.extendAnimation = function (duration) {
339
+ var newEnd = Date.now() + duration;
340
+ model._animationExtendedEnd = Math.max(model._animationExtendedEnd, newEnd);
341
+
342
+ if (!model.animationRequest && animationRequesters.size === 0 && !model.xrAnimation) {
329
343
  model._animationStartTime = Date.now();
330
344
  model._animationFrameCount = 0;
331
345
  model.animationRequest = requestAnimationFrame(publicAPI.handleAnimation);
@@ -351,7 +365,7 @@ function vtkRenderWindowInteractor(publicAPI, model) {
351
365
 
352
366
  animationRequesters.delete(requestor);
353
367
 
354
- if (model.animationRequest && animationRequesters.size === 0) {
368
+ if (model.animationRequest && animationRequesters.size === 0 && Date.now() > model._animationExtendedEnd) {
355
369
  cancelAnimationFrame(model.animationRequest);
356
370
  model.animationRequest = null;
357
371
  publicAPI.endAnimationEvent();
@@ -462,7 +476,15 @@ function vtkRenderWindowInteractor(publicAPI, model) {
462
476
 
463
477
  publicAPI.animationEvent();
464
478
  forceRender();
465
- model.animationRequest = requestAnimationFrame(publicAPI.handleAnimation);
479
+
480
+ if (animationRequesters.size > 0 || Date.now() < model._animationExtendedEnd) {
481
+ model.animationRequest = requestAnimationFrame(publicAPI.handleAnimation);
482
+ } else {
483
+ cancelAnimationFrame(model.animationRequest);
484
+ model.animationRequest = null;
485
+ publicAPI.endAnimationEvent();
486
+ publicAPI.render();
487
+ }
466
488
  };
467
489
 
468
490
  publicAPI.handleWheel = function (event) {
@@ -497,9 +519,10 @@ function vtkRenderWindowInteractor(publicAPI, model) {
497
519
 
498
520
 
499
521
  model.wheelTimeoutID = setTimeout(function () {
522
+ publicAPI.extendAnimation(600);
500
523
  publicAPI.endMouseWheelEvent();
501
524
  model.wheelTimeoutID = 0;
502
- }, 800);
525
+ }, 200);
503
526
  };
504
527
 
505
528
  publicAPI.handleMouseEnter = function (event) {
@@ -987,7 +1010,9 @@ function extend(publicAPI, model) {
987
1010
  var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
988
1011
  Object.assign(model, DEFAULT_VALUES, initialValues); // Object methods
989
1012
 
990
- macro.obj(publicAPI, model);
1013
+ macro.obj(publicAPI, model); // run animation at least until this time
1014
+
1015
+ model._animationExtendedEnd = 0;
991
1016
  macro.event(publicAPI, model, 'RenderEvent');
992
1017
  handledEvents.forEach(function (eventName) {
993
1018
  return macro.event(publicAPI, model, eventName);
@@ -47,14 +47,14 @@ export interface vtkRenderer extends vtkViewport {
47
47
  isActiveCameraCreated(): boolean;
48
48
 
49
49
  /**
50
- *
51
- * @param actor
50
+ * Add different types of props to the renderer.
51
+ * @param {vtkActor} actor The vtkActor instance.
52
52
  */
53
53
  addActor(actor: vtkActor): boolean;
54
54
 
55
55
  /**
56
56
  * Add a light to the list of lights.
57
- * @param light The vtkLight instance.
57
+ * @param {vtkLight} light The vtkLight instance.
58
58
  */
59
59
  addLight(light: vtkLight): void;
60
60
 
@@ -75,9 +75,9 @@ export interface vtkRenderer extends vtkViewport {
75
75
  createLight(): vtkLight;
76
76
 
77
77
  /**
78
- *
78
+ * Compute the bounding box of all the visible props Used in ResetCamera() and ResetCameraClippingRange()
79
79
  */
80
- computeVisiblePropBounds(): number[];
80
+ computeVisiblePropBounds(): Bounds;
81
81
 
82
82
  /**
83
83
  * Get the active camera
@@ -320,7 +320,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
320
320
  var target = iComps ? _i : 0;
321
321
  var cfun = actor.getProperty().getRGBTransferFunction(target);
322
322
 
323
- if (cfun) {
323
+ if (cfun && actor.getProperty().getUseLookupTableScalarRange()) {
324
324
  var cRange = cfun.getRange();
325
325
  cw = cRange[1] - cRange[0];
326
326
  cl = 0.5 * (cRange[1] + cRange[0]);
@@ -520,6 +520,9 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
520
520
  var size = publicAPI.getRenderTargetSize();
521
521
  program.setUniformf('vpWidth', size[0]);
522
522
  program.setUniformf('vpHeight', size[1]);
523
+ var offset = publicAPI.getRenderTargetOffset();
524
+ program.setUniformf('vpOffsetX', offset[0] / size[0]);
525
+ program.setUniformf('vpOffsetY', offset[1] / size[1]);
523
526
  }
524
527
  }
525
528
 
@@ -688,7 +691,19 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
688
691
  return [model._smallViewportWidth, model._smallViewportHeight];
689
692
  }
690
693
 
691
- return model.openGLRenderWindow.getFramebufferSize();
694
+ var _model$openGLRenderer = model.openGLRenderer.getTiledSizeAndOrigin(),
695
+ usize = _model$openGLRenderer.usize,
696
+ vsize = _model$openGLRenderer.vsize;
697
+
698
+ return [usize, vsize];
699
+ };
700
+
701
+ publicAPI.getRenderTargetOffset = function () {
702
+ var _model$openGLRenderer2 = model.openGLRenderer.getTiledSizeAndOrigin(),
703
+ lowerLeftU = _model$openGLRenderer2.lowerLeftU,
704
+ lowerLeftV = _model$openGLRenderer2.lowerLeftV;
705
+
706
+ return [lowerLeftU, lowerLeftV];
692
707
  };
693
708
 
694
709
  publicAPI.renderPieceStart = function (ren, actor) {