@cornerstonejs/core 5.8.2 → 5.10.3
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/esm/RenderingEngine/BaseRenderingEngine.js +4 -2
- package/dist/esm/RenderingEngine/BaseVolumeViewport.d.ts +1 -0
- package/dist/esm/RenderingEngine/BaseVolumeViewport.js +13 -3
- package/dist/esm/RenderingEngine/ContextPoolRenderingEngine.js +3 -1
- package/dist/esm/RenderingEngine/GenericViewport/DefaultRenderPathResolver.js +3 -1
- package/dist/esm/RenderingEngine/GenericViewport/Planar/DefaultPlanarDataProvider.js +3 -1
- package/dist/esm/RenderingEngine/GenericViewport/Planar/PlanarViewport.js +3 -1
- package/dist/esm/RenderingEngine/GenericViewport/Planar/PlanarViewportLegacyAdapter.js +3 -1
- package/dist/esm/RenderingEngine/GenericViewport/Planar/planarViewReference.js +1 -1
- package/dist/esm/RenderingEngine/GenericViewport/genericViewportReferenceCompatibility.js +3 -2
- package/dist/esm/RenderingEngine/RenderingEngine.js +3 -1
- package/dist/esm/RenderingEngine/StackViewport.js +8 -4
- package/dist/esm/RenderingEngine/TiledRenderingEngine.js +3 -1
- package/dist/esm/RenderingEngine/VideoViewport.d.ts +1 -0
- package/dist/esm/RenderingEngine/VideoViewport.js +18 -12
- package/dist/esm/RenderingEngine/Viewport.d.ts +1 -0
- package/dist/esm/RenderingEngine/Viewport.js +17 -10
- package/dist/esm/RenderingEngine/VolumeViewport.js +4 -2
- package/dist/esm/RenderingEngine/WSIViewport.js +1 -2
- package/dist/esm/RenderingEngine/helpers/addImageSlicesToViewports.js +3 -1
- package/dist/esm/RenderingEngine/helpers/addVolumesToViewports.js +3 -1
- package/dist/esm/RenderingEngine/helpers/attachWebGLContextEvents.js +3 -1
- package/dist/esm/RenderingEngine/helpers/cpuFallback/rendering/renderPseudoColorImage.js +3 -1
- package/dist/esm/RenderingEngine/helpers/getCameraVectors.js +3 -1
- package/dist/esm/RenderingEngine/helpers/stats/StatsOverlay.js +3 -1
- package/dist/esm/RenderingEngine/helpers/volumeNewImageEventDispatcher.js +3 -1
- package/dist/esm/RenderingEngine/vtkClasses/vtkStreamingOpenGLVolumeMapper.js +3 -1
- package/dist/esm/cache/cache.js +16 -14
- package/dist/esm/cache/classes/BaseStreamingImageVolume.js +4 -2
- package/dist/esm/eventTarget.js +3 -1
- package/dist/esm/init.js +12 -6
- package/dist/esm/loaders/ProgressiveRetrieveImages.js +3 -1
- package/dist/esm/loaders/cornerstoneStreamingImageVolumeLoader.js +4 -2
- package/dist/esm/loaders/fillNearbyFrames.js +3 -1
- package/dist/esm/loaders/imageLoader.d.ts +1 -0
- package/dist/esm/loaders/imageLoader.js +36 -7
- package/dist/esm/requestPool/requestPoolManager.js +3 -1
- package/dist/esm/types/Cornerstone3DConfig.d.ts +4 -1
- package/dist/esm/types/IViewport.d.ts +2 -0
- package/dist/esm/utilities/ProgressiveIterator.js +4 -2
- package/dist/esm/utilities/RLEVoxelMap.d.ts +2 -2
- package/dist/esm/utilities/RLEVoxelMap.js +12 -6
- package/dist/esm/utilities/VoxelManager.d.ts +9 -2
- package/dist/esm/utilities/VoxelManager.js +65 -14
- package/dist/esm/utilities/calculateSpacingBetweenImageIds.js +5 -3
- package/dist/esm/utilities/calculateViewportsSpatialRegistration.js +4 -2
- package/dist/esm/utilities/deepEqual.js +3 -1
- package/dist/esm/utilities/eventListener/TargetEventListeners.js +3 -1
- package/dist/esm/utilities/getBufferConfiguration.js +3 -1
- package/dist/esm/utilities/getEffectiveSpacingAlongDirection.d.ts +6 -0
- package/dist/esm/utilities/getEffectiveSpacingAlongDirection.js +11 -0
- package/dist/esm/utilities/getImageSliceDataForVolumeViewport.js +3 -1
- package/dist/esm/utilities/getVolumeSliceRangeInfo.js +3 -1
- package/dist/esm/utilities/index.d.ts +5 -1
- package/dist/esm/utilities/index.js +5 -1
- package/dist/esm/utilities/loadImageToCanvas.js +3 -1
- package/dist/esm/utilities/logger.d.ts +2 -1
- package/dist/esm/utilities/logger.js +2 -1
- package/dist/esm/utilities/resolveApplicationUrl.d.ts +3 -0
- package/dist/esm/utilities/resolveApplicationUrl.js +31 -0
- package/dist/esm/utilities/snapFocalPointToSlice.js +7 -1
- package/dist/esm/utilities/updatePlaneRestriction.d.ts +2 -2
- package/dist/esm/utilities/updatePlaneRestriction.js +47 -19
- package/dist/esm/utilities/voxelSlab/getVoxelThicknessAlongNormal.d.ts +6 -0
- package/dist/esm/utilities/voxelSlab/getVoxelThicknessAlongNormal.js +10 -0
- package/dist/esm/utilities/voxelSlab/index.d.ts +10 -0
- package/dist/esm/utilities/voxelSlab/index.js +7 -0
- package/dist/esm/utilities/voxelSlab/indexSpaceSlab.d.ts +29 -0
- package/dist/esm/utilities/voxelSlab/indexSpaceSlab.js +121 -0
- package/dist/esm/utilities/voxelSlab/isPlaneDepthViewable.d.ts +2 -0
- package/dist/esm/utilities/voxelSlab/isPlaneDepthViewable.js +12 -0
- package/dist/esm/utilities/voxelSlab/iterateVoxelsInShape.d.ts +20 -0
- package/dist/esm/utilities/voxelSlab/iterateVoxelsInShape.js +91 -0
- package/dist/esm/utilities/voxelSlab/sampleVoxelsInShape.d.ts +16 -0
- package/dist/esm/utilities/voxelSlab/sampleVoxelsInShape.js +24 -0
- package/dist/esm/utilities/voxelSlab/shapes/createEllipseShape.d.ts +22 -0
- package/dist/esm/utilities/voxelSlab/shapes/createEllipseShape.js +90 -0
- package/dist/esm/utilities/voxelSlab/shapes/createPolylineShape.d.ts +10 -0
- package/dist/esm/utilities/voxelSlab/shapes/createPolylineShape.js +170 -0
- package/dist/esm/utilities/voxelSlab/shapes/createRectangleShape.d.ts +14 -0
- package/dist/esm/utilities/voxelSlab/shapes/createRectangleShape.js +69 -0
- package/dist/esm/utilities/voxelSlab/shapes/index.d.ts +8 -0
- package/dist/esm/utilities/voxelSlab/shapes/index.js +4 -0
- package/dist/esm/utilities/voxelSlab/shapes/shapeGeometry.d.ts +28 -0
- package/dist/esm/utilities/voxelSlab/shapes/shapeGeometry.js +99 -0
- package/dist/esm/utilities/voxelSlab/slabMembership.d.ts +11 -0
- package/dist/esm/utilities/voxelSlab/slabMembership.js +42 -0
- package/dist/esm/utilities/wasmBasePath.d.ts +3 -0
- package/dist/esm/utilities/wasmBasePath.js +12 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/webWorkerManager/webWorkerManager.js +6 -6
- package/package.json +6 -7
- package/LICENSE +0 -21
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import getVoxelThicknessAlongNormal from '../getVoxelThicknessAlongNormal.js';
|
|
2
|
+
import { projectPointOntoPlane } from '../slabMembership.js';
|
|
3
|
+
import { UNBOUNDED, createColumnLineResolver, createPlaneBasis, SHAPE_BOUNDARY_EPSILON, intersectRanges, solveAbsLinearLeq, toIntegerRun, } from './shapeGeometry.js';
|
|
4
|
+
const expand = (halfExtent) => halfExtent + Math.max(halfExtent, 1) * SHAPE_BOUNDARY_EPSILON;
|
|
5
|
+
export function createRectangleShape(options) {
|
|
6
|
+
const { volume, planePoint, viewPlaneNormal: normal, majorAxis, majorHalfLength, minorHalfLength, depthHalfLength, } = options;
|
|
7
|
+
if (!(majorHalfLength > 0) || !(minorHalfLength > 0)) {
|
|
8
|
+
throw new Error('Rectangle half lengths must be positive');
|
|
9
|
+
}
|
|
10
|
+
if (depthHalfLength !== undefined && !(depthHalfLength > 0)) {
|
|
11
|
+
throw new Error('Rectangle depthHalfLength must be positive when supplied');
|
|
12
|
+
}
|
|
13
|
+
const basis = createPlaneBasis(normal, majorAxis);
|
|
14
|
+
const isSolid = depthHalfLength !== undefined;
|
|
15
|
+
const voxelThickness = getVoxelThicknessAlongNormal(volume, basis.n);
|
|
16
|
+
const depthExtent = isSolid
|
|
17
|
+
? depthHalfLength + voxelThickness / 2
|
|
18
|
+
: 0;
|
|
19
|
+
const center = isSolid
|
|
20
|
+
? [...options.centerWorld]
|
|
21
|
+
: projectPointOntoPlane(options.centerWorld, planePoint, basis.n);
|
|
22
|
+
const constraints = [
|
|
23
|
+
{ axis: basis.u, halfExtent: expand(majorHalfLength) },
|
|
24
|
+
{ axis: basis.v, halfExtent: expand(minorHalfLength) },
|
|
25
|
+
];
|
|
26
|
+
if (isSolid) {
|
|
27
|
+
constraints.push({ axis: basis.n, halfExtent: expand(depthExtent) });
|
|
28
|
+
}
|
|
29
|
+
const resolveColumnLine = createColumnLineResolver(volume, basis.n);
|
|
30
|
+
function containsPoint(point) {
|
|
31
|
+
const tested = isSolid
|
|
32
|
+
? point
|
|
33
|
+
: projectPointOntoPlane(point, planePoint, basis.n);
|
|
34
|
+
for (const { axis, halfExtent } of constraints) {
|
|
35
|
+
const offset = (tested[0] - center[0]) * axis[0] +
|
|
36
|
+
(tested[1] - center[1]) * axis[1] +
|
|
37
|
+
(tested[2] - center[2]) * axis[2];
|
|
38
|
+
if (Math.abs(offset) > halfExtent) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
function* getRuns(outerIndex, rowIndex, _depthRun, slab) {
|
|
45
|
+
const line = resolveColumnLine(slab, outerIndex, rowIndex);
|
|
46
|
+
const lineBase = isSolid ? line.base : line.projectedBase;
|
|
47
|
+
const lineStep = isSolid ? line.step : line.projectedStep;
|
|
48
|
+
let range = UNBOUNDED;
|
|
49
|
+
for (const { axis, halfExtent } of constraints) {
|
|
50
|
+
const offset = (lineBase[0] - center[0]) * axis[0] +
|
|
51
|
+
(lineBase[1] - center[1]) * axis[1] +
|
|
52
|
+
(lineBase[2] - center[2]) * axis[2];
|
|
53
|
+
const slope = lineStep[0] * axis[0] + lineStep[1] * axis[1] + lineStep[2] * axis[2];
|
|
54
|
+
range = intersectRanges(range, solveAbsLinearLeq(offset, slope, halfExtent));
|
|
55
|
+
if (!range) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const run = toIntegerRun(range);
|
|
60
|
+
if (run) {
|
|
61
|
+
yield run;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
containsPoint,
|
|
66
|
+
getRuns,
|
|
67
|
+
getRequiredThickness: () => (isSolid ? depthExtent * 2 : 0),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { VoxelSlabShape, PlaneBasis, ColumnLine, RealRange, } from './shapeGeometry.js';
|
|
2
|
+
export { createPlaneBasis, createColumnLineResolver, getAxisSteps, intersectRanges, solveAbsLinearLeq, solveQuadraticLeqZero, toIntegerRun, UNBOUNDED, } from './shapeGeometry.js';
|
|
3
|
+
export { createEllipseShape, createCircleShape } from './createEllipseShape.js';
|
|
4
|
+
export type { EllipseShapeOptions } from './createEllipseShape.js';
|
|
5
|
+
export { createRectangleShape } from './createRectangleShape.js';
|
|
6
|
+
export type { RectangleShapeOptions } from './createRectangleShape.js';
|
|
7
|
+
export { createPolylineShape } from './createPolylineShape.js';
|
|
8
|
+
export type { PolylineShapeOptions } from './createPolylineShape.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createPlaneBasis, createColumnLineResolver, getAxisSteps, intersectRanges, solveAbsLinearLeq, solveQuadraticLeqZero, toIntegerRun, UNBOUNDED, } from './shapeGeometry.js';
|
|
2
|
+
export { createEllipseShape, createCircleShape } from './createEllipseShape.js';
|
|
3
|
+
export { createRectangleShape } from './createRectangleShape.js';
|
|
4
|
+
export { createPolylineShape } from './createPolylineShape.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Point2, Point3 } from '../../../types/index.js';
|
|
2
|
+
import type { IndexSpaceSlab, VolumeGeometry } from '../indexSpaceSlab.js';
|
|
3
|
+
export interface VoxelSlabShape {
|
|
4
|
+
containsPoint(point: Point3): boolean;
|
|
5
|
+
getRuns(outerIndex: number, rowIndex: number, depthRun: Point2, slab: IndexSpaceSlab): Iterable<Point2>;
|
|
6
|
+
getRequiredThickness(): number;
|
|
7
|
+
}
|
|
8
|
+
export interface PlaneBasis {
|
|
9
|
+
u: Point3;
|
|
10
|
+
v: Point3;
|
|
11
|
+
n: Point3;
|
|
12
|
+
}
|
|
13
|
+
export declare function createPlaneBasis(normal: Point3, orientation: Point3): PlaneBasis;
|
|
14
|
+
export declare function getAxisSteps(volume: VolumeGeometry): [Point3, Point3, Point3];
|
|
15
|
+
export interface ColumnLine {
|
|
16
|
+
base: Point3;
|
|
17
|
+
step: Point3;
|
|
18
|
+
projectedBase: Point3;
|
|
19
|
+
projectedStep: Point3;
|
|
20
|
+
}
|
|
21
|
+
export declare function createColumnLineResolver(volume: VolumeGeometry, normal: Point3): (slab: IndexSpaceSlab, outerIndex: number, rowIndex: number) => ColumnLine;
|
|
22
|
+
export declare const SHAPE_BOUNDARY_EPSILON = 0.00001;
|
|
23
|
+
export type RealRange = [number, number];
|
|
24
|
+
export declare const UNBOUNDED: RealRange;
|
|
25
|
+
export declare function intersectRanges(a: RealRange | null, b: RealRange | null): RealRange | null;
|
|
26
|
+
export declare function solveAbsLinearLeq(a: number, b: number, halfExtent: number): RealRange | null;
|
|
27
|
+
export declare function solveQuadraticLeqZero(A: number, B: number, C: number): RealRange | null;
|
|
28
|
+
export declare function toIntegerRun(range: RealRange | null): Point2 | null;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { vec3 } from 'gl-matrix';
|
|
2
|
+
export function createPlaneBasis(normal, orientation) {
|
|
3
|
+
const n = vec3.normalize(vec3.create(), normal);
|
|
4
|
+
const along = vec3.dot(orientation, n);
|
|
5
|
+
const u = vec3.sub(vec3.create(), orientation, vec3.scale(vec3.create(), n, along));
|
|
6
|
+
const uLength = vec3.length(u);
|
|
7
|
+
if (!(uLength > 1e-12)) {
|
|
8
|
+
throw new Error('Shape orientation vector is parallel to the plane normal, so it defines no in-plane direction');
|
|
9
|
+
}
|
|
10
|
+
vec3.scale(u, u, 1 / uLength);
|
|
11
|
+
const v = vec3.cross(vec3.create(), n, u);
|
|
12
|
+
return { u: u, v, n };
|
|
13
|
+
}
|
|
14
|
+
export function getAxisSteps(volume) {
|
|
15
|
+
const { direction, spacing } = volume;
|
|
16
|
+
return [0, 1, 2].map((axis) => {
|
|
17
|
+
const unit = direction.slice(axis * 3, axis * 3 + 3);
|
|
18
|
+
return [
|
|
19
|
+
unit[0] * spacing[axis],
|
|
20
|
+
unit[1] * spacing[axis],
|
|
21
|
+
unit[2] * spacing[axis],
|
|
22
|
+
];
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export function createColumnLineResolver(volume, normal) {
|
|
26
|
+
const axisSteps = getAxisSteps(volume);
|
|
27
|
+
const { origin } = volume;
|
|
28
|
+
const line = {
|
|
29
|
+
base: [0, 0, 0],
|
|
30
|
+
step: [0, 0, 0],
|
|
31
|
+
projectedBase: [0, 0, 0],
|
|
32
|
+
projectedStep: [0, 0, 0],
|
|
33
|
+
};
|
|
34
|
+
let preparedSlab = null;
|
|
35
|
+
return function resolve(slab, outerIndex, rowIndex) {
|
|
36
|
+
const { g, c0, outerAxis, rowAxis, columnAxis } = slab;
|
|
37
|
+
if (preparedSlab !== slab) {
|
|
38
|
+
const columnStep = axisSteps[columnAxis];
|
|
39
|
+
const gColumn = g[columnAxis];
|
|
40
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
41
|
+
line.step[axis] = columnStep[axis];
|
|
42
|
+
line.projectedStep[axis] = columnStep[axis] - gColumn * normal[axis];
|
|
43
|
+
}
|
|
44
|
+
preparedSlab = slab;
|
|
45
|
+
}
|
|
46
|
+
const outerStep = axisSteps[outerAxis];
|
|
47
|
+
const rowStep = axisSteps[rowAxis];
|
|
48
|
+
const baseDepth = outerIndex * g[outerAxis] + rowIndex * g[rowAxis] + c0;
|
|
49
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
50
|
+
const base = origin[axis] + outerIndex * outerStep[axis] + rowIndex * rowStep[axis];
|
|
51
|
+
line.base[axis] = base;
|
|
52
|
+
line.projectedBase[axis] = base - baseDepth * normal[axis];
|
|
53
|
+
}
|
|
54
|
+
return line;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export const SHAPE_BOUNDARY_EPSILON = 1e-5;
|
|
58
|
+
export const UNBOUNDED = [-Infinity, Infinity];
|
|
59
|
+
export function intersectRanges(a, b) {
|
|
60
|
+
if (!a || !b) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const low = Math.max(a[0], b[0]);
|
|
64
|
+
const high = Math.min(a[1], b[1]);
|
|
65
|
+
return low > high ? null : [low, high];
|
|
66
|
+
}
|
|
67
|
+
export function solveAbsLinearLeq(a, b, halfExtent) {
|
|
68
|
+
if (b === 0) {
|
|
69
|
+
return Math.abs(a) <= halfExtent ? UNBOUNDED : null;
|
|
70
|
+
}
|
|
71
|
+
const first = (-halfExtent - a) / b + 0;
|
|
72
|
+
const second = (halfExtent - a) / b + 0;
|
|
73
|
+
return first <= second ? [first, second] : [second, first];
|
|
74
|
+
}
|
|
75
|
+
export function solveQuadraticLeqZero(A, B, C) {
|
|
76
|
+
if (A === 0) {
|
|
77
|
+
if (B === 0) {
|
|
78
|
+
return C <= 0 ? UNBOUNDED : null;
|
|
79
|
+
}
|
|
80
|
+
const root = -C / B + 0;
|
|
81
|
+
return B > 0 ? [-Infinity, root] : [root, Infinity];
|
|
82
|
+
}
|
|
83
|
+
const discriminant = B * B - 4 * A * C;
|
|
84
|
+
if (discriminant < 0) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const rootOfDiscriminant = Math.sqrt(discriminant);
|
|
88
|
+
const first = (-B - rootOfDiscriminant) / (2 * A) + 0;
|
|
89
|
+
const second = (-B + rootOfDiscriminant) / (2 * A) + 0;
|
|
90
|
+
return first <= second ? [first, second] : [second, first];
|
|
91
|
+
}
|
|
92
|
+
export function toIntegerRun(range) {
|
|
93
|
+
if (!range) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
const low = Math.ceil(range[0]);
|
|
97
|
+
const high = Math.floor(range[1]);
|
|
98
|
+
return low > high ? null : [low, high];
|
|
99
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Point3 } from '../../types/index.js';
|
|
2
|
+
export declare const SLAB_RELATIVE_EPSILON = 0.00001;
|
|
3
|
+
export declare function getSlabEpsilon(voxelThickness: number): number;
|
|
4
|
+
export declare function resolveReferencePlaneThickness(referencePlaneThickness: number | null | undefined, voxelThickness: number): number;
|
|
5
|
+
export declare function getMembershipHalfWidth(referencePlaneThickness: number, voxelThickness: number): number;
|
|
6
|
+
export declare function getDisplayHalfWidth(viewportSlabThickness: number, referencePlaneThickness: number): number;
|
|
7
|
+
export declare function signedDistanceToPlane(point: Point3, planePoint: Point3, normal: Point3): number;
|
|
8
|
+
export declare function isWithinSlab(signedDistance: number, halfWidth: number, epsilon: number): boolean;
|
|
9
|
+
export declare function isVoxelCenterInSlab(voxelCenter: Point3, planePoint: Point3, normal: Point3, referencePlaneThickness: number, voxelThickness: number): boolean;
|
|
10
|
+
export declare function projectPointOntoPlane(point: Point3, planePoint: Point3, normal: Point3, out?: Point3): Point3;
|
|
11
|
+
export declare function asUnitNormal(normal: Point3): Point3;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { vec3 } from 'gl-matrix';
|
|
2
|
+
export const SLAB_RELATIVE_EPSILON = 1e-5;
|
|
3
|
+
export function getSlabEpsilon(voxelThickness) {
|
|
4
|
+
return Math.abs(voxelThickness) * SLAB_RELATIVE_EPSILON;
|
|
5
|
+
}
|
|
6
|
+
export function resolveReferencePlaneThickness(referencePlaneThickness, voxelThickness) {
|
|
7
|
+
return Number.isFinite(referencePlaneThickness) &&
|
|
8
|
+
referencePlaneThickness > 0
|
|
9
|
+
? referencePlaneThickness
|
|
10
|
+
: voxelThickness;
|
|
11
|
+
}
|
|
12
|
+
export function getMembershipHalfWidth(referencePlaneThickness, voxelThickness) {
|
|
13
|
+
return (referencePlaneThickness + voxelThickness) / 2;
|
|
14
|
+
}
|
|
15
|
+
export function getDisplayHalfWidth(viewportSlabThickness, referencePlaneThickness) {
|
|
16
|
+
return (viewportSlabThickness + referencePlaneThickness) / 2;
|
|
17
|
+
}
|
|
18
|
+
export function signedDistanceToPlane(point, planePoint, normal) {
|
|
19
|
+
return ((point[0] - planePoint[0]) * normal[0] +
|
|
20
|
+
(point[1] - planePoint[1]) * normal[1] +
|
|
21
|
+
(point[2] - planePoint[2]) * normal[2]);
|
|
22
|
+
}
|
|
23
|
+
export function isWithinSlab(signedDistance, halfWidth, epsilon) {
|
|
24
|
+
return Math.abs(signedDistance) < halfWidth - epsilon;
|
|
25
|
+
}
|
|
26
|
+
export function isVoxelCenterInSlab(voxelCenter, planePoint, normal, referencePlaneThickness, voxelThickness) {
|
|
27
|
+
return isWithinSlab(signedDistanceToPlane(voxelCenter, planePoint, normal), getMembershipHalfWidth(referencePlaneThickness, voxelThickness), getSlabEpsilon(voxelThickness));
|
|
28
|
+
}
|
|
29
|
+
export function projectPointOntoPlane(point, planePoint, normal, out = [0, 0, 0]) {
|
|
30
|
+
const distance = signedDistanceToPlane(point, planePoint, normal);
|
|
31
|
+
out[0] = point[0] - distance * normal[0];
|
|
32
|
+
out[1] = point[1] - distance * normal[1];
|
|
33
|
+
out[2] = point[2] - distance * normal[2];
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
36
|
+
export function asUnitNormal(normal) {
|
|
37
|
+
const lengthSquared = normal[0] * normal[0] + normal[1] * normal[1] + normal[2] * normal[2];
|
|
38
|
+
if (Math.abs(lengthSquared - 1) < Number.EPSILON * 8) {
|
|
39
|
+
return normal;
|
|
40
|
+
}
|
|
41
|
+
return vec3.normalize(vec3.create(), normal);
|
|
42
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import resolveApplicationUrl from './resolveApplicationUrl.js';
|
|
2
|
+
let wasmBasePath;
|
|
3
|
+
export function setWasmBasePath(basePath) {
|
|
4
|
+
wasmBasePath = basePath || undefined;
|
|
5
|
+
}
|
|
6
|
+
export function getWasmBasePath() {
|
|
7
|
+
return wasmBasePath;
|
|
8
|
+
}
|
|
9
|
+
export function resolveWasmBasePath(defaultDirectory = '') {
|
|
10
|
+
const directory = wasmBasePath || defaultDirectory;
|
|
11
|
+
return resolveApplicationUrl(!directory || directory.endsWith('/') ? directory : `${directory}/`);
|
|
12
|
+
}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.10.3";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.
|
|
1
|
+
export const version = '5.10.3';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Comlink from 'comlink';
|
|
2
2
|
import { RequestType } from '../enums/index.js';
|
|
3
3
|
import { RequestPoolManager } from '../requestPool/requestPoolManager.js';
|
|
4
|
-
import {
|
|
5
|
-
const registrationLog =
|
|
4
|
+
import { coreLog } from '../utilities/logger.js';
|
|
5
|
+
const registrationLog = coreLog.getLogger('webWorkerManager', 'webWorkerManager');
|
|
6
6
|
class CentralizedWorkerManager {
|
|
7
7
|
constructor() {
|
|
8
8
|
this.workerRegistry = {};
|
|
@@ -43,7 +43,7 @@ class CentralizedWorkerManager {
|
|
|
43
43
|
getNextWorkerAPI(workerName) {
|
|
44
44
|
const workerProperties = this.workerRegistry[workerName];
|
|
45
45
|
if (!workerProperties) {
|
|
46
|
-
|
|
46
|
+
registrationLog.error(`Worker type '${workerName}' is not registered.`);
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
49
|
const workerInstances = workerProperties.instances.filter((instance) => instance !== null);
|
|
@@ -73,7 +73,7 @@ class CentralizedWorkerManager {
|
|
|
73
73
|
const { api, index } = this.getNextWorkerAPI(workerName);
|
|
74
74
|
if (!api) {
|
|
75
75
|
const error = new Error(`No available worker instance for '${workerName}'`);
|
|
76
|
-
|
|
76
|
+
registrationLog.error(error);
|
|
77
77
|
reject(error);
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
@@ -99,7 +99,7 @@ class CentralizedWorkerManager {
|
|
|
99
99
|
resolve(results);
|
|
100
100
|
}
|
|
101
101
|
catch (err) {
|
|
102
|
-
|
|
102
|
+
registrationLog.error(`Error executing method '${methodName}' on worker '${workerName}':`, err);
|
|
103
103
|
reject(err);
|
|
104
104
|
}
|
|
105
105
|
finally {
|
|
@@ -127,7 +127,7 @@ class CentralizedWorkerManager {
|
|
|
127
127
|
terminate(workerName) {
|
|
128
128
|
const workerProperties = this.workerRegistry[workerName];
|
|
129
129
|
if (!workerProperties) {
|
|
130
|
-
|
|
130
|
+
registrationLog.error(`Worker type '${workerName}' is not registered.`);
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
133
|
workerProperties.instances.forEach((_, index) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.10.3",
|
|
4
4
|
"description": "Cornerstone3D Core",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -85,18 +85,18 @@
|
|
|
85
85
|
"prepublishOnly": "pnpm run build"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@cornerstonejs/utils": "5.
|
|
88
|
+
"@cornerstonejs/utils": "5.10.3",
|
|
89
89
|
"@kitware/vtk.js": "36.4.1",
|
|
90
90
|
"comlink": "4.4.2",
|
|
91
91
|
"gl-matrix": "3.4.3",
|
|
92
92
|
"loglevel": "1.9.2"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
|
-
"@cornerstonejs/metadata": "5.
|
|
95
|
+
"@cornerstonejs/metadata": "5.10.3"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
98
|
-
"@cornerstonejs/metadata": "5.
|
|
99
|
-
"@cornerstonejs/utils": "5.
|
|
98
|
+
"@cornerstonejs/metadata": "5.10.3",
|
|
99
|
+
"@cornerstonejs/utils": "5.10.3"
|
|
100
100
|
},
|
|
101
101
|
"contributors": [
|
|
102
102
|
{
|
|
@@ -108,6 +108,5 @@
|
|
|
108
108
|
"funding": {
|
|
109
109
|
"type": "individual",
|
|
110
110
|
"url": "https://ohif.org/donate"
|
|
111
|
-
}
|
|
112
|
-
"gitHead": "7034957b10f5e91ad8f4d7978591ef688e262d26"
|
|
111
|
+
}
|
|
113
112
|
}
|
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.
|