@cornerstonejs/tools 0.57.0 → 0.57.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "0.57.0",
3
+ "version": "0.57.1",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "main": "dist/umd/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -52,5 +52,5 @@
52
52
  "type": "individual",
53
53
  "url": "https://ohif.org/donate"
54
54
  },
55
- "gitHead": "1e40104275742f14a7a48b076f244610f90e8657"
55
+ "gitHead": "c340fede4008457cd754df259b40a9dfff912668"
56
56
  }
@@ -5,6 +5,7 @@ import {
5
5
  StackViewport,
6
6
  VolumeViewport,
7
7
  cache,
8
+ BaseVolumeViewport,
8
9
  } from '@cornerstonejs/core';
9
10
 
10
11
  import { Types } from '@cornerstonejs/core';
@@ -301,7 +302,7 @@ function _getVolumeFromViewport(viewport): Types.IImageVolume {
301
302
  const actorEntry = viewport.getDefaultActor();
302
303
 
303
304
  if (!actorEntry) {
304
- console.warn('No actor found');
305
+ // This can happen during setup/teardown of viewports.
305
306
  return;
306
307
  }
307
308
 
@@ -1,7 +1,8 @@
1
1
  import { vec3 } from 'gl-matrix';
2
- import { CONSTANTS } from '@cornerstonejs/core';
2
+ import { CONSTANTS, metaData } from '@cornerstonejs/core';
3
3
  import type { Types } from '@cornerstonejs/core';
4
4
  import { Annotations, Annotation } from '../../types';
5
+ import { debug } from 'console';
5
6
 
6
7
  const { EPSILON } = CONSTANTS;
7
8
 
@@ -33,8 +34,33 @@ export default function filterAnnotationsWithinSlice(
33
34
  // logic down below.
34
35
  const annotationsWithParallelNormals = annotations.filter(
35
36
  (td: Annotation) => {
36
- const annotationViewPlaneNormal = td.metadata.viewPlaneNormal;
37
-
37
+ let annotationViewPlaneNormal = td.metadata.viewPlaneNormal;
38
+
39
+ if (!annotationViewPlaneNormal) {
40
+ // This code is run to set the annotation view plane normal
41
+ // for historical data which was saved without the normal.
42
+ const { referencedImageId } = td.metadata;
43
+ const { imageOrientationPatient } = metaData.get(
44
+ 'imagePlaneModule',
45
+ referencedImageId
46
+ );
47
+ const rowCosineVec = vec3.fromValues(
48
+ imageOrientationPatient[0],
49
+ imageOrientationPatient[1],
50
+ imageOrientationPatient[2]
51
+ );
52
+
53
+ const colCosineVec = vec3.fromValues(
54
+ imageOrientationPatient[3],
55
+ imageOrientationPatient[4],
56
+ imageOrientationPatient[5]
57
+ );
58
+
59
+ annotationViewPlaneNormal = vec3.create() as Types.Point3;
60
+
61
+ vec3.cross(annotationViewPlaneNormal, rowCosineVec, colCosineVec);
62
+ td.metadata.viewPlaneNormal = annotationViewPlaneNormal;
63
+ }
38
64
  const isParallel =
39
65
  Math.abs(vec3.dot(viewPlaneNormal, annotationViewPlaneNormal)) >
40
66
  PARALLEL_THRESHOLD;