@kitware/vtk.js 26.3.2 → 26.4.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 (55) hide show
  1. package/Common/Core/CellArray.d.ts +4 -0
  2. package/Common/Core/CellArray.js +4 -0
  3. package/Common/Core/LookupTable.js +4 -2
  4. package/Common/DataModel/Collection.d.ts +118 -0
  5. package/Common/DataModel/Collection.js +113 -0
  6. package/Interaction/Manipulators/CompositeCameraManipulator.d.ts +68 -0
  7. package/Interaction/Manipulators/CompositeGestureManipulator.d.ts +168 -0
  8. package/Interaction/Manipulators/CompositeKeyboardManipulator.d.ts +48 -0
  9. package/Interaction/Manipulators/CompositeMouseManipulator.d.ts +149 -0
  10. package/Interaction/Manipulators/CompositeVRManipulator.d.ts +44 -0
  11. package/Interaction/Manipulators/GestureCameraManipulator.d.ts +34 -0
  12. package/Interaction/Manipulators/MouseBoxSelectorManipulator.d.ts +88 -0
  13. package/Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.d.ts +32 -0
  14. package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.d.ts +33 -0
  15. package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.d.ts +33 -0
  16. package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.d.ts +67 -0
  17. package/Interaction/Manipulators/MouseCameraTrackballZoomManipulator.d.ts +45 -0
  18. package/Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.d.ts +26 -0
  19. package/Interaction/Manipulators/MouseRangeManipulator.d.ts +53 -0
  20. package/Interaction/Style/InteractorStyleManipulator.d.ts +333 -0
  21. package/Proxy/Core/AbstractRepresentationProxy.d.ts +24 -0
  22. package/Proxy/Core/LookupTableProxy.d.ts +45 -0
  23. package/Proxy/Core/PiecewiseFunctionProxy.d.ts +62 -0
  24. package/Proxy/Core/ProxyManager.d.ts +81 -0
  25. package/Proxy/Core/SourceProxy.d.ts +22 -0
  26. package/Proxy/Core/View2DProxy.d.ts +7 -0
  27. package/Proxy/Core/ViewProxy.d.ts +86 -0
  28. package/Proxy/Representations/SliceRepresentationProxy.d.ts +27 -0
  29. package/Proxy/Representations/VolumeRepresentationProxy.d.ts +44 -0
  30. package/Rendering/Core/AbstractImageMapper/helper.js +127 -0
  31. package/Rendering/Core/AbstractImageMapper.d.ts +82 -0
  32. package/Rendering/Core/AbstractImageMapper.js +42 -0
  33. package/Rendering/Core/CellPicker.js +1 -1
  34. package/Rendering/Core/ImageArrayMapper.d.ts +252 -0
  35. package/Rendering/Core/ImageArrayMapper.js +242 -0
  36. package/Rendering/Core/ImageMapper.d.ts +5 -35
  37. package/Rendering/Core/ImageMapper.js +16 -108
  38. package/Rendering/Core/InteractorStyle/Constants.d.ts +16 -0
  39. package/Rendering/Core/InteractorStyle.d.ts +229 -0
  40. package/Rendering/Core/PointPicker.js +1 -1
  41. package/Rendering/Core/ScalarBarActor.js +4 -2
  42. package/Rendering/Core/Texture.d.ts +5 -0
  43. package/Rendering/Core/Texture.js +3 -1
  44. package/Rendering/OpenGL/ImageMapper.js +13 -7
  45. package/Rendering/OpenGL/PolyDataMapper.js +3 -1
  46. package/Rendering/OpenGL/RenderWindow.d.ts +8 -1
  47. package/Rendering/OpenGL/RenderWindow.js +3 -2
  48. package/Rendering/OpenGL/Texture.js +19 -18
  49. package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
  50. package/Widgets/Core/StateBuilder.d.ts +29 -0
  51. package/Widgets/Representations/PolyLineRepresentation.js +16 -8
  52. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +0 -11
  53. package/Widgets/Widgets3D/ResliceCursorWidget.js +7 -14
  54. package/index.d.ts +30 -0
  55. package/package.json +1 -1
