@kitware/vtk.js 33.0.0-beta.4 → 33.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 (41) hide show
  1. package/BREAKING_CHANGES.md +0 -3
  2. package/Common/Core/ScalarsToColors/Constants.js +7 -2
  3. package/Common/Core/ScalarsToColors.js +3 -1
  4. package/Rendering/Core/Actor.d.ts +20 -5
  5. package/Rendering/Core/Actor.js +68 -5
  6. package/Rendering/Core/ColorTransferFunction.js +26 -35
  7. package/Rendering/Core/ImageCPRMapper.d.ts +20 -1
  8. package/Rendering/Core/ImageCPRMapper.js +2 -1
  9. package/Rendering/Core/ImageProperty.d.ts +1 -20
  10. package/Rendering/Core/ImageProperty.js +5 -7
  11. package/Rendering/Core/ImageResliceMapper.d.ts +20 -1
  12. package/Rendering/Core/ImageResliceMapper.js +2 -1
  13. package/Rendering/Core/ImageSlice.d.ts +23 -7
  14. package/Rendering/Core/ImageSlice.js +68 -9
  15. package/Rendering/Core/Mapper.js +8 -16
  16. package/Rendering/Core/Prop3D.d.ts +2 -39
  17. package/Rendering/Core/Prop3D.js +2 -81
  18. package/Rendering/Core/ScalarBarActor.js +4 -2
  19. package/Rendering/Core/Volume.d.ts +20 -5
  20. package/Rendering/Core/Volume.js +70 -2
  21. package/Rendering/Core/VolumeMapper/Constants.d.ts +7 -0
  22. package/Rendering/Core/VolumeMapper/Constants.js +8 -2
  23. package/Rendering/Core/VolumeMapper.d.ts +173 -16
  24. package/Rendering/Core/VolumeMapper.js +51 -16
  25. package/Rendering/Core/VolumeProperty/Constants.d.ts +3 -12
  26. package/Rendering/Core/VolumeProperty/Constants.js +4 -11
  27. package/Rendering/Core/VolumeProperty.d.ts +5 -140
  28. package/Rendering/Core/VolumeProperty.js +7 -54
  29. package/Rendering/OpenGL/ImageCPRMapper.js +21 -30
  30. package/Rendering/OpenGL/ImageMapper.js +27 -27
  31. package/Rendering/OpenGL/ImageResliceMapper.js +183 -271
  32. package/Rendering/OpenGL/PolyDataMapper.js +8 -1
  33. package/Rendering/OpenGL/RenderWindow/resourceSharingHelper.d.ts +3 -3
  34. package/Rendering/OpenGL/RenderWindow/resourceSharingHelper.js +5 -8
  35. package/Rendering/OpenGL/VolumeMapper.js +784 -722
  36. package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
  37. package/Rendering/WebGPU/VolumePassFSQ.js +2 -2
  38. package/index.d.ts +0 -1
  39. package/macros2.js +1 -1
  40. package/package.json +1 -1
  41. package/Interaction/Manipulators/KeyboardCameraManipulator.d.ts +0 -113
@@ -1,14 +1,11 @@
1
1
  import { m as macro } from '../../macros2.js';
2
- import { E as clampValue, K as floor } from '../../Common/Core/Math/index.js';
3
2
  import vtkColorTransferFunction from './ColorTransferFunction.js';
4
3
  import vtkPiecewiseFunction from '../../Common/DataModel/PiecewiseFunction.js';
5
4
  import Constants from './VolumeProperty/Constants.js';
6
5
 
7
6
  const {
8
7
  InterpolationType,
9
- OpacityMode,
10
- FilterMode,
11
- ColorMixPreset
8
+ OpacityMode
12
9
  } = Constants;
