@cornerstonejs/tools 5.19.0 → 5.19.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.
@@ -2,6 +2,17 @@ import { vec3, mat4 } from 'gl-matrix';
2
2
  import { ActorRenderMode, getRenderingEngine, metaData, utilities, VolumeViewport, } from '@cornerstonejs/core';
3
3
  import areViewportsCoplanar from './areViewportsCoplanar.js';
4
4
  const getSpatialRegistration = (targetId, sourceId) => utilities.spatialRegistrationMetadataProvider.get('spatialRegistrationModule', targetId, sourceId);
5
+ const calculatedRegistrationFrames = new Map();
6
+ function removeStaleRegistration(sourceId, targetId, sourceFOR, targetFOR) {
7
+ const frames = calculatedRegistrationFrames.get(`${sourceId}_${targetId}`);
8
+ if (frames === undefined || frames === `${sourceFOR}_${targetFOR}`) {
9
+ return;
10
+ }
11
+ utilities.spatialRegistrationMetadataProvider.add([sourceId, targetId], undefined);
12
+ utilities.spatialRegistrationMetadataProvider.add([targetId, sourceId], undefined);
13
+ calculatedRegistrationFrames.delete(`${sourceId}_${targetId}`);
14
+ calculatedRegistrationFrames.delete(`${targetId}_${sourceId}`);
15
+ }
5
16
  function isVolumeSliceViewport(viewport) {
6
17
  if (viewport instanceof VolumeViewport) {
7
18
  return true;
@@ -32,17 +43,24 @@ export default async function imageSliceSyncCallback(synchronizerInstance, sourc
32
43
  if (!areViewportsCoplanar(sViewport, tViewport)) {
33
44
  return;
34
45
  }
35
- let registrationMatrixMat4 = getSpatialRegistration(targetViewport.viewportId, sourceViewport.viewportId);
46
+ const sourceId = sourceViewport.viewportId;
47
+ const targetId = targetViewport.viewportId;
48
+ const frameOfReferenceUID1 = sViewport.getFrameOfReferenceUID();
49
+ const frameOfReferenceUID2 = tViewport.getFrameOfReferenceUID();
50
+ removeStaleRegistration(sourceId, targetId, frameOfReferenceUID1, frameOfReferenceUID2);
51
+ let registrationMatrixMat4 = getSpatialRegistration(targetId, sourceId);
36
52
  if (!registrationMatrixMat4) {
37
- const frameOfReferenceUID1 = sViewport.getFrameOfReferenceUID();
38
- const frameOfReferenceUID2 = tViewport.getFrameOfReferenceUID();
39
53
  if (frameOfReferenceUID1 === frameOfReferenceUID2 &&
40
54
  options?.useInitialPosition !== false) {
41
55
  registrationMatrixMat4 = mat4.identity(mat4.create());
42
56
  }
43
57
  else {
44
58
  utilities.calculateViewportsSpatialRegistration(sViewport, tViewport);
45
- registrationMatrixMat4 = getSpatialRegistration(targetViewport.viewportId, sourceViewport.viewportId);
59
+ registrationMatrixMat4 = getSpatialRegistration(targetId, sourceId);
60
+ if (registrationMatrixMat4) {
61
+ calculatedRegistrationFrames.set(`${sourceId}_${targetId}`, `${frameOfReferenceUID1}_${frameOfReferenceUID2}`);
62
+ calculatedRegistrationFrames.set(`${targetId}_${sourceId}`, `${frameOfReferenceUID2}_${frameOfReferenceUID1}`);
63
+ }
46
64
  }
47
65
  if (!registrationMatrixMat4) {
48
66
  return;
@@ -1 +1 @@
1
- export declare const version = "5.19.0";
1
+ export declare const version = "5.19.1";
@@ -1 +1 @@
1
- export const version = '5.19.0';
1
+ export const version = '5.19.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "5.19.0",
3
+ "version": "5.19.1",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -126,11 +126,11 @@
126
126
  "lodash.get": "4.4.2"
127
127
  },
128
128
  "devDependencies": {
129
- "@cornerstonejs/core": "5.19.0",
129
+ "@cornerstonejs/core": "5.19.1",
130
130
  "canvas": "3.2.0"
131
131
  },
132
132
  "peerDependencies": {
133
- "@cornerstonejs/core": "5.19.0",
133
+ "@cornerstonejs/core": "5.19.1",
134
134
  "@kitware/vtk.js": "36.4.1",
135
135
  "@types/d3-array": "3.2.1",
136
136
  "@types/d3-interpolate": "3.0.4",