@cornerstonejs/core 2.1.13 → 2.1.15

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.
@@ -1725,10 +1725,14 @@ class StackViewport extends Viewport {
1725
1725
  return true;
1726
1726
  }
1727
1727
  }
1728
- const { imageURI } = options;
1729
- const currentImageURI = imageIdToURI(referencedImageId);
1730
- if (!imageURI || currentImageURI === imageURI) {
1731
- return true;
1728
+ let { imageURI } = options;
1729
+ if (!imageURI) {
1730
+ imageURI = imageIdToURI(currentImageId);
1731
+ }
1732
+ const referencedImageURI = imageIdToURI(referencedImageId);
1733
+ const matches = referencedImageURI === imageURI;
1734
+ if (matches) {
1735
+ return matches;
1732
1736
  }
1733
1737
  const { cameraFocalPoint } = viewRef;
1734
1738
  if (options.asNearbyProjection && cameraFocalPoint) {
@@ -633,7 +633,7 @@ class Viewport {
633
633
  const vtkCamera = this.getVtkActiveCamera();
634
634
  const previousCamera = this.getCamera();
635
635
  const updatedCamera = Object.assign({}, previousCamera, cameraInterface);
636
- const { viewUp, viewPlaneNormal, position, focalPoint, parallelScale, viewAngle, flipHorizontal, flipVertical, clippingRange, rotation, } = cameraInterface;
636
+ const { viewUp, viewPlaneNormal, position, focalPoint, parallelScale, viewAngle, flipHorizontal, flipVertical, clippingRange, } = cameraInterface;
637
637
  if (flipHorizontal !== undefined) {
638
638
  const flipH = (flipHorizontal && !this.flipHorizontal) ||
639
639
  (!flipHorizontal && this.flipHorizontal);
@@ -669,9 +669,6 @@ class Viewport {
669
669
  if (clippingRange !== undefined) {
670
670
  vtkCamera.setClippingRange(clippingRange);
671
671
  }
672
- if (rotation !== undefined) {
673
- this.setViewPresentation({ rotation });
674
- }
675
672
  const prevFocalPoint = previousCamera.focalPoint;
676
673
  const prevViewUp = previousCamera.viewUp;
677
674
  if ((prevFocalPoint && focalPoint) || (prevViewUp && viewUp)) {
@@ -251,6 +251,16 @@ export function createAndCacheLocalImage(imageId, options) {
251
251
  numberOfComponents,
252
252
  scalarData: scalarDataToUse,
253
253
  });
254
+ let minPixelValue = scalarDataToUse[0];
255
+ let maxPixelValue = scalarDataToUse[0];
256
+ for (let i = 1; i < scalarDataToUse.length; i++) {
257
+ if (scalarDataToUse[i] < minPixelValue) {
258
+ minPixelValue = scalarDataToUse[i];
259
+ }
260
+ if (scalarDataToUse[i] > maxPixelValue) {
261
+ maxPixelValue = scalarDataToUse[i];
262
+ }
263
+ }
254
264
  const image = {
255
265
  imageId: imageId,
256
266
  intercept: 0,
@@ -260,8 +270,8 @@ export function createAndCacheLocalImage(imageId, options) {
260
270
  numberOfComponents: imagePixelModule.samplesPerPixel,
261
271
  dataType: targetBuffer?.type,
262
272
  slope: 1,
263
- minPixelValue: 0,
264
- maxPixelValue: Math.pow(2, imagePixelModule.bitsStored) - 1,
273
+ minPixelValue,
274
+ maxPixelValue,
265
275
  rows: imagePixelModule.rows,
266
276
  columns: imagePixelModule.columns,
267
277
  getCanvas: undefined,
@@ -463,6 +463,8 @@ export default class VoxelManager {
463
463
  voxelManager.setCompleteScalarDataArray = (scalarData) => {
464
464
  const sliceSize = dimensions[0] * dimensions[1] * numberOfComponents;
465
465
  const SliceDataConstructor = voxelManager._getConstructor();
466
+ let minValue = Infinity;
467
+ let maxValue = -Infinity;
466
468
  for (let sliceIndex = 0; sliceIndex < dimensions[2]; sliceIndex++) {
467
469
  const { pixelData } = getPixelInfo((sliceIndex * sliceSize) / numberOfComponents);
468
470
  if (pixelData && SliceDataConstructor) {
@@ -471,6 +473,17 @@ export default class VoxelManager {
471
473
  const sliceData = new SliceDataConstructor(sliceSize);
472
474
  sliceData.set(scalarData.subarray(sliceStart, sliceEnd));
473
475
  pixelData.set(sliceData);
476
+ for (let i = 0; i < sliceData.length; i++) {
477
+ const value = sliceData[i];
478
+ minValue = Math.min(minValue, value);
479
+ maxValue = Math.max(maxValue, value);
480
+ }
481
+ const imageId = imageIds[sliceIndex];
482
+ const image = cache.getImage(imageId);
483
+ if (image) {
484
+ image.minPixelValue = minValue;
485
+ image.maxPixelValue = maxValue;
486
+ }
474
487
  }
475
488
  }
476
489
  for (let k = 0; k < dimensions[2]; k++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "2.1.13",
3
+ "version": "2.1.15",
4
4
  "description": "",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "./dist/esm/index.d.ts",
@@ -83,5 +83,5 @@
83
83
  "type": "individual",
84
84
  "url": "https://ohif.org/donate"
85
85
  },
86
- "gitHead": "1fb3bce1233867d9a60456e9af0343003338f8b3"
86
+ "gitHead": "a2b0071a6f6c208800627d358ed2a38b7e916d33"
87
87
  }