@cornerstonejs/core 3.32.4 → 3.32.6

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.
@@ -43,7 +43,8 @@ declare abstract class BaseVolumeViewport extends Viewport {
43
43
  isReferenceViewable(viewRef: ViewReference, options?: ReferenceCompatibleOptions): boolean;
44
44
  scroll(delta?: number): void;
45
45
  abstract isInAcquisitionPlane(): boolean;
46
- setViewPlane(planeRestriction: PlaneRestriction, viewPlaneNormal: any): void;
46
+ setBestOrentation(inPlaneVector1: any, inPlaneVector2: any): void;
47
+ setViewPlane(planeRestriction: PlaneRestriction): void;
47
48
  setViewReference(viewRef: ViewReference): void;
48
49
  private setThreshold;
49
50
  setProperties({ voiRange, VOILUTFunction, invert, colormap, preset, interpolationType, slabThickness, }?: VolumeViewportProperties, volumeId?: string, suppressEvents?: boolean): void;
@@ -30,6 +30,7 @@ import uuidv4 from '../utilities/uuidv4';
30
30
  import * as metaData from '../metaData';
31
31
  import { getCameraVectors } from './helpers/getCameraVectors';
32
32
  import { isContextPoolRenderingEngine } from './helpers/isContextPoolRenderingEngine';
33
+ import mprCameraValues from '../constants/mprCameraValues';
33
34
  class BaseVolumeViewport extends Viewport {
34
35
  constructor(props) {
35
36
  super(props);
@@ -605,37 +606,39 @@ class BaseVolumeViewport extends Viewport {
605
606
  });
606
607
  this.render();
607
608
  }
608
- setViewPlane(planeRestriction, viewPlaneNormal) {
609
- const { point, inPlaneVector1, inPlaneVector2, FrameOfReferenceUID } = planeRestriction;
610
- if (!inPlaneVector1) {
611
- return this.setViewReference({
612
- FrameOfReferenceUID,
613
- cameraFocalPoint: point,
614
- });
609
+ setBestOrentation(inPlaneVector1, inPlaneVector2) {
610
+ if (!inPlaneVector1 && !inPlaneVector2) {
611
+ return;
615
612
  }
616
- if (inPlaneVector2) {
617
- const planeNormal = (vec3.cross(vec3.create(), inPlaneVector1, inPlaneVector2));
618
- vec3.normalize(planeNormal, planeNormal);
619
- return this.setViewReference({
620
- FrameOfReferenceUID,
621
- cameraFocalPoint: point,
622
- viewPlaneNormal: planeNormal,
623
- });
613
+ const { viewPlaneNormal } = this.getCamera();
614
+ if (isCompatible(viewPlaneNormal, inPlaneVector2) &&
615
+ isCompatible(viewPlaneNormal, inPlaneVector1)) {
616
+ return;
624
617
  }
625
- const dotNormal = vec3.dot(viewPlaneNormal, inPlaneVector1);
626
- if (isEqual(dotNormal, 0)) {
627
- return this.setViewReference({
628
- FrameOfReferenceUID,
629
- viewPlaneNormal,
630
- cameraFocalPoint: point,
631
- });
618
+ const acquisition = this._getAcquisitionPlaneOrientation();
619
+ if (isCompatible(acquisition.viewPlaneNormal, inPlaneVector2) &&
620
+ isCompatible(acquisition.viewPlaneNormal, inPlaneVector1)) {
621
+ this.setOrientation(acquisition);
622
+ return;
632
623
  }
633
- const planeNormal = (vec3.cross(vec3.create(), viewPlaneNormal, inPlaneVector1));
624
+ for (const orientation of (Object.values(mprCameraValues))) {
625
+ if (isCompatible(orientation.viewPlaneNormal, inPlaneVector2) &&
626
+ isCompatible(orientation.viewPlaneNormal, inPlaneVector1)) {
627
+ this.setOrientation(orientation);
628
+ return;
629
+ }
630
+ }
631
+ const planeNormal = (vec3.cross(vec3.create(), inPlaneVector2 || acquisition.viewPlaneNormal, inPlaneVector1));
634
632
  vec3.normalize(planeNormal, planeNormal);
635
- return this.setViewReference({
633
+ this.setOrientation({ viewPlaneNormal: planeNormal });
634
+ }
635
+ setViewPlane(planeRestriction) {
636
+ const { point, inPlaneVector1, inPlaneVector2, FrameOfReferenceUID } = planeRestriction;
637
+ this.setBestOrentation(inPlaneVector1, inPlaneVector2);
638
+ this.setViewReference({
636
639
  FrameOfReferenceUID,
637
- viewPlaneNormal: planeNormal,
638
640
  cameraFocalPoint: point,
641
+ viewPlaneNormal: this.getCamera().viewPlaneNormal,
639
642
  });
640
643
  }
641
644
  setViewReference(viewRef) {
@@ -645,10 +648,10 @@ class BaseVolumeViewport extends Viewport {
645
648
  const volumeId = this.getVolumeId();
646
649
  const { FrameOfReferenceUID: refFrameOfReference, cameraFocalPoint, referencedImageId, planeRestriction, viewPlaneNormal: refViewPlaneNormal, viewUp, } = viewRef;
647
650
  let { sliceIndex } = viewRef;
648
- const { focalPoint, viewPlaneNormal, position } = this.getCamera();
649
- if (planeRestriction?.inPlaneVector1 && !refViewPlaneNormal) {
650
- return this.setViewPlane(planeRestriction, viewPlaneNormal);
651
+ if (planeRestriction && !refViewPlaneNormal) {
652
+ return this.setViewPlane(planeRestriction);
651
653
  }
654
+ const { focalPoint, viewPlaneNormal, position } = this.getCamera();
652
655
  const isNegativeNormal = isEqualNegative(viewPlaneNormal, refViewPlaneNormal);
653
656
  const isSameNormal = isEqual(viewPlaneNormal, refViewPlaneNormal);
654
657
  if (typeof sliceIndex === 'number' &&
@@ -1137,4 +1140,7 @@ class BaseVolumeViewport extends Viewport {
1137
1140
  }
1138
1141
  }
1139
1142
  }
1143
+ function isCompatible(viewPlaneNormal, vector) {
1144
+ return !vector || isEqual(vec3.dot(viewPlaneNormal, vector), 0);
1145
+ }
1140
1146
  export default BaseVolumeViewport;
@@ -72,7 +72,7 @@ export function createAndCacheDerivedVolume(referencedVolumeId, options) {
72
72
  const { metadata, dimensions, spacing, origin, direction } = referencedVolume;
73
73
  const referencedImageIds = referencedVolume.isDynamicVolume()
74
74
  ? referencedVolume.getCurrentDimensionGroupImageIds()
75
- : referencedVolume.imageIds ?? [];
75
+ : (referencedVolume.imageIds ?? []);
76
76
  const derivedImages = createAndCacheDerivedImages(referencedImageIds, {
77
77
  targetBuffer: options.targetBuffer,
78
78
  voxelRepresentation,
@@ -150,7 +150,7 @@ export function createLocalVolume(volumeId, options = {}) {
150
150
  const sliceLength = dimensions[0] * dimensions[1];
151
151
  const dataType = scalarData
152
152
  ? scalarData.constructor.name
153
- : targetBuffer?.type ?? 'Float32Array';
153
+ : (targetBuffer?.type ?? 'Float32Array');
154
154
  const totalNumberOfVoxels = sliceLength * dimensions[2];
155
155
  let byteLength;
156
156
  switch (dataType) {
@@ -1,6 +1,6 @@
1
1
  import type { Point3 } from './Point3';
2
2
  interface OrientationVectors {
3
3
  viewPlaneNormal: Point3;
4
- viewUp: Point3;
4
+ viewUp?: Point3;
5
5
  }
6
6
  export type { OrientationVectors as default };
@@ -1 +1 @@
1
- export declare const version = "3.32.4";
1
+ export declare const version = "3.32.6";
@@ -1 +1 @@
1
- export const version = '3.32.4';
1
+ export const version = '3.32.6';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "3.32.4",
3
+ "version": "3.32.6",
4
4
  "description": "Cornerstone3D Core",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "./dist/esm/index.d.ts",
@@ -76,8 +76,8 @@
76
76
  "build": "yarn run build:esm",
77
77
  "build:all": "yarn run build:esm",
78
78
  "dev": "tsc --project ./tsconfig.json --watch",
79
- "format-check": "npx eslint ./src --quiet",
80
79
  "api-check": "api-extractor --debug run ",
80
+ "lint": "oxlint .",
81
81
  "prepublishOnly": "yarn run build"
82
82
  },
83
83
  "dependencies": {
@@ -97,5 +97,5 @@
97
97
  "type": "individual",
98
98
  "url": "https://ohif.org/donate"
99
99
  },
100
- "gitHead": "ab88654e25aefb7f43a807c0f38ce601af4c20a4"
100
+ "gitHead": "af40281b222938a78ea1db18d9dd1b85a975e99c"
101
101
  }