@cornerstonejs/core 1.85.1 → 1.86.0
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/dist/cjs/RenderingEngine/StackViewport.js +17 -1
- package/dist/cjs/RenderingEngine/StackViewport.js.map +1 -1
- package/dist/cjs/types/IViewport.d.ts +1 -0
- package/dist/esm/RenderingEngine/StackViewport.js +18 -2
- package/dist/esm/RenderingEngine/StackViewport.js.map +1 -1
- package/dist/types/RenderingEngine/StackViewport.d.ts.map +1 -1
- package/dist/types/types/IViewport.d.ts +1 -0
- package/dist/types/types/IViewport.d.ts.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +2 -2
- package/src/RenderingEngine/StackViewport.ts +38 -2
- package/src/types/IViewport.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.86.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"type": "individual",
|
|
48
48
|
"url": "https://ohif.org/donate"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "089ac3e50d40067ff93e73a4c0e6bbf6594a6c98"
|
|
51
51
|
}
|
|
@@ -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
|
-
|
|
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
|
/**
|