@cornerstonejs/core 1.85.1 → 1.86.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/core",
3
- "version": "1.85.1",
3
+ "version": "1.86.1",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "types": "dist/types/index.d.ts",
@@ -46,6 +46,5 @@
46
46
  "funding": {
47
47
  "type": "individual",
48
48
  "url": "https://ohif.org/donate"
49
- },
50
- "gitHead": "042a87e58cdb6c975ed540a94c071469f1aead77"
49
+ }
51
50
  }
@@ -34,7 +34,6 @@ import type {
34
34
  StackViewportProperties,
35
35
  VOIRange,
36
36
  ViewReference,
37
- ViewPresentation,
38
37
  VolumeActor,
39
38
  } from '../types';
40
39
  import {
@@ -46,6 +45,7 @@ import {
46
45
  actorIsA,
47
46
  colormap as colormapUtils,
48
47
  createSigmoidRGBTransferFunction,
48
+ getSpacingInNormalDirection,
49
49
  imageIdToURI,
50
50
  imageRetrieveMetadataProvider,
51
51
  invertRgbTransferFunction,
@@ -2893,6 +2893,10 @@ class StackViewport extends Viewport implements IStackViewport, IImagesLoader {
2893
2893
 
2894
2894
  /**
2895
2895
  * Checks to see if this target is or could be shown in this viewport
2896
+ *
2897
+ * @param viewRef - view reference
2898
+ * @param options - reference compatible options
2899
+ * @returns boolean if reference is viewable
2896
2900
  */
2897
2901
  public isReferenceViewable(
2898
2902
  viewRef: ViewReference,
@@ -2922,7 +2926,39 @@ class StackViewport extends Viewport implements IStackViewport, IImagesLoader {
2922
2926
  const colonIndex = imageId.indexOf(':');
2923
2927
  imageURI = imageId.substring(colonIndex + 1);
2924
2928
  }
2925
- return referencedImageId?.endsWith(imageURI);
2929
+
2930
+ const endsWith = referencedImageId?.endsWith(imageURI);
2931
+ if (endsWith) {
2932
+ return endsWith;
2933
+ }
2934
+
2935
+ // if camera focal point is provided, we can use that as a point
2936
+ // Todo: handle the case where the nearby project is not desired
2937
+ const { cameraFocalPoint } = viewRef;
2938
+
2939
+ if (options.asNearbyProjection && cameraFocalPoint) {
2940
+ const { spacing, direction, origin } = this.getImageData();
2941
+
2942
+ const viewPlaneNormal = direction.slice(6, 9) as Point3;
2943
+
2944
+ const sliceThickness = getSpacingInNormalDirection(
2945
+ { direction, spacing },
2946
+ viewPlaneNormal
2947
+ );
2948
+
2949
+ // Project the cameraFocalPoint onto the image plane
2950
+ const diff = vec3.subtract(vec3.create(), cameraFocalPoint, origin);
2951
+ const distanceToPlane = vec3.dot(diff, viewPlaneNormal);
2952
+
2953
+ // Define a threshold (e.g., half the slice thickness)
2954
+ const threshold = sliceThickness / 2;
2955
+
2956
+ if (Math.abs(distanceToPlane) <= threshold) {
2957
+ return true;
2958
+ }
2959
+ }
2960
+
2961
+ return false;
2926
2962
  }
2927
2963
 
2928
2964
  /**
@@ -69,6 +69,10 @@ export type ReferenceCompatibleOptions = {
69
69
  * not need to be provided.
70
70
  */
71
71
  imageURI?: string;
72
+ /**
73
+ * As nearby projection
74
+ */
75
+ asNearbyProjection?: boolean;
72
76
  };
73
77
 
74
78
  /**
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 Open Health Imaging Foundation
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.