@@ -0,0 +1,229 @@
1
+ import { EventHandler, vtkSubscription } from './../../interfaces';
2
+ import vtkInteractorObserver from './InteractorObserver';
3
+
4
+ export interface vtkInteractorStyle extends vtkInteractorObserver {
5
+ /**
6
+ * Start a Rotate event.
7
+ */
8
+ startRotate(): void;
9
+
10
+ /**
11
+ * Invoke a StartRotate event.
12
+ */
13
+ invokeStartRotateEvent(...args: unknown[]): void;
14
+
15
+ /**
16
+ * Registers a callback on a StartRotate event.
17
+ */
18
+ onStartRotateEvent(cb: EventHandler, priority?: number): vtkSubscription;
19
+
20
+ /**
21
+ * Ends a Rotate event.
22
+ */
23
+ endRotate(): void;
24
+
25
+ /**
26
+ * Invoke an EndRotate event.
27
+ */
28
+ invokeEndRotateEvent(...args: unknown[]): void;
29
+
30
+ /**
31
+ * Registers a callback on an EndRotate event.
32
+ */
33
+ onEndRotateEvent(cb: EventHandler, priority?: number): vtkSubscription;
34
+ /**
35
+ * Start a Pan event.
36
+ */
37
+ startPan(): void;
38
+
39
+ /**
40
+ * Invoke a StartPan event.
41
+ */
42
+ invokeStartPanEvent(...args: unknown[]): void;
43
+
44
+ /**
45
+ * Registers a callback on a StartPan event.
46
+ */
47
+ onStartPanEvent(cb: EventHandler, priority?: number): vtkSubscription;
48
+
49
+ /**
50
+ * Ends a Pan event.
51
+ */
52
+ endPan(): void;
53
+
54
+ /**
55
+ * Invoke an EndPan event.
56
+ */
57
+ invokeEndPanEvent(...args: unknown[]): void;
58
+
59
+ /**
60
+ * Registers a callback on an EndPan event.
61
+ */
62
+ onEndPanEvent(cb: EventHandler, priority?: number): vtkSubscription;
63
+ /**
64
+ * Start a Spin event.
65
+ */
66
+ startSpin(): void;
67
+
68
+ /**
69
+ * Invoke a StartSpin event.
70
+ */
71
+ invokeStartSpinEvent(...args: unknown[]): void;
72
+
73
+ /**
74
+ * Registers a callback on a StartSpin event.
75
+ */
76
+ onStartSpinEvent(cb: EventHandler, priority?: number): vtkSubscription;
77
+
78
+ /**
79
+ * Ends a Spin event.
80
+ */
81
+ endSpin(): void;
82
+
83
+ /**
84
+ * Invoke an EndSpin event.
85
+ */
86
+ invokeEndSpinEvent(...args: unknown[]): void;
87
+
88
+ /**
89
+ * Registers a callback on an EndSpin event.
90
+ */
91
+ onEndSpinEvent(cb: EventHandler, priority?: number): vtkSubscription;
92
+ /**
93
+ * Start a Dolly event.
94
+ */
95
+ startDolly(): void;
96
+
97
+ /**
98
+ * Invoke a StartDolly event.
99
+ */
100
+ invokeStartDollyEvent(...args: unknown[]): void;
101
+
102
+ /**
103
+ * Registers a callback on a StartDolly event.
104
+ */
105
+ onStartDollyEvent(cb: EventHandler, priority?: number): vtkSubscription;
106
+
107
+ /**
108
+ * Ends a Dolly event.
109
+ */
110
+ endDolly(): void;
111
+
112
+ /**
113
+ * Invoke an EndDolly event.
114
+ */
115
+ invokeEndDollyEvent(...args: unknown[]): void;
116
+
117
+ /**
118
+ * Registers a callback on an EndDolly event.
119
+ */
120
+ onEndDollyEvent(cb: EventHandler, priority?: number): vtkSubscription;
121
+ /**
122
+ * Start a CameraPose event.
123
+ */
124
+ startCameraPose(): void;
125
+
126
+ /**
127
+ * Invoke a StartCameraPose event.
128
+ */
129
+ invokeStartCameraPoseEvent(...args: unknown[]): void;
130
+
131
+ /**
132
+ * Registers a callback on a StartCameraPose event.
133
+ */
134
+ onStartCameraPoseEvent(cb: EventHandler, priority?: number): vtkSubscription;
135
+
136
+ /**
137
+ * Ends a CameraPose event.
138
+ */
139
+ endCameraPose(): void;
140
+
141
+ /**
142
+ * Invoke an EndCameraPose event.
143
+ */
144
+ invokeEndCameraPoseEvent(...args: unknown[]): void;
145
+
146
+ /**
147
+ * Registers a callback on an EndCameraPose event.
148
+ */
149
+ onEndCameraPoseEvent(cb: EventHandler, priority?: number): vtkSubscription;
150
+ /**
151
+ * Start a WindowLevel event.
152
+ */
153
+ startWindowLevel(): void;
154
+
155
+ /**
156
+ * Invoke a StartWindowLevel event.
157
+ */
158
+ invokeStartWindowLevelEvent(...args: unknown[]): void;
159
+
160
+ /**
161
+ * Registers a callback on a StartWindowLevel event.
162
+ */
163
+ onStartWindowLevelEvent(cb: EventHandler, priority?: number): vtkSubscription;
164
+
165
+ /**
166
+ * Ends a WindowLevel event.
167
+ */
168
+ endWindowLevel(): void;
169
+
170
+ /**
171
+ * Invoke an EndWindowLevel event.
172
+ */
173
+ invokeEndWindowLevelEvent(...args: unknown[]): void;
174
+
175
+ /**
176
+ * Registers a callback on an EndWindowLevel event.
177
+ */
178
+ onEndWindowLevelEvent(cb: EventHandler, priority?: number): vtkSubscription;
179
+ /**
180
+ * Start a Slice event.
181
+ */
182
+ startSlice(): void;
183
+
184
+ /**
185
+ * Invoke a StartSlice event.
186
+ */
187
+ invokeStartSliceEvent(...args: unknown[]): void;
188
+
189
+ /**
190
+ * Registers a callback on a StartSlice event.
191
+ */
192
+ onStartSliceEvent(cb: EventHandler, priority?: number): vtkSubscription;
193
+
194
+ /**
195
+ * Ends a Slice event.
196
+ */
197
+ endSlice(): void;
198
+
199
+ /**
200
+ * Invoke an EndSlice event.
201
+ */
202
+ invokeEndSliceEvent(...args: unknown[]): void;
203
+
204
+ /**
205
+ * Registers a callback on an EndSlice event.
206
+ */
207
+ onEndSliceEvent(cb: EventHandler, priority?: number): vtkSubscription;
208
+
209
+ /**
210
+ * Handles a keypress.
211
+ */
212
+ handleKeyPress(callData: unknown): void;
213
+ }
214
+
215
+ export interface IInteractorStyleInitialValues {
216
+ autoAdjustCameraClippingRange?: boolean;
217
+ }
218
+
219
+ export function extend(
220
+ publicAPI: object,
221
+ model: object,
222
+ initialValues?: IInteractorStyleInitialValues
223
+ ): void;
224
+
225
+ export const vtkInteractorStyle: {
226
+ extend: typeof extend;
227
+ };
228
+
229
+ export default vtkInteractorStyle;
@@ -13,7 +13,7 @@ function vtkPointPicker(publicAPI, model) {
13
13
  publicAPI.intersectWithLine = function (p1, p2, tol, mapper) {
14
14
  var tMin = Number.MAX_VALUE;
15
15
 
16
- if (mapper.isA('vtkImageMapper')) {
16
+ if (mapper.isA('vtkImageMapper') || mapper.isA('vtkImageArrayMapper')) {
17
17
  var pickData = mapper.intersectWithLineForPointPicking(p1, p2);
18
18
 
19
19
  if (pickData) {
@@ -341,7 +341,7 @@ function vtkScalarBarActorHelper(publicAPI, model) {
341
341
 
342
342
  return segSize;
343
343
  }; // based on all the settins compute a barSegments array
344
- // containing the segments opf the scalar bar
344
+ // containing the segments of the scalar bar
345
345
  // each segment contains
346
346
  // corners[4][2]
347
347
  // title - e.g. NaN, Above, ticks
@@ -694,7 +694,9 @@ var newScalarBarActorHelper = macro.newInstance(function (publicAPI, model) {
694
694
  model.tmPolyData = vtkPolyData.newInstance();
695
695
  model.tmMapper = vtkMapper.newInstance();
696
696
  model.tmMapper.setInputData(model.tmPolyData);
697
- model.tmTexture = vtkTexture.newInstance();
697
+ model.tmTexture = vtkTexture.newInstance({
698
+ resizable: true
699
+ });
698
700
  model.tmTexture.setInterpolate(false);
699
701
  model.tmActor = vtkActor.newInstance({
700
702
  parentProp: publicAPI
@@ -1,11 +1,16 @@
1
1
  import { vtkAlgorithm } from './../../interfaces';
2
2
 
3
+ /**
4
+ *
5
+ * @param {boolean} [resizable] Must be set to true if texture can be resized at run time (default: false)
6
+ */
3
7
  export interface ITextureInitialValues {
4
8
  repeat?: boolean;
5
9
  interpolate?: boolean;
6
10
  edgeClamp?: boolean;
7
11
  imageLoaded?: boolean;
8
12
  mipLevel?: number;
13
+ resizable?: boolean;
9
14
  }
10
15
 
11
16
  export interface vtkTexture extends vtkAlgorithm {
@@ -261,7 +261,9 @@ var DEFAULT_VALUES = {
261
261
  repeat: false,
262
262
  interpolate: false,
263
263
  edgeClamp: false,
264
- mipLevel: 0
264
+ mipLevel: 0,
265
+ resizable: false // must be set at construction time if the texture can be resizable
266
+
265
267
  }; // ----------------------------------------------------------------------------
266
268
 
267
269
  function extend(publicAPI, model) {
@@ -55,7 +55,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
55
55
 
56
56
  model.openGLCamera = model._openGLRenderer.getViewNodeFor(ren.getActiveCamera()); // is slice set by the camera
57
57
 
58
- if (model.renderable.getSliceAtFocalPoint()) {
58
+ if (model.renderable.isA('vtkImageMapper') && model.renderable.getSliceAtFocalPoint()) {
59
59
  model.renderable.setSliceFromCamera(ren.getActiveCamera());
60
60
  }
61
61
  }
@@ -495,7 +495,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
495
495
  type: 'StartEvent'
496
496
  });
497
497
  model.renderable.update();
498
- model.currentInput = model.renderable.getInputData();
498
+ model.currentInput = model.renderable.getCurrentImage();
499
499
  publicAPI.invokeEvent({
500
500
  type: 'EndEvent'
501
501
  });
@@ -548,6 +548,11 @@ function vtkOpenGLImageMapper(publicAPI, model) {
548
548
  return;
549
549
  }
550
550
 
551
+ var dataType = imgScalars.getDataType();
552
+ var numComp = imgScalars.getNumberOfComponents(); // Re-allocate the texture because vtkOpenGLTexture uses texStorage2D
553
+ // which makes the texture immutable.
554
+
555
+ model.openGLTexture.releaseGraphicsResources(model._openGLRenderWindow);
551
556
  var actorProperty = actor.getProperty(); // set interpolation on the texture based on property setting
552
557
 
553
558
  var iType = actorProperty.getInterpolationType();
@@ -564,8 +569,6 @@ function vtkOpenGLImageMapper(publicAPI, model) {
564
569
  model.pwfTexture.setMagnificationFilter(Filter.LINEAR);
565
570
  }
566
571
 
567
- var dataType = imgScalars.getDataType();
568
- var numComp = imgScalars.getNumberOfComponents();
569
572
  var iComps = actorProperty.getIndependentComponents();
570
573
  var numIComps = iComps ? numComp : 1;
571
574
  var textureHeight = iComps ? 2 * numIComps : 1;
@@ -672,9 +675,12 @@ function vtkOpenGLImageMapper(publicAPI, model) {
672
675
  if (ijkMode !== model.renderable.getSlicingMode()) {
673
676
  // If not IJK slicing, get the IJK slice from the XYZ position/slice
674
677
  slice = model.renderable.getSliceAtPosition(slice);
675
- }
678
+ } // Use sub-Slice number/offset if mapper being used is vtkImageArrayMapper,
679
+ // since this mapper uses a collection of vtkImageData (and not just a single vtkImageData).
680
+
676
681
 
677
- var nSlice = Math.round(slice); // Find sliceOffset
682
+ var nSlice = model.renderable.isA('vtkImageArrayMapper') ? model.renderable.getSubSlice() // get subSlice of the current (possibly multi-frame) image
683
+ : Math.round(slice); // Find sliceOffset
678
684
 
679
685
  var ext = image.getExtent();
680
686
  var sliceOffset;
@@ -889,6 +895,6 @@ var vtkImageMapper = {
889
895
  extend: extend
890
896
  }; // Register ourself to OpenGL backend if imported
891
897
 
892
- registerOverride('vtkImageMapper', newInstance);
898
+ registerOverride('vtkAbstractImageMapper', newInstance);
893
899
 
894
900
  export { vtkImageMapper as default, extend, newInstance };
@@ -1209,7 +1209,9 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
1209
1209
  tcoords = model.renderable.getColorCoordinates();
1210
1210
 
1211
1211
  if (!model.internalColorTexture) {
1212
- model.internalColorTexture = vtkOpenGLTexture.newInstance();
1212
+ model.internalColorTexture = vtkOpenGLTexture.newInstance({
1213
+ resizable: true
1214
+ });
1213
1215
  }
1214
1216
 
1215
1217
  var tex = model.internalColorTexture; // the following 4 lines allow for NPOT textures
@@ -96,6 +96,11 @@ export interface vtkOpenGLRenderWindow extends vtkOpenGLRenderWindowBase {
96
96
  */
97
97
  getFramebufferSize(): Vector2;
98
98
 
99
+ /**
100
+ * Get the webgl canvas.
101
+ */
102
+ getCanvas(): Nullable<HTMLCanvasElement>;
103
+
99
104
  /**
100
105
  * Check if a point is in the viewport.
101
106
  * @param {Number} x The x coordinate.
@@ -269,8 +274,10 @@ export interface vtkOpenGLRenderWindow extends vtkOpenGLRenderWindowBase {
269
274
  * @param {VtkDataTypes} vtktype
270
275
  * @param {Number} numComps
271
276
  * @param {Boolean} useFloat
277
+ * @param {unknown} oglNorm16Ext The WebGL EXT_texture_norm16 extension context
278
+ * @param {Boolean} useHalfFloat
272
279
  */
273
- getDefaultTextureInternalFormat(vtktype: VtkDataTypes, numComps: number, oglNorm16Ext?: unknown): void;
280
+ getDefaultTextureInternalFormat(vtktype: VtkDataTypes, numComps: number, oglNorm16Ext?: unknown, useHalfFloat?: boolean): void;
274
281
 
275
282
  /**
276
283
  *
@@ -541,6 +541,7 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
541
541
 
542
542
  publicAPI.getDefaultTextureInternalFormat = function (vtktype, numComps) {
543
543
  var oglNorm16Ext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
544
+ var useHalfFloat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
544
545
 
545
546
  if (model.webgl2) {
546
547
  switch (vtktype) {
@@ -560,7 +561,7 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
560
561
  return model.context.RGBA8;
561
562
  }
562
563
 
563
- case oglNorm16Ext && VtkDataTypes.UNSIGNED_SHORT:
564
+ case oglNorm16Ext && !useHalfFloat && VtkDataTypes.UNSIGNED_SHORT:
564
565
  switch (numComps) {
565
566
  case 1:
566
567
  return oglNorm16Ext.R16_EXT;
@@ -578,7 +579,7 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
578
579
 
579
580
  // prioritize norm16 over float
580
581
 
581
- case oglNorm16Ext && VtkDataTypes.SHORT:
582
+ case oglNorm16Ext && !useHalfFloat && VtkDataTypes.SHORT:
582
583
  switch (numComps) {
583
584
  case 1:
584
585
  return oglNorm16Ext.R16_SNORM_EXT;
@@ -311,7 +311,7 @@ function vtkOpenGLTexture(publicAPI, model) {
311
311
  publicAPI.getDefaultInternalFormat = function (vtktype, numComps) {
312
312
  var result = 0; // try default next
313
313
 
314
- result = model._openGLRenderWindow.getDefaultTextureInternalFormat(vtktype, numComps, model.oglNorm16Ext);
314
+ result = model._openGLRenderWindow.getDefaultTextureInternalFormat(vtktype, numComps, model.oglNorm16Ext, model.useHalfFloat);
315
315
 
316
316
  if (result) {
317
317
  return result;
@@ -401,10 +401,10 @@ function vtkOpenGLTexture(publicAPI, model) {
401
401
  // prefer norm16 since that is accurate compared to
402
402
  // half float which is not
403
403
 
404
- case model.oglNorm16Ext && VtkDataTypes.SHORT:
404
+ case model.oglNorm16Ext && !model.useHalfFloat && VtkDataTypes.SHORT:
405
405
  return model.context.SHORT;
406
406
 
407
- case model.oglNorm16Ext && VtkDataTypes.UNSIGNED_SHORT:
407
+ case model.oglNorm16Ext && !model.useHalfFloat && VtkDataTypes.UNSIGNED_SHORT:
408
408
  return model.context.UNSIGNED_SHORT;
409
409
  // use half float type
410
410
 
@@ -728,7 +728,7 @@ function vtkOpenGLTexture(publicAPI, model) {
728
728
  publicAPI.create2DFromRaw = function (width, height, numComps, dataType, data) {
729
729
  var flip = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
730
730
  // Now determine the texture parameters using the arguments.
731
- publicAPI.getOpenGLDataType(dataType);
731
+ publicAPI.getOpenGLDataType(dataType, true);
732
732
  publicAPI.getInternalFormat(dataType, numComps);
733
733
  publicAPI.getFormat(dataType, numComps);
734
734
 
@@ -756,7 +756,7 @@ function vtkOpenGLTexture(publicAPI, model) {
756
756
  model.context.pixelStorei(model.context.UNPACK_FLIP_Y_WEBGL, flip);
757
757
  model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
758
758
 
759
- if (model._openGLRenderWindow.getWebgl2()) {
759
+ if (model._openGLRenderWindow.getWebgl2() && !model.resizable) {
760
760
  model.context.texStorage2D(model.target, 1, model.internalFormat, model.width, model.height);
761
761
 
762
762
  if (scaledData[0] != null) {
@@ -830,7 +830,7 @@ function vtkOpenGLTexture(publicAPI, model) {
830
830
 
831
831
  model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
832
832
 
833
- if (model._openGLRenderWindow.getWebgl2()) {
833
+ if (model._openGLRenderWindow.getWebgl2() && !model.resizable) {
834
834
  model.context.texStorage2D(model.target, 6, model.internalFormat, model.width, model.height);
835
835
  } // We get the 6 images
836
836
 
@@ -851,7 +851,7 @@ function vtkOpenGLTexture(publicAPI, model) {
851
851
  tempData = invertedData[6 * j + _i3];
852
852
  }
853
853
 
854
- if (model._openGLRenderWindow.getWebgl2()) {
854
+ if (model._openGLRenderWindow.getWebgl2() && !model.resizable) {
855
855
  if (tempData != null) {
856
856
  model.context.texSubImage2D(model.context.TEXTURE_CUBE_MAP_POSITIVE_X + _i3, j, 0, 0, w, h, model.format, model.openGLDataType, tempData);
857
857
  }
@@ -907,7 +907,7 @@ function vtkOpenGLTexture(publicAPI, model) {
907
907
 
908
908
  model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
909
909
 
910
- if (model._openGLRenderWindow.getWebgl2()) {
910
+ if (model._openGLRenderWindow.getWebgl2() && !model.resizable) {
911
911
  model.context.texStorage2D(model.target, 1, model.internalFormat, model.width, model.height);
912
912
 
913
913
  if (data != null) {
@@ -962,7 +962,7 @@ function vtkOpenGLTexture(publicAPI, model) {
962
962
  ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height);
963
963
  var safeImage = canvas;
964
964
 
965
- if (model._openGLRenderWindow.getWebgl2()) {
965
+ if (model._openGLRenderWindow.getWebgl2() && !model.resizable) {
966
966
  model.context.texStorage2D(model.target, 1, model.internalFormat, model.width, model.height);
967
967
 
968
968
  if (safeImage != null) {
@@ -1148,9 +1148,10 @@ function vtkOpenGLTexture(publicAPI, model) {
1148
1148
  computedScale = _computeScaleOffsets.scale;
1149
1149
 
1150
1150
  model.volumeInfo.dataComputedScale = computedScale;
1151
- model.volumeInfo.dataComputedOffset = computedOffset; // if we can use norm16, there is no need to use halfFloat then
1151
+ model.volumeInfo.dataComputedOffset = computedOffset; // preferSizeOverAccuracy will override norm16 due to bug with norm16 implementation
1152
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1408247
1152
1153
 
1153
- model.useHalfFloat = model.oglNorm16Ext ? false : checkUseHalfFloat(dataType, computedOffset, computedScale, preferSizeOverAccuracy); // since our default is to use half float, in case that we can't use it
1154
+ model.useHalfFloat = checkUseHalfFloat(dataType, computedOffset, computedScale, preferSizeOverAccuracy); // since our default is to use half float, in case that we can't use it
1154
1155
  // we need to use another type
1155
1156
 
1156
1157
  if (!model.useHalfFloat) {
@@ -1159,11 +1160,7 @@ function vtkOpenGLTexture(publicAPI, model) {
1159
1160
 
1160
1161
 
1161
1162
  if (model._openGLRenderWindow.getWebgl2()) {
1162
- if (dataType === VtkDataTypes.FLOAT || model.useHalfFloat && (dataType === VtkDataTypes.SHORT || dataType === VtkDataTypes.UNSIGNED_SHORT)) {
1163
- return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
1164
- }
1165
-
1166
- if (model.oglNorm16Ext && dataType === VtkDataTypes.SHORT) {
1163
+ if (model.oglNorm16Ext && !model.useHalfFloat && dataType === VtkDataTypes.SHORT) {
1167
1164
  for (var _c3 = 0; _c3 < numComps; ++_c3) {
1168
1165
  model.volumeInfo.scale[_c3] = 32767.0;
1169
1166
  }
@@ -1171,7 +1168,7 @@ function vtkOpenGLTexture(publicAPI, model) {
1171
1168
  return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
1172
1169
  }
1173
1170
 
1174
- if (model.oglNorm16Ext && dataType === VtkDataTypes.UNSIGNED_SHORT) {
1171
+ if (model.oglNorm16Ext && !model.useHalfFloat && dataType === VtkDataTypes.UNSIGNED_SHORT) {
1175
1172
  for (var _c4 = 0; _c4 < numComps; ++_c4) {
1176
1173
  model.volumeInfo.scale[_c4] = 65535.0;
1177
1174
  }
@@ -1179,6 +1176,10 @@ function vtkOpenGLTexture(publicAPI, model) {
1179
1176
  return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
1180
1177
  }
1181
1178
 
1179
+ if (dataType === VtkDataTypes.FLOAT || model.useHalfFloat && (dataType === VtkDataTypes.SHORT || dataType === VtkDataTypes.UNSIGNED_SHORT)) {
1180
+ return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
1181
+ }
1182
+
1182
1183
  if (dataType === VtkDataTypes.UNSIGNED_CHAR) {
1183
1184
  for (var _c5 = 0; _c5 < numComps; ++_c5) {
1184
1185
  model.volumeInfo.scale[_c5] = 255.0;
@@ -1341,7 +1342,7 @@ function vtkOpenGLTexture(publicAPI, model) {
1341
1342
 
1342
1343
  model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
1343
1344
 
1344
- if (model._openGLRenderWindow.getWebgl2()) {
1345
+ if (model._openGLRenderWindow.getWebgl2() && !model.resizable) {
1345
1346
  model.context.texStorage2D(model.target, 1, model.internalFormat, model.width, model.height);
1346
1347
 
1347
1348
  if (newArray != null) {