13
10
  const {
14
11
  vtkErrorMacro
@@ -22,9 +19,6 @@ const VTK_MAX_VRCOMP = 4;
22
19
  function vtkVolumeProperty(publicAPI, model) {
23
20
  // Set our className
24
21
  model.classHierarchy.push('vtkVolumeProperty');
25
- const superClass = {
26
- ...publicAPI
27
- };
28
22
  publicAPI.getMTime = () => {
29
23
  let mTime = model.mtime;
30
24
  let time;
@@ -203,33 +197,14 @@ function vtkVolumeProperty(publicAPI, model) {
203
197
  const cap = macro.capitalize(val);
204
198
  publicAPI[`get${cap}`] = index => model.componentData[index][`${val}`];
205
199
  });
206
- publicAPI.setAverageIPScalarRange = (min, max) => {
207
- console.warn('setAverageIPScalarRange is deprecated use setIpScalarRange');
208
- publicAPI.setIpScalarRange(min, max);
209
- };
210
- publicAPI.getFilterModeAsString = () => macro.enumToString(FilterMode, model.filterMode);
211
- publicAPI.setFilterModeToOff = () => {
212
- publicAPI.setFilterMode(FilterMode.OFF);
213
- };
214
- publicAPI.setFilterModeToNormalized = () => {
215
- publicAPI.setFilterMode(FilterMode.NORMALIZED);
216
- };
217
- publicAPI.setFilterModeToRaw = () => {
218
- publicAPI.setFilterMode(FilterMode.RAW);
219
- };
220
- publicAPI.setGlobalIlluminationReach = gl => superClass.setGlobalIlluminationReach(clampValue(gl, 0.0, 1.0));
221
- publicAPI.setVolumetricScatteringBlending = vsb => superClass.setVolumetricScatteringBlending(clampValue(vsb, 0.0, 1.0));
222
- publicAPI.setAnisotropy = at => superClass.setAnisotropy(clampValue(at, -0.99, 0.99));
223
- publicAPI.setLAOKernelSize = ks => superClass.setLAOKernelSize(floor(clampValue(ks, 1, 32)));
224
- publicAPI.setLAOKernelRadius = kr => superClass.setLAOKernelRadius(kr >= 1 ? kr : 1);
225
200
  }
226
201
 
227
202
  // ----------------------------------------------------------------------------
228
203
  // Object factory
229
204
  // ----------------------------------------------------------------------------
230
205
 
231
- const defaultValues = initialValues => ({
232
- colorMixPreset: ColorMixPreset.DEFAULT,
206
+ const DEFAULT_VALUES = {
207
+ colorMixPreset: null,
233
208
  independentComponents: true,
234
209
  interpolationType: InterpolationType.FAST_LINEAR,
235
210
  shade: false,
@@ -239,31 +214,14 @@ const defaultValues = initialValues => ({
239
214
  specularPower: 10.0,
240
215
  useLabelOutline: false,
241
216
  labelOutlineThickness: [1],
242
- labelOutlineOpacity: 1.0,
243
- // Properties moved from volume mapper
244
- ipScalarRange: [-1000000.0, 1000000.0],
245
- filterMode: FilterMode.OFF,
246
- // ignored by WebGL so no behavior change
247
- preferSizeOverAccuracy: false,
248
- // Whether to use halfFloat representation of float, when it is inaccurate
249
- computeNormalFromOpacity: false,
250
- // volume shadow parameters
251
- volumetricScatteringBlending: 0.0,
252
- globalIlluminationReach: 0.0,
253
- anisotropy: 0.0,
254
- // local ambient occlusion
255
- localAmbientOcclusion: false,
256
- LAOKernelSize: 15,
257
- LAOKernelRadius: 7,
258
- updatedExtents: [],
259
- ...initialValues
260
- });
217
+ labelOutlineOpacity: 1.0
218
+ };
261
219
 
262
220
  // ----------------------------------------------------------------------------
263
221
 
264
222
  function extend(publicAPI, model) {
265
223
  let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
266
- Object.assign(model, defaultValues(initialValues));
224
+ Object.assign(model, DEFAULT_VALUES, initialValues);
267
225
 
268
226
  // Build VTK API
269
227
  macro.obj(publicAPI, model);
@@ -287,12 +245,7 @@ function extend(publicAPI, model) {
287
245
  });
288
246
  }
289
247
  }
290
- macro.setGet(publicAPI, model, ['colorMixPreset', 'independentComponents', 'interpolationType', 'shade', 'ambient', 'diffuse', 'specular', 'specularPower', 'useLabelOutline', 'labelOutlineOpacity',
291
- // Properties moved from volume mapper
292
- 'filterMode', 'preferSizeOverAccuracy', 'computeNormalFromOpacity', 'volumetricScatteringBlending', 'globalIlluminationReach', 'anisotropy', 'localAmbientOcclusion', 'LAOKernelSize', 'LAOKernelRadius', 'updatedExtents']);
293
-
294
- // Property moved from volume mapper
295
- macro.setGetArray(publicAPI, model, ['ipScalarRange'], 2);
248
+ macro.setGet(publicAPI, model, ['colorMixPreset', 'independentComponents', 'interpolationType', 'shade', 'ambient', 'diffuse', 'specular', 'specularPower', 'useLabelOutline', 'labelOutlineOpacity']);
296
249
  macro.setGetArray(publicAPI, model, ['labelOutlineThickness']);
297
250
 
298
251
  // Object methods
@@ -11,7 +11,7 @@ import vtkOpenGLTexture from './Texture.js';
11
11
  import vtkReplacementShaderMapper from './ReplacementShaderMapper.js';
12
12
  import vtkShaderProgram from './ShaderProgram.js';
13
13
  import vtkViewNode from '../SceneGraph/ViewNode.js';
14
- import { getImageDataHash, getTransferFunctionsHash } from './RenderWindow/resourceSharingHelper.js';
14
+ import { getImageDataHash, getTransferFunctionHash } from './RenderWindow/resourceSharingHelper.js';
15
15
  import { v as vtkPolyDataVS } from './glsl/vtkPolyDataVS.glsl.js';
16
16
  import { v as vtkPolyDataFS } from './glsl/vtkPolyDataFS.glsl.js';
17
17
  import { registerOverride } from './ViewNodeFactory.js';
@@ -147,7 +147,6 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
147
147
  publicAPI.buildBufferObjects = (ren, actor) => {
148
148
  const image = model.currentImageDataInput;
149
149
  const centerline = model.currentCenterlineInput;
150
- const property = actor.getProperty();
151
150
 
152
151
  // Rebuild the volumeTexture if the data has changed
153
152
  const scalars = image?.getPointData()?.getScalars();
@@ -157,7 +156,7 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
157
156
  const cachedScalarsEntry = model._openGLRenderWindow.getGraphicsResourceForObject(scalars);
158
157
  const volumeTextureHash = getImageDataHash(image, scalars);
159
158
  const reBuildTex = !cachedScalarsEntry?.oglObject?.getHandle() || cachedScalarsEntry?.hash !== volumeTextureHash;
160
- const updatedExtents = property.getUpdatedExtents();
159
+ const updatedExtents = model.renderable.getUpdatedExtents();
161
160
  const hasUpdatedExtents = !!updatedExtents.length;
162
161
  if (reBuildTex) {
163
162
  model.volumeTexture = vtkOpenGLTexture.newInstance();
@@ -180,7 +179,7 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
180
179
  if (hasUpdatedExtents) {
181
180
  // If hasUpdatedExtents, then the texture is partially updated.
182
181
  // clear the array to acknowledge the update.
183
- property.setUpdatedExtents([]);
182
+ model.renderable.setUpdatedExtents([]);
184
183
  const dims = image.getDimensions();
185
184
  model.volumeTexture.create3DFilterableFromDataArray(dims[0], dims[1], dims[2], scalars, false, updatedExtents);
186
185
  }
@@ -191,13 +190,9 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
191
190
  const iComps = ppty.getIndependentComponents();
192
191
  const numIComps = iComps ? numComp : 1;
193
192
  const textureHeight = iComps ? 2 * numIComps : 1;
194
- const colorTransferFunctions = [];
195
- for (let component = 0; component < numIComps; ++component) {
196
- colorTransferFunctions.push(ppty.getRGBTransferFunction(component));
197
- }
198
- const colorTextureHash = getTransferFunctionsHash(colorTransferFunctions, iComps, numIComps);
199
- const firstColorTransferFunc = ppty.getRGBTransferFunction();
200
- const cachedColorEntry = model._openGLRenderWindow.getGraphicsResourceForObject(firstColorTransferFunc);
193
+ const colorTransferFunc = ppty.getRGBTransferFunction();
194
+ const colorTextureHash = getTransferFunctionHash(colorTransferFunc, iComps, numIComps);
195
+ const cachedColorEntry = model._openGLRenderWindow.getGraphicsResourceForObject(colorTransferFunc);
201
196
  const reBuildColorTexture = !cachedColorEntry?.oglObject?.getHandle() || cachedColorEntry?.hash !== colorTextureHash;
202
197
  if (reBuildColorTexture) {
203
198
  let cWidth = model.renderable.getColorTextureWidth();
@@ -208,7 +203,7 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
208
203
  const cTable = new Uint8ClampedArray(cSize);
209
204
  model.colorTexture = vtkOpenGLTexture.newInstance();
210
205
  model.colorTexture.setOpenGLRenderWindow(model._openGLRenderWindow);
211
- if (firstColorTransferFunc) {
206
+ if (colorTransferFunc) {
212
207
  const tmpTable = new Float32Array(cWidth * 3);
213
208
  for (let c = 0; c < numIComps; c++) {
214
209
  const cfun = ppty.getRGBTransferFunction(c);
@@ -236,13 +231,13 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
236
231
  model.colorTexture.resetFormatAndType();
237
232
  model.colorTexture.create2DFromRaw(cWidth, 1, 3, VtkDataTypes.UNSIGNED_CHAR, cTable);
238
233
  }
239
- if (firstColorTransferFunc) {
240
- model._openGLRenderWindow.setGraphicsResourceForObject(firstColorTransferFunc, model.colorTexture, colorTextureHash);
241
- if (firstColorTransferFunc !== model._colorTransferFunc) {
242
- model._openGLRenderWindow.registerGraphicsResourceUser(firstColorTransferFunc, publicAPI);
234
+ if (colorTransferFunc) {
235
+ model._openGLRenderWindow.setGraphicsResourceForObject(colorTransferFunc, model.colorTexture, colorTextureHash);
236
+ if (colorTransferFunc !== model._colorTransferFunc) {
237
+ model._openGLRenderWindow.registerGraphicsResourceUser(colorTransferFunc, publicAPI);
243
238
  model._openGLRenderWindow.unregisterGraphicsResourceUser(model._colorTransferFunc, publicAPI);
244
239
  }
245
- model._colorTransferFunc = firstColorTransferFunc;
240
+ model._colorTransferFunc = colorTransferFunc;
246
241
  }
247
242
  } else {
248
243
  model.colorTexture = cachedColorEntry.oglObject;
@@ -251,13 +246,9 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
251
246
  // Build piecewise function buffer. This buffer is used either
252
247
  // for component weighting or opacity, depending on whether we're
253
248
  // rendering components independently or not.
254
- const opacityFunctions = [];
255
- for (let component = 0; component < numIComps; ++component) {
256
- opacityFunctions.push(ppty.getPiecewiseFunction(component));
257
- }
258
- const pwfTextureHash = getTransferFunctionsHash(opacityFunctions, iComps, numIComps);
259
- const firstPwFunc = ppty.getPiecewiseFunction();
260
- const cachedPwfEntry = model._openGLRenderWindow.getGraphicsResourceForObject(firstPwFunc);
249
+ const pwFunc = ppty.getPiecewiseFunction();
250
+ const pwfTextureHash = getTransferFunctionHash(pwFunc, iComps, numIComps);
251
+ const cachedPwfEntry = model._openGLRenderWindow.getGraphicsResourceForObject(pwFunc);
261
252
  const reBuildPwf = !cachedPwfEntry?.oglObject?.getHandle() || cachedPwfEntry?.hash !== pwfTextureHash;
262
253
  if (reBuildPwf) {
263
254
  let pwfWidth = model.renderable.getOpacityTextureWidth();
@@ -268,7 +259,7 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
268
259
  const pwfTable = new Uint8ClampedArray(pwfSize);
269
260
  model.pwfTexture = vtkOpenGLTexture.newInstance();
270
261
  model.pwfTexture.setOpenGLRenderWindow(model._openGLRenderWindow);
271
- if (firstPwFunc) {
262
+ if (pwFunc) {
272
263
  const pwfFloatTable = new Float32Array(pwfSize);
273
264
  const tmpTable = new Float32Array(pwfWidth);
274
265
  for (let c = 0; c < numIComps; ++c) {
@@ -300,13 +291,13 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
300
291
  model.pwfTexture.resetFormatAndType();
301
292
  model.pwfTexture.create2DFromRaw(pwfWidth, 1, 1, VtkDataTypes.UNSIGNED_CHAR, pwfTable);
302
293
  }
303
- if (firstPwFunc) {
304
- model._openGLRenderWindow.setGraphicsResourceForObject(firstPwFunc, model.pwfTexture, pwfTextureHash);
305
- if (firstPwFunc !== model._pwFunc) {
306
- model._openGLRenderWindow.registerGraphicsResourceUser(firstPwFunc, publicAPI);
294
+ if (pwFunc) {
295
+ model._openGLRenderWindow.setGraphicsResourceForObject(pwFunc, model.pwfTexture, pwfTextureHash);
296
+ if (pwFunc !== model._pwFunc) {
297
+ model._openGLRenderWindow.registerGraphicsResourceUser(pwFunc, publicAPI);
307
298
  model._openGLRenderWindow.unregisterGraphicsResourceUser(model._pwFunc, publicAPI);
308
299
  }
309
- model._pwFunc = firstPwFunc;
300
+ model._pwFunc = pwFunc;
310
301
  }
311
302
  } else {
312
303
  model.pwfTexture = cachedPwfEntry.oglObject;
@@ -4,13 +4,14 @@ import { n as newInstance$1, e as setGet, o as obj, r as vtkErrorMacro$1, h as c
4
4
  import vtkDataArray from '../../Common/Core/DataArray.js';
5
5
  import { VtkDataTypes } from '../../Common/Core/DataArray/Constants.js';
6
6
  import vtkHelper from './Helper.js';
7
+ import { u as uninitializeBounds } from '../../Common/Core/Math/index.js';
7
8
  import vtkOpenGLTexture from './Texture.js';
8
9
  import vtkShaderProgram from './ShaderProgram.js';
9
10
  import vtkViewNode from '../SceneGraph/ViewNode.js';
10
11
  import { Representation } from '../Core/Property/Constants.js';
11
12
  import { Filter, Wrap } from './Texture/Constants.js';
12
13
  import { InterpolationType } from '../Core/ImageProperty/Constants.js';
13
- import { getTransferFunctionsHash } from './RenderWindow/resourceSharingHelper.js';
14
+ import { getTransferFunctionHash } from './RenderWindow/resourceSharingHelper.js';
14
15
  import { v as vtkPolyDataVS } from './glsl/vtkPolyDataVS.glsl.js';
15
16
  import { v as vtkPolyDataFS } from './glsl/vtkPolyDataFS.glsl.js';
16
17
  import vtkReplacementShaderMapper from './ReplacementShaderMapper.js';
@@ -554,6 +555,13 @@ function vtkOpenGLImageMapper(publicAPI, model) {
554
555
  publicAPI.renderPieceDraw(ren, actor);
555
556
  publicAPI.renderPieceFinish(ren, actor);
556
557
  };
558
+ publicAPI.computeBounds = (ren, actor) => {
559
+ if (!publicAPI.getInput()) {
560
+ uninitializeBounds(model.bounds);
561
+ return;
562
+ }
563
+ model.bounds = publicAPI.getInput().getBounds();
564
+ };
557
565
  publicAPI.updateBufferObjects = (ren, actor) => {
558
566
  // Rebuild buffers if needed
559
567
  if (publicAPI.getNeedToRebuildBufferObjects(ren, actor)) {
@@ -577,13 +585,9 @@ function vtkOpenGLImageMapper(publicAPI, model) {
577
585
  const iComps = actorProperty.getIndependentComponents();
578
586
  const numIComps = iComps ? numComp : 1;
579
587
  const textureHeight = iComps ? 2 * numIComps : 1;
580
- const colorTransferFunctions = [];
581
- for (let component = 0; component < numIComps; ++component) {
582
- colorTransferFunctions.push(actorProperty.getRGBTransferFunction(component));
583
- }
584
- const cfunToString = getTransferFunctionsHash(colorTransferFunctions, iComps, numIComps);
585
- const firstColorTransferFunc = actorProperty.getRGBTransferFunction();
586
- const cTex = model._openGLRenderWindow.getGraphicsResourceForObject(firstColorTransferFunc);
588
+ const colorTransferFunc = actorProperty.getRGBTransferFunction();
589
+ const cfunToString = getTransferFunctionHash(colorTransferFunc, iComps, numIComps);
590
+ const cTex = model._openGLRenderWindow.getGraphicsResourceForObject(colorTransferFunc);
587
591
  const reBuildC = !cTex?.oglObject?.getHandle() || cTex?.hash !== cfunToString;
588
592
  if (reBuildC) {
589
593
  model.colorTexture = vtkOpenGLTexture.newInstance({
@@ -604,7 +608,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
604
608
  model.colorTexture.setMinificationFilter(Filter.LINEAR);
605
609
  model.colorTexture.setMagnificationFilter(Filter.LINEAR);
606
610
  }
607
- if (firstColorTransferFunc) {
611
+ if (colorTransferFunc) {
608
612
  const tmpTable = new Float32Array(cWidth * 3);
609
613
  for (let c = 0; c < numIComps; c++) {
610
614
  const cfun = actorProperty.getRGBTransferFunction(c);
@@ -631,13 +635,13 @@ function vtkOpenGLImageMapper(publicAPI, model) {
631
635
  }
632
636
  model.colorTexture.create2DFromRaw(cWidth, 1, 3, VtkDataTypes.UNSIGNED_CHAR, cTable);
633
637
  }
634
- if (firstColorTransferFunc) {
635
- model._openGLRenderWindow.setGraphicsResourceForObject(firstColorTransferFunc, model.colorTexture, cfunToString);
636
- if (firstColorTransferFunc !== model._colorTransferFunc) {
637
- model._openGLRenderWindow.registerGraphicsResourceUser(firstColorTransferFunc, publicAPI);
638
+ if (colorTransferFunc) {
639
+ model._openGLRenderWindow.setGraphicsResourceForObject(colorTransferFunc, model.colorTexture, cfunToString);
640
+ if (colorTransferFunc !== model._colorTransferFunc) {
641
+ model._openGLRenderWindow.registerGraphicsResourceUser(colorTransferFunc, publicAPI);
638
642
  model._openGLRenderWindow.unregisterGraphicsResourceUser(model._colorTransferFunc, publicAPI);
639
643
  }
640
- model._colorTransferFunc = firstColorTransferFunc;
644
+ model._colorTransferFunc = colorTransferFunc;
641
645
  }
642
646
  } else {
643
647
  model.colorTexture = cTex.oglObject;
@@ -646,13 +650,9 @@ function vtkOpenGLImageMapper(publicAPI, model) {
646
650
  // Build piecewise function buffer. This buffer is used either
647
651
  // for component weighting or opacity, depending on whether we're
648
652
  // rendering components independently or not.
649
- const opacityFunctions = [];
650
- for (let component = 0; component < numIComps; ++component) {
651
- opacityFunctions.push(actorProperty.getPiecewiseFunction(component));
652
- }
653
- const pwfunToString = getTransferFunctionsHash(opacityFunctions, iComps, numIComps);
654
- const firstPwFunc = actorProperty.getPiecewiseFunction();
655
- const pwfTex = model._openGLRenderWindow.getGraphicsResourceForObject(firstPwFunc);
653
+ const pwFunc = actorProperty.getPiecewiseFunction();
654
+ const pwfunToString = getTransferFunctionHash(pwFunc, iComps, numIComps);
655
+ const pwfTex = model._openGLRenderWindow.getGraphicsResourceForObject(pwFunc);
656
656
  // rebuild opacity tfun?
657
657
  const reBuildPwf = !pwfTex?.oglObject?.getHandle() || pwfTex?.hash !== pwfunToString;
658
658
  if (reBuildPwf) {
@@ -674,7 +674,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
674
674
  model.pwfTexture.setMinificationFilter(Filter.LINEAR);
675
675
  model.pwfTexture.setMagnificationFilter(Filter.LINEAR);
676
676
  }
677
- if (firstPwFunc) {
677
+ if (pwFunc) {
678
678
  const pwfFloatTable = new Float32Array(pwfSize);
679
679
  const tmpTable = new Float32Array(pwfWidth);
680
680
  for (let c = 0; c < numIComps; ++c) {
@@ -705,13 +705,13 @@ function vtkOpenGLImageMapper(publicAPI, model) {
705
705
  pwfTable.fill(255.0);
706
706
  model.pwfTexture.create2DFromRaw(pwfWidth, 1, 1, VtkDataTypes.UNSIGNED_CHAR, pwfTable);
707
707
  }
708
- if (firstPwFunc) {
709
- model._openGLRenderWindow.setGraphicsResourceForObject(firstPwFunc, model.pwfTexture, pwfunToString);
710
- if (firstPwFunc !== model._pwFunc) {
711
- model._openGLRenderWindow.registerGraphicsResourceUser(firstPwFunc, publicAPI);
708
+ if (pwFunc) {
709
+ model._openGLRenderWindow.setGraphicsResourceForObject(pwFunc, model.pwfTexture, pwfunToString);
710
+ if (pwFunc !== model._pwFunc) {
711
+ model._openGLRenderWindow.registerGraphicsResourceUser(pwFunc, publicAPI);
712
712
  model._openGLRenderWindow.unregisterGraphicsResourceUser(model._pwFunc, publicAPI);
713
713
  }
714
- model._pwFunc = firstPwFunc;
714
+ model._pwFunc = pwFunc;
715
715
  }
716
716
  } else {
717
717
  model.pwfTexture = pwfTex.oglObject;