@cornerstonejs/adapters 1.57.2 → 1.58.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.
@@ -10161,7 +10161,7 @@ function multiply3x3_mat3(a_3x3, b_3x3, out_3x3) {
10161
10161
  out_3x3[i + 6] = copyA[6] * copyB[i] + copyA[7] * copyB[i + 3] + copyA[8] * copyB[i + 6];
10162
10162
  }
10163
10163
  }
10164
- function multiplyMatrix(a, b, rowA, colA, rowB, colB, out_rowXcol) {
10164
+ function multiplyMatrix(a, b, rowA, colA, rowB, colB, outRowAColB) {
10165
10165
  // we need colA == rowB
10166
10166
  if (colA !== rowB) {
10167
10167
  vtkErrorMacro$p('Number of columns of A must match number of rows of B.');
@@ -10175,10 +10175,10 @@ function multiplyMatrix(a, b, rowA, colA, rowB, colB, out_rowXcol) {
10175
10175
  for (let i = 0; i < rowA; i++) {
10176
10176
  // output col
10177
10177
  for (let j = 0; j < colB; j++) {
10178
- out_rowXcol[i * colB + j] = 0;
10178
+ outRowAColB[i * colB + j] = 0;
10179
10179
  // sum for this point
10180
10180
  for (let k = 0; k < colA; k++) {
10181
- out_rowXcol[i * colB + j] += copyA[i * colA + k] * copyB[j + colB * k];
10181
+ outRowAColB[i * colB + j] += copyA[i * colA + k] * copyB[j + colB * k];
10182
10182
  }
10183
10183
  }
10184
10184
  }
@@ -17236,6 +17236,9 @@ function vtkOpenGLTexture(publicAPI, model) {
17236
17236
  if (!model.internalFormat) {
17237
17237
  vtkDebugMacro$7(`Unable to find suitable internal format for T=${vtktype} NC= ${numComps}`);
17238
17238
  }
17239
+ if ([model.context.R32F, model.context.RG32F, model.context.RGB32F, model.context.RGBA32F].includes(model.internalFormat) && !model.context.getExtension('OES_texture_float_linear')) {
17240
+ vtkWarningMacro$2('Failed to load OES_texture_float_linear. Texture filtering is not available for *32F internal formats.');
17241
+ }
17239
17242
  return model.internalFormat;
17240
17243
  };
17241
17244
 
@@ -21616,7 +21619,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
21616
21619
  if (reBuildC) {
21617
21620
  const cWidth = 1024;
21618
21621
  const cSize = cWidth * textureHeight * 3;
21619
- const cTable = new Uint8Array(cSize);
21622
+ const cTable = new Uint8ClampedArray(cSize);
21620
21623
  if (!model.colorTexture) {
21621
21624
  model.colorTexture = vtkOpenGLTexture$1.newInstance({
21622
21625
  resizable: true
@@ -21679,7 +21682,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
21679
21682
  if (reBuildPwf) {
21680
21683
  const pwfWidth = 1024;
21681
21684
  const pwfSize = pwfWidth * textureHeight;
21682
- const pwfTable = new Uint8Array(pwfSize);
21685
+ const pwfTable = new Uint8ClampedArray(pwfSize);
21683
21686
  if (!model.pwfTexture) {
21684
21687
  model.pwfTexture = vtkOpenGLTexture$1.newInstance({
21685
21688
  resizable: true
@@ -21779,6 +21782,8 @@ function vtkOpenGLImageMapper(publicAPI, model) {
21779
21782
  });
21780
21783
  model.openGLTexture.setOpenGLRenderWindow(model._openGLRenderWindow);
21781
21784
  }
21785
+ // Use norm16 for scalar texture if the extension is available
21786
+ model.openGLTexture.setOglNorm16Ext(model.context.getExtension('EXT_texture_norm16'));
21782
21787
  if (iType === InterpolationType$3.NEAREST) {
21783
21788
  if (new Set([1, 3, 4]).has(numComp) && dataType === VtkDataTypes$3.UNSIGNED_CHAR && !iComps) {
21784
21789
  model.openGLTexture.setGenerateMipmap(true);
@@ -23591,7 +23596,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
23591
23596
  if (model._openGLRenderWindow.getWebgl2() || model.context.getExtension('OES_texture_float') && model.context.getExtension('OES_texture_float_linear')) {
23592
23597
  model.opacityTexture.create2DFromRaw(oWidth, 2 * numIComps, 1, VtkDataTypes$3.FLOAT, ofTable);
23593
23598
  } else {
23594
- const oTable = new Uint8Array(oSize);
23599
+ const oTable = new Uint8ClampedArray(oSize);
23595
23600
  for (let i = 0; i < oSize; ++i) {
23596
23601
  oTable[i] = 255.0 * ofTable[i];
23597
23602
  }
@@ -23614,7 +23619,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
23614
23619
  if (reBuildC) {
23615
23620
  const cWidth = 1024;
23616
23621
  const cSize = cWidth * 2 * numIComps * 3;
23617
- const cTable = new Uint8Array(cSize);
23622
+ const cTable = new Uint8ClampedArray(cSize);
23618
23623
  const tmpTable = new Float32Array(cWidth * 3);
23619
23624
  for (let c = 0; c < numIComps; ++c) {
23620
23625
  const cfun = vprop.getRGBTransferFunction(c);
@@ -29725,7 +29730,7 @@ function vtkOpenGLImageResliceMapper(publicAPI, model) {
29725
29730
  if (reBuildC) {
29726
29731
  const cWidth = 1024;
29727
29732
  const cSize = cWidth * textureHeight * 3;
29728
- const cTable = new Uint8Array(cSize);
29733
+ const cTable = new Uint8ClampedArray(cSize);
29729
29734
  if (!model.colorTexture) {
29730
29735
  model.colorTexture = vtkOpenGLTexture$1.newInstance();
29731
29736
  model.colorTexture.setOpenGLRenderWindow(model._openGLRenderWindow);
@@ -29780,7 +29785,7 @@ function vtkOpenGLImageResliceMapper(publicAPI, model) {
29780
29785
  if (reBuildPwf) {
29781
29786
  const pwfWidth = 1024;
29782
29787
  const pwfSize = pwfWidth * textureHeight;
29783
- const pwfTable = new Uint8Array(pwfSize);
29788
+ const pwfTable = new Uint8ClampedArray(pwfSize);
29784
29789
  if (!model.pwfTexture) {
29785
29790
  model.pwfTexture = vtkOpenGLTexture$1.newInstance();
29786
29791
  model.pwfTexture.setOpenGLRenderWindow(model._openGLRenderWindow);
@@ -30610,7 +30615,7 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
30610
30615
  if (model.colorTextureString !== cfunToString) {
30611
30616
  const cWidth = 1024;
30612
30617
  const cSize = cWidth * textureHeight * 3;
30613
- const cTable = new Uint8Array(cSize);
30618
+ const cTable = new Uint8ClampedArray(cSize);
30614
30619
  let cfun = ppty.getRGBTransferFunction();
30615
30620
  if (cfun) {
30616
30621
  const tmpTable = new Float32Array(cWidth * 3);
@@ -30650,7 +30655,7 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
30650
30655
  if (model.pwfTextureString !== pwfunToString) {
30651
30656
  const pwfWidth = 1024;
30652
30657
  const pwfSize = pwfWidth * textureHeight;
30653
- const pwfTable = new Uint8Array(pwfSize);
30658
+ const pwfTable = new Uint8ClampedArray(pwfSize);
30654
30659
  let pwfun = ppty.getPiecewiseFunction();
30655
30660
  // support case where pwfun is added/removed
30656
30661
  model.pwfTexture.releaseGraphicsResources(model._openGLRenderWindow);
@@ -34409,7 +34414,7 @@ fn main(
34409
34414
  var tcoord: vec4<f32> = vec4<f32>(input.vertexVC.xy, -1, 1);
34410
34415
  var V: vec4<f32> = normalize(mapperUBO.FSQMatrix * tcoord); // vec2<f32>((input.tcoordVS.x - 0.5) * 2, -(input.tcoordVS.y - 0.5) * 2);
34411
34416
  // textureSampleLevel gets rid of some ugly artifacts
34412
- var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0);
34417
+ var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0.0);
34413
34418
  var computedColor: vec4<f32> = vec4<f32>(background.rgb, 1);
34414
34419
 
34415
34420
  //VTK::RenderEncoder::Impl
@@ -35149,7 +35154,7 @@ function vtkWebGPUImageMapper(publicAPI, model) {
35149
35154
  const cfunToString = computeFnToString(actorProperty, actorProperty.getRGBTransferFunction, numIComps);
35150
35155
  if (model.colorTextureString !== cfunToString) {
35151
35156
  model.numRows = numIComps;
35152
- const colorArray = new Uint8Array(model.numRows * 2 * model.rowLength * 4);
35157
+ const colorArray = new Uint8ClampedArray(model.numRows * 2 * model.rowLength * 4);
35153
35158
  let cfun = actorProperty.getRGBTransferFunction();
35154
35159
  if (cfun) {
35155
35160
  const tmpTable = new Float32Array(model.rowLength * 3);
@@ -39478,6 +39483,9 @@ async function setDefaultVolumeVOI(volumeActor, imageVolume, useNativeDataType)
39478
39483
  lower,
39479
39484
  upper
39480
39485
  } = voi;
39486
+ if (lower === 0 && upper === 0) {
39487
+ return;
39488
+ }
39481
39489
  volumeActor.getProperty().getRGBTransferFunction(0).setMappingRange(lower, upper);
39482
39490
  }
39483
39491
  function handlePreScaledVolume(imageVolume, voi) {
@@ -39563,7 +39571,7 @@ async function getVOIFromMinMax(imageVolume, useNativeDataType) {
39563
39571
  }
39564
39572
  };
39565
39573
  let image = cache$1.getImage(imageId);
39566
- if (!image?.referencedImageId) {
39574
+ if (!imageVolume.referencedImageIds?.length) {
39567
39575
  image = await loadAndCacheImage(imageId, options);
39568
39576
  }
39569
39577
  const imageScalarData = image ? image.getPixelData() : _getImageScalarDataFromImageVolume(imageVolume, byteOffset, bytePerPixel, voxelsPerImage);
@@ -40846,7 +40854,7 @@ class Viewport {
40846
40854
  }
40847
40855
  resetCamera(resetPan = true, resetZoom = true, resetToCenter = true, storeAsInitialCamera = true) {
40848
40856
  const renderer = this.getRenderer();
40849
- this.setCamera({
40857
+ this.setCameraNoEvent({
40850
40858
  flipHorizontal: false,
40851
40859
  flipVertical: false
40852
40860
  });