@cornerstonejs/tools 4.18.3 → 4.18.4
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/tools/VolumeCroppingControlTool.d.ts +10 -35
- package/dist/esm/tools/VolumeCroppingControlTool.js +179 -699
- package/dist/esm/tools/VolumeCroppingTool.d.ts +32 -32
- package/dist/esm/tools/VolumeCroppingTool.js +775 -525
- package/dist/esm/utilities/draw3D/addLine3DBetweenPoints.d.ts +7 -0
- package/dist/esm/utilities/draw3D/addLine3DBetweenPoints.js +34 -0
- package/dist/esm/utilities/draw3D/calculateAdaptiveSphereRadius.d.ts +6 -0
- package/dist/esm/utilities/draw3D/calculateAdaptiveSphereRadius.js +7 -0
- package/dist/esm/utilities/draw3D/index.d.ts +2 -0
- package/dist/esm/utilities/draw3D/index.js +2 -0
- package/dist/esm/utilities/index.d.ts +2 -1
- package/dist/esm/utilities/index.js +2 -1
- package/dist/esm/utilities/volumeCropping/computePlanePlaneIntersection.d.ts +6 -0
- package/dist/esm/utilities/volumeCropping/computePlanePlaneIntersection.js +37 -0
- package/dist/esm/utilities/volumeCropping/constants.d.ts +31 -0
- package/dist/esm/utilities/volumeCropping/constants.js +31 -0
- package/dist/esm/utilities/volumeCropping/copyClippingPlanes.d.ts +2 -0
- package/dist/esm/utilities/volumeCropping/copyClippingPlanes.js +6 -0
- package/dist/esm/utilities/volumeCropping/extractVolumeDirectionVectors.d.ts +9 -0
- package/dist/esm/utilities/volumeCropping/extractVolumeDirectionVectors.js +9 -0
- package/dist/esm/utilities/volumeCropping/findLineBoundsIntersection.d.ts +5 -0
- package/dist/esm/utilities/volumeCropping/findLineBoundsIntersection.js +50 -0
- package/dist/esm/utilities/volumeCropping/getColorKeyForPlaneIndex.d.ts +1 -0
- package/dist/esm/utilities/volumeCropping/getColorKeyForPlaneIndex.js +13 -0
- package/dist/esm/utilities/volumeCropping/getOrientationFromNormal.d.ts +2 -0
- package/dist/esm/utilities/volumeCropping/getOrientationFromNormal.js +19 -0
- package/dist/esm/utilities/volumeCropping/index.d.ts +9 -0
- package/dist/esm/utilities/volumeCropping/index.js +9 -0
- package/dist/esm/utilities/volumeCropping/parseCornerKey.d.ts +8 -0
- package/dist/esm/utilities/volumeCropping/parseCornerKey.js +11 -0
- package/dist/esm/utilities/volumeCropping/types.d.ts +5 -0
- package/dist/esm/utilities/volumeCropping/types.js +0 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import vtkPolyData from '@kitware/vtk.js/Common/DataModel/PolyData';
|
|
2
|
+
import vtkActor from '@kitware/vtk.js/Rendering/Core/Actor';
|
|
3
|
+
import type { Types } from '@cornerstonejs/core';
|
|
4
|
+
export declare function addLine3DBetweenPoints(viewport: Types.IVolumeViewport, point1: Types.Point3, point2: Types.Point3, color?: [number, number, number], uid?: string, showHandles?: boolean): {
|
|
5
|
+
actor: vtkActor | null;
|
|
6
|
+
source: vtkPolyData | null;
|
|
7
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import vtkPolyData from '@kitware/vtk.js/Common/DataModel/PolyData';
|
|
2
|
+
import vtkPoints from '@kitware/vtk.js/Common/Core/Points';
|
|
3
|
+
import vtkCellArray from '@kitware/vtk.js/Common/Core/CellArray';
|
|
4
|
+
import vtkActor from '@kitware/vtk.js/Rendering/Core/Actor';
|
|
5
|
+
import vtkMapper from '@kitware/vtk.js/Rendering/Core/Mapper';
|
|
6
|
+
export function addLine3DBetweenPoints(viewport, point1, point2, color = [0.7, 0.7, 0.7], uid = '', showHandles = true) {
|
|
7
|
+
if (point1[0] === point2[0] &&
|
|
8
|
+
point1[1] === point2[1] &&
|
|
9
|
+
point1[2] === point2[2]) {
|
|
10
|
+
return { actor: null, source: null };
|
|
11
|
+
}
|
|
12
|
+
const points = vtkPoints.newInstance();
|
|
13
|
+
points.setNumberOfPoints(2);
|
|
14
|
+
points.setPoint(0, point1[0], point1[1], point1[2]);
|
|
15
|
+
points.setPoint(1, point2[0], point2[1], point2[2]);
|
|
16
|
+
const lines = vtkCellArray.newInstance({ values: [2, 0, 1] });
|
|
17
|
+
const polyData = vtkPolyData.newInstance();
|
|
18
|
+
polyData.setPoints(points);
|
|
19
|
+
polyData.setLines(lines);
|
|
20
|
+
const mapper = vtkMapper.newInstance();
|
|
21
|
+
mapper.setInputData(polyData);
|
|
22
|
+
const actor = vtkActor.newInstance();
|
|
23
|
+
actor.setMapper(mapper);
|
|
24
|
+
actor.getProperty().setColor(...color);
|
|
25
|
+
actor.getProperty().setLineWidth(0.5);
|
|
26
|
+
actor.getProperty().setOpacity(1.0);
|
|
27
|
+
actor.getProperty().setInterpolationToFlat();
|
|
28
|
+
actor.getProperty().setAmbient(1.0);
|
|
29
|
+
actor.getProperty().setDiffuse(0.0);
|
|
30
|
+
actor.getProperty().setSpecular(0.0);
|
|
31
|
+
actor.setVisibility(showHandles);
|
|
32
|
+
viewport.addActor({ actor, uid });
|
|
33
|
+
return { actor, source: polyData };
|
|
34
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function calculateAdaptiveSphereRadius(diagonal, config) {
|
|
2
|
+
const scaleFactor = config.sphereRadiusScale || 0.01;
|
|
3
|
+
const adaptiveRadius = diagonal * scaleFactor;
|
|
4
|
+
const minRadius = config.minSphereRadius || 2;
|
|
5
|
+
const maxRadius = config.maxSphereRadius || 50;
|
|
6
|
+
return Math.max(minRadius, Math.min(maxRadius, adaptiveRadius));
|
|
7
|
+
}
|
|
@@ -22,6 +22,7 @@ import * as viewportFilters from './viewportFilters';
|
|
|
22
22
|
import * as orientation from './orientation';
|
|
23
23
|
import * as cine from './cine';
|
|
24
24
|
import * as boundingBox from './boundingBox';
|
|
25
|
+
import * as draw3D from './draw3D';
|
|
25
26
|
import * as planarFreehandROITool from './planarFreehandROITool';
|
|
26
27
|
import * as rectangleROITool from './rectangleROITool';
|
|
27
28
|
import { stackPrefetch, stackContextPrefetch } from './stackPrefetch';
|
|
@@ -42,4 +43,4 @@ import { moveAnnotationToViewPlane } from './moveAnnotationToViewPlane';
|
|
|
42
43
|
import { safeStructuredClone } from './safeStructuredClone';
|
|
43
44
|
import getOrCreateImageVolume from './segmentation/getOrCreateImageVolume';
|
|
44
45
|
import * as usFanExtraction from '../tools/annotation/UltrasoundPleuraBLineTool/utils/fanExtraction';
|
|
45
|
-
export { math, planar, viewportFilters, drawing, debounce, dynamicVolume, throttle, orientation, isObject, touch, triggerEvent, calibrateImageSpacing, getCalibratedLengthUnitsAndScale, getCalibratedProbeUnitsAndValue, getCalibratedAspect, getPixelValueUnits, getPixelValueUnitsImageId, segmentation, contours, triggerAnnotationRenderForViewportIds, triggerAnnotationRenderForToolGroupIds, triggerAnnotationRender, getSphereBoundsInfo, getAnnotationNearPoint, getViewportForAnnotation, getAnnotationNearPointOnEnabledElement, viewport, cine, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, roundNumber, pointToString, polyDataUtils, voi, AnnotationMultiSlice, contourSegmentation, annotationHydration, getClosestImageIdForStackViewport, pointInSurroundingSphereCallback, normalizeViewportPlane, IslandRemoval, geometricSurfaceUtils, usFanExtraction, setAnnotationLabel, moveAnnotationToViewPlane, safeStructuredClone, getOrCreateImageVolume, };
|
|
46
|
+
export { math, planar, viewportFilters, drawing, debounce, dynamicVolume, throttle, orientation, isObject, touch, triggerEvent, calibrateImageSpacing, getCalibratedLengthUnitsAndScale, getCalibratedProbeUnitsAndValue, getCalibratedAspect, getPixelValueUnits, getPixelValueUnitsImageId, segmentation, contours, triggerAnnotationRenderForViewportIds, triggerAnnotationRenderForToolGroupIds, triggerAnnotationRender, getSphereBoundsInfo, getAnnotationNearPoint, getViewportForAnnotation, getAnnotationNearPointOnEnabledElement, viewport, cine, boundingBox, draw3D, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, roundNumber, pointToString, polyDataUtils, voi, AnnotationMultiSlice, contourSegmentation, annotationHydration, getClosestImageIdForStackViewport, pointInSurroundingSphereCallback, normalizeViewportPlane, IslandRemoval, geometricSurfaceUtils, usFanExtraction, setAnnotationLabel, moveAnnotationToViewPlane, safeStructuredClone, getOrCreateImageVolume, };
|
|
@@ -22,6 +22,7 @@ import * as viewportFilters from './viewportFilters';
|
|
|
22
22
|
import * as orientation from './orientation';
|
|
23
23
|
import * as cine from './cine';
|
|
24
24
|
import * as boundingBox from './boundingBox';
|
|
25
|
+
import * as draw3D from './draw3D';
|
|
25
26
|
import * as planarFreehandROITool from './planarFreehandROITool';
|
|
26
27
|
import * as rectangleROITool from './rectangleROITool';
|
|
27
28
|
import { stackPrefetch, stackContextPrefetch } from './stackPrefetch';
|
|
@@ -42,4 +43,4 @@ import { moveAnnotationToViewPlane } from './moveAnnotationToViewPlane';
|
|
|
42
43
|
import { safeStructuredClone } from './safeStructuredClone';
|
|
43
44
|
import getOrCreateImageVolume from './segmentation/getOrCreateImageVolume';
|
|
44
45
|
import * as usFanExtraction from '../tools/annotation/UltrasoundPleuraBLineTool/utils/fanExtraction';
|
|
45
|
-
export { math, planar, viewportFilters, drawing, debounce, dynamicVolume, throttle, orientation, isObject, touch, triggerEvent, calibrateImageSpacing, getCalibratedLengthUnitsAndScale, getCalibratedProbeUnitsAndValue, getCalibratedAspect, getPixelValueUnits, getPixelValueUnitsImageId, segmentation, contours, triggerAnnotationRenderForViewportIds, triggerAnnotationRenderForToolGroupIds, triggerAnnotationRender, getSphereBoundsInfo, getAnnotationNearPoint, getViewportForAnnotation, getAnnotationNearPointOnEnabledElement, viewport, cine, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, roundNumber, pointToString, polyDataUtils, voi, AnnotationMultiSlice, contourSegmentation, annotationHydration, getClosestImageIdForStackViewport, pointInSurroundingSphereCallback, normalizeViewportPlane, IslandRemoval, geometricSurfaceUtils, usFanExtraction, setAnnotationLabel, moveAnnotationToViewPlane, safeStructuredClone, getOrCreateImageVolume, };
|
|
46
|
+
export { math, planar, viewportFilters, drawing, debounce, dynamicVolume, throttle, orientation, isObject, touch, triggerEvent, calibrateImageSpacing, getCalibratedLengthUnitsAndScale, getCalibratedProbeUnitsAndValue, getCalibratedAspect, getPixelValueUnits, getPixelValueUnitsImageId, segmentation, contours, triggerAnnotationRenderForViewportIds, triggerAnnotationRenderForToolGroupIds, triggerAnnotationRender, getSphereBoundsInfo, getAnnotationNearPoint, getViewportForAnnotation, getAnnotationNearPointOnEnabledElement, viewport, cine, boundingBox, draw3D, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, roundNumber, pointToString, polyDataUtils, voi, AnnotationMultiSlice, contourSegmentation, annotationHydration, getClosestImageIdForStackViewport, pointInSurroundingSphereCallback, normalizeViewportPlane, IslandRemoval, geometricSurfaceUtils, usFanExtraction, setAnnotationLabel, moveAnnotationToViewPlane, safeStructuredClone, getOrCreateImageVolume, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import type { ClippingPlane } from './types';
|
|
3
|
+
export declare function computePlanePlaneIntersection(clippingPlane: ClippingPlane, viewPlaneNormal: Types.Point3, viewPlanePoint: Types.Point3): {
|
|
4
|
+
direction: Types.Point3;
|
|
5
|
+
point: Types.Point3;
|
|
6
|
+
} | null;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { vec3 } from 'gl-matrix';
|
|
2
|
+
import vtkMath from '@kitware/vtk.js/Common/Core/Math';
|
|
3
|
+
import { PARALLEL_PLANE_TOLERANCE } from './constants';
|
|
4
|
+
export function computePlanePlaneIntersection(clippingPlane, viewPlaneNormal, viewPlanePoint) {
|
|
5
|
+
const n1 = clippingPlane.normal;
|
|
6
|
+
const p1 = clippingPlane.origin;
|
|
7
|
+
const n2 = viewPlaneNormal;
|
|
8
|
+
const p2 = viewPlanePoint;
|
|
9
|
+
const dir = vec3.create();
|
|
10
|
+
vec3.cross(dir, n1, n2);
|
|
11
|
+
const dirLenSq = vec3.squaredLength(dir);
|
|
12
|
+
if (dirLenSq < PARALLEL_PLANE_TOLERANCE) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const d1 = vtkMath.dot(n1, p1);
|
|
16
|
+
const d2 = vtkMath.dot(n2, p2);
|
|
17
|
+
const term1 = vec3.create();
|
|
18
|
+
const term2 = vec3.create();
|
|
19
|
+
vec3.cross(term1, n2, dir);
|
|
20
|
+
vec3.scale(term1, term1, d1);
|
|
21
|
+
vec3.cross(term2, dir, n1);
|
|
22
|
+
vec3.scale(term2, term2, d2);
|
|
23
|
+
const point = vec3.create();
|
|
24
|
+
vec3.add(point, term1, term2);
|
|
25
|
+
vec3.scale(point, point, 1 / dirLenSq);
|
|
26
|
+
if (!Number.isFinite(point[0]) ||
|
|
27
|
+
!Number.isFinite(point[1]) ||
|
|
28
|
+
!Number.isFinite(point[2])) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const direction = vec3.create();
|
|
32
|
+
vec3.scale(direction, dir, 1 / Math.sqrt(dirLenSq));
|
|
33
|
+
return {
|
|
34
|
+
direction: direction,
|
|
35
|
+
point: point,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const PLANEINDEX: {
|
|
2
|
+
XMIN: number;
|
|
3
|
+
XMAX: number;
|
|
4
|
+
YMIN: number;
|
|
5
|
+
YMAX: number;
|
|
6
|
+
ZMIN: number;
|
|
7
|
+
ZMAX: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const SPHEREINDEX: {
|
|
10
|
+
XMIN: number;
|
|
11
|
+
XMAX: number;
|
|
12
|
+
YMIN: number;
|
|
13
|
+
YMAX: number;
|
|
14
|
+
ZMIN: number;
|
|
15
|
+
ZMAX: number;
|
|
16
|
+
XMIN_YMIN_ZMIN: number;
|
|
17
|
+
XMIN_YMIN_ZMAX: number;
|
|
18
|
+
XMIN_YMAX_ZMIN: number;
|
|
19
|
+
XMIN_YMAX_ZMAX: number;
|
|
20
|
+
XMAX_YMIN_ZMIN: number;
|
|
21
|
+
XMAX_YMIN_ZMAX: number;
|
|
22
|
+
XMAX_YMAX_ZMIN: number;
|
|
23
|
+
XMAX_YMAX_ZMAX: number;
|
|
24
|
+
};
|
|
25
|
+
export declare const NUM_CLIPPING_PLANES = 6;
|
|
26
|
+
export declare const ORIENTATION_TOLERANCE = 0.01;
|
|
27
|
+
export declare const PARALLEL_PLANE_TOLERANCE = 1e-10;
|
|
28
|
+
export declare const LINE_INTERSECTION_TOLERANCE = 1e-8;
|
|
29
|
+
export declare const LINE_EXTENSION_DISTANCE = 100000;
|
|
30
|
+
export declare const MIN_LINE_LENGTH_PIXELS = 1;
|
|
31
|
+
export declare const POINT_PROXIMITY_THRESHOLD_PIXELS = 6;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const PLANEINDEX = {
|
|
2
|
+
XMIN: 0,
|
|
3
|
+
XMAX: 1,
|
|
4
|
+
YMIN: 2,
|
|
5
|
+
YMAX: 3,
|
|
6
|
+
ZMIN: 4,
|
|
7
|
+
ZMAX: 5,
|
|
8
|
+
};
|
|
9
|
+
export const SPHEREINDEX = {
|
|
10
|
+
XMIN: 0,
|
|
11
|
+
XMAX: 1,
|
|
12
|
+
YMIN: 2,
|
|
13
|
+
YMAX: 3,
|
|
14
|
+
ZMIN: 4,
|
|
15
|
+
ZMAX: 5,
|
|
16
|
+
XMIN_YMIN_ZMIN: 6,
|
|
17
|
+
XMIN_YMIN_ZMAX: 7,
|
|
18
|
+
XMIN_YMAX_ZMIN: 8,
|
|
19
|
+
XMIN_YMAX_ZMAX: 9,
|
|
20
|
+
XMAX_YMIN_ZMIN: 10,
|
|
21
|
+
XMAX_YMIN_ZMAX: 11,
|
|
22
|
+
XMAX_YMAX_ZMIN: 12,
|
|
23
|
+
XMAX_YMAX_ZMAX: 13,
|
|
24
|
+
};
|
|
25
|
+
export const NUM_CLIPPING_PLANES = 6;
|
|
26
|
+
export const ORIENTATION_TOLERANCE = 1e-2;
|
|
27
|
+
export const PARALLEL_PLANE_TOLERANCE = 1e-10;
|
|
28
|
+
export const LINE_INTERSECTION_TOLERANCE = 1e-8;
|
|
29
|
+
export const LINE_EXTENSION_DISTANCE = 100000;
|
|
30
|
+
export const MIN_LINE_LENGTH_PIXELS = 1;
|
|
31
|
+
export const POINT_PROXIMITY_THRESHOLD_PIXELS = 6;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
export interface ImageDataWithDirection {
|
|
3
|
+
getDirection(): number[];
|
|
4
|
+
}
|
|
5
|
+
export declare function extractVolumeDirectionVectors(imageData: ImageDataWithDirection): {
|
|
6
|
+
xDir: Types.Point3;
|
|
7
|
+
yDir: Types.Point3;
|
|
8
|
+
zDir: Types.Point3;
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { vec3 } from 'gl-matrix';
|
|
2
|
+
export function extractVolumeDirectionVectors(imageData) {
|
|
3
|
+
const direction = imageData.getDirection();
|
|
4
|
+
return {
|
|
5
|
+
xDir: vec3.normalize([0, 0, 0], direction.slice(0, 3)),
|
|
6
|
+
yDir: vec3.normalize([0, 0, 0], direction.slice(3, 6)),
|
|
7
|
+
zDir: vec3.normalize([0, 0, 0], direction.slice(6, 9)),
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { vec2, vec3 } from 'gl-matrix';
|
|
2
|
+
import liangBarksyClip from '../math/vec2/liangBarksyClip';
|
|
3
|
+
import { LINE_EXTENSION_DISTANCE, MIN_LINE_LENGTH_PIXELS } from './constants';
|
|
4
|
+
export function findLineBoundsIntersection(linePoint, lineDirection, viewport) {
|
|
5
|
+
const lineLength = LINE_EXTENSION_DISTANCE;
|
|
6
|
+
const lineStart = vec3.scaleAndAdd([0, 0, 0], linePoint, lineDirection, -lineLength);
|
|
7
|
+
const lineEnd = vec3.scaleAndAdd([0, 0, 0], linePoint, lineDirection, lineLength);
|
|
8
|
+
const canvasStart = viewport.worldToCanvas(lineStart);
|
|
9
|
+
const canvasEnd = viewport.worldToCanvas(lineEnd);
|
|
10
|
+
const { clientWidth, clientHeight } = viewport.canvas;
|
|
11
|
+
const canvasBox = [0, 0, clientWidth, clientHeight];
|
|
12
|
+
const clippedStart = vec2.clone(canvasStart);
|
|
13
|
+
const clippedEnd = vec2.clone(canvasEnd);
|
|
14
|
+
const startValid = !isNaN(clippedStart[0]) && !isNaN(clippedStart[1]);
|
|
15
|
+
const endValid = !isNaN(clippedEnd[0]) && !isNaN(clippedEnd[1]);
|
|
16
|
+
if (!startValid || !endValid) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const clipResult = liangBarksyClip(clippedStart, clippedEnd, canvasBox);
|
|
20
|
+
if (clipResult === 0) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const clippedStartValid = !isNaN(clippedStart[0]) && !isNaN(clippedStart[1]);
|
|
24
|
+
const clippedEndValid = !isNaN(clippedEnd[0]) && !isNaN(clippedEnd[1]);
|
|
25
|
+
if (!clippedStartValid || !clippedEndValid) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const [xMin, yMin, xMax, yMax] = canvasBox;
|
|
29
|
+
const startInBounds = clippedStart[0] >= xMin - 1 &&
|
|
30
|
+
clippedStart[0] <= xMax + 1 &&
|
|
31
|
+
clippedStart[1] >= yMin - 1 &&
|
|
32
|
+
clippedStart[1] <= yMax + 1;
|
|
33
|
+
const endInBounds = clippedEnd[0] >= xMin - 1 &&
|
|
34
|
+
clippedEnd[0] <= xMax + 1 &&
|
|
35
|
+
clippedEnd[1] >= yMin - 1 &&
|
|
36
|
+
clippedEnd[1] <= yMax + 1;
|
|
37
|
+
if (!startInBounds || !endInBounds) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const dx = clippedEnd[0] - clippedStart[0];
|
|
41
|
+
const dy = clippedEnd[1] - clippedStart[1];
|
|
42
|
+
const length = Math.sqrt(dx * dx + dy * dy);
|
|
43
|
+
if (length < MIN_LINE_LENGTH_PIXELS) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
start: clippedStart,
|
|
48
|
+
end: clippedEnd,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getColorKeyForPlaneIndex(planeIndex: number): 'SAGITTAL' | 'CORONAL' | 'AXIAL' | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PLANEINDEX } from './constants';
|
|
2
|
+
export function getColorKeyForPlaneIndex(planeIndex) {
|
|
3
|
+
if (planeIndex === PLANEINDEX.XMIN || planeIndex === PLANEINDEX.XMAX) {
|
|
4
|
+
return 'SAGITTAL';
|
|
5
|
+
}
|
|
6
|
+
else if (planeIndex === PLANEINDEX.YMIN || planeIndex === PLANEINDEX.YMAX) {
|
|
7
|
+
return 'CORONAL';
|
|
8
|
+
}
|
|
9
|
+
else if (planeIndex === PLANEINDEX.ZMIN || planeIndex === PLANEINDEX.ZMAX) {
|
|
10
|
+
return 'AXIAL';
|
|
11
|
+
}
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { vec3 } from 'gl-matrix';
|
|
2
|
+
import { utilities } from '@cornerstonejs/core';
|
|
3
|
+
import { ORIENTATION_TOLERANCE } from './constants';
|
|
4
|
+
export function getOrientationFromNormal(normal) {
|
|
5
|
+
if (!normal) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
const canonical = {
|
|
9
|
+
AXIAL: [0, 0, 1],
|
|
10
|
+
CORONAL: [0, 1, 0],
|
|
11
|
+
SAGITTAL: [1, 0, 0],
|
|
12
|
+
};
|
|
13
|
+
for (const [key, value] of Object.entries(canonical)) {
|
|
14
|
+
if (utilities.isEqualAbs(1, vec3.dot(value, normal), ORIENTATION_TOLERANCE)) {
|
|
15
|
+
return key;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './constants';
|
|
2
|
+
export * from './types';
|
|
3
|
+
export * from './extractVolumeDirectionVectors';
|
|
4
|
+
export * from './parseCornerKey';
|
|
5
|
+
export * from './copyClippingPlanes';
|
|
6
|
+
export * from './getColorKeyForPlaneIndex';
|
|
7
|
+
export * from './getOrientationFromNormal';
|
|
8
|
+
export * from './computePlanePlaneIntersection';
|
|
9
|
+
export * from './findLineBoundsIntersection';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './constants';
|
|
2
|
+
export * from './types';
|
|
3
|
+
export * from './extractVolumeDirectionVectors';
|
|
4
|
+
export * from './parseCornerKey';
|
|
5
|
+
export * from './copyClippingPlanes';
|
|
6
|
+
export * from './getColorKeyForPlaneIndex';
|
|
7
|
+
export * from './getOrientationFromNormal';
|
|
8
|
+
export * from './computePlanePlaneIntersection';
|
|
9
|
+
export * from './findLineBoundsIntersection';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function parseCornerKey(uid) {
|
|
2
|
+
const cornerKey = uid.replace('corner_', '');
|
|
3
|
+
return {
|
|
4
|
+
isXMin: cornerKey.includes('XMIN'),
|
|
5
|
+
isXMax: cornerKey.includes('XMAX'),
|
|
6
|
+
isYMin: cornerKey.includes('YMIN'),
|
|
7
|
+
isYMax: cornerKey.includes('YMAX'),
|
|
8
|
+
isZMin: cornerKey.includes('ZMIN'),
|
|
9
|
+
isZMax: cornerKey.includes('ZMAX'),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
File without changes
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.18.
|
|
1
|
+
export declare const version = "4.18.4";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '4.18.
|
|
1
|
+
export const version = '4.18.4';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.4",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"types": "./dist/esm/index.d.ts",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"canvas": "3.2.0"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
|
-
"@cornerstonejs/core": "4.18.
|
|
111
|
+
"@cornerstonejs/core": "4.18.4",
|
|
112
112
|
"@kitware/vtk.js": "34.15.1",
|
|
113
113
|
"@types/d3-array": "3.2.1",
|
|
114
114
|
"@types/d3-interpolate": "3.0.4",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"type": "individual",
|
|
128
128
|
"url": "https://ohif.org/donate"
|
|
129
129
|
},
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "372895aea2372079dd442ef54ea110fd3c1d1eef"
|
|
131
131
|
}
|