@cornerstonejs/tools 4.18.3 → 4.18.5

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.
Files changed (49) hide show
  1. package/dist/esm/index.d.ts +2 -2
  2. package/dist/esm/index.js +2 -2
  3. package/dist/esm/tools/OrientationControllerTool.d.ts +38 -0
  4. package/dist/esm/tools/OrientationControllerTool.js +415 -0
  5. package/dist/esm/tools/VolumeCroppingControlTool.d.ts +10 -35
  6. package/dist/esm/tools/VolumeCroppingControlTool.js +179 -699
  7. package/dist/esm/tools/VolumeCroppingTool.d.ts +32 -32
  8. package/dist/esm/tools/VolumeCroppingTool.js +775 -525
  9. package/dist/esm/tools/index.d.ts +2 -1
  10. package/dist/esm/tools/index.js +2 -1
  11. package/dist/esm/utilities/draw3D/addLine3DBetweenPoints.d.ts +7 -0
  12. package/dist/esm/utilities/draw3D/addLine3DBetweenPoints.js +34 -0
  13. package/dist/esm/utilities/draw3D/calculateAdaptiveSphereRadius.d.ts +6 -0
  14. package/dist/esm/utilities/draw3D/calculateAdaptiveSphereRadius.js +7 -0
  15. package/dist/esm/utilities/draw3D/index.d.ts +2 -0
  16. package/dist/esm/utilities/draw3D/index.js +2 -0
  17. package/dist/esm/utilities/index.d.ts +2 -1
  18. package/dist/esm/utilities/index.js +2 -1
  19. package/dist/esm/utilities/volumeCropping/computePlanePlaneIntersection.d.ts +6 -0
  20. package/dist/esm/utilities/volumeCropping/computePlanePlaneIntersection.js +37 -0
  21. package/dist/esm/utilities/volumeCropping/constants.d.ts +31 -0
  22. package/dist/esm/utilities/volumeCropping/constants.js +31 -0
  23. package/dist/esm/utilities/volumeCropping/copyClippingPlanes.d.ts +2 -0
  24. package/dist/esm/utilities/volumeCropping/copyClippingPlanes.js +6 -0
  25. package/dist/esm/utilities/volumeCropping/extractVolumeDirectionVectors.d.ts +9 -0
  26. package/dist/esm/utilities/volumeCropping/extractVolumeDirectionVectors.js +9 -0
  27. package/dist/esm/utilities/volumeCropping/findLineBoundsIntersection.d.ts +5 -0
  28. package/dist/esm/utilities/volumeCropping/findLineBoundsIntersection.js +50 -0
  29. package/dist/esm/utilities/volumeCropping/getColorKeyForPlaneIndex.d.ts +1 -0
  30. package/dist/esm/utilities/volumeCropping/getColorKeyForPlaneIndex.js +13 -0
  31. package/dist/esm/utilities/volumeCropping/getOrientationFromNormal.d.ts +2 -0
  32. package/dist/esm/utilities/volumeCropping/getOrientationFromNormal.js +19 -0
  33. package/dist/esm/utilities/volumeCropping/index.d.ts +9 -0
  34. package/dist/esm/utilities/volumeCropping/index.js +9 -0
  35. package/dist/esm/utilities/volumeCropping/parseCornerKey.d.ts +8 -0
  36. package/dist/esm/utilities/volumeCropping/parseCornerKey.js +11 -0
  37. package/dist/esm/utilities/volumeCropping/types.d.ts +5 -0
  38. package/dist/esm/utilities/volumeCropping/types.js +0 -0
  39. package/dist/esm/utilities/vtkjs/AnnotatedRhombicuboctahedronActor/index.d.ts +31 -0
  40. package/dist/esm/utilities/vtkjs/AnnotatedRhombicuboctahedronActor/index.js +391 -0
  41. package/dist/esm/utilities/vtkjs/OrientationControllerWidget/index.d.ts +59 -0
  42. package/dist/esm/utilities/vtkjs/OrientationControllerWidget/index.js +486 -0
  43. package/dist/esm/utilities/vtkjs/RhombicuboctahedronSource/index.d.ts +7 -0
  44. package/dist/esm/utilities/vtkjs/RhombicuboctahedronSource/index.js +144 -0
  45. package/dist/esm/utilities/vtkjs/index.d.ts +3 -0
  46. package/dist/esm/utilities/vtkjs/index.js +3 -0
  47. package/dist/esm/version.d.ts +1 -1
  48. package/dist/esm/version.js +1 -1
  49. package/package.json +3 -3
@@ -55,9 +55,10 @@ import CircleROIStartEndThresholdTool from './segmentation/CircleROIStartEndThre
55
55
  import BrushTool from './segmentation/BrushTool';
56
56
  import PaintFillTool from './segmentation/PaintFillTool';
57
57
  import OrientationMarkerTool from './OrientationMarkerTool';
58
+ import OrientationControllerTool from './OrientationControllerTool';
58
59
  import SegmentSelectTool from './segmentation/SegmentSelectTool';
59
60
  import SegmentBidirectionalTool from './segmentation/SegmentBidirectionalTool';
60
61
  import * as strategies from './segmentation/strategies';
61
62
  import SegmentLabelTool from './segmentation/SegmentLabelTool';
62
63
  import LabelMapEditWithContourTool from './segmentation/LabelmapEditWithContour';
63
- export { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, VolumeCroppingTool, VolumeCroppingControlTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, StackScrollTool, PlanarRotateTool, ZoomTool, MIPJumpToClickTool, ReferenceCursors, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, BidirectionalTool, LabelTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, UltrasoundPleuraBLineTool, KeyImageTool, AnnotationEraserTool as EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, SplineContourSegmentationTool, BrushTool, MagnifyTool, AdvancedMagnifyTool, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, SculptorTool, SegmentSelectTool, VolumeRotateTool, RegionSegmentTool, RegionSegmentPlusTool, WholeBodySegmentTool, LabelmapBaseTool, SegmentBidirectionalTool, SegmentLabelTool, LabelMapEditWithContourTool, strategies, };
64
+ export { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, VolumeCroppingTool, VolumeCroppingControlTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, StackScrollTool, PlanarRotateTool, ZoomTool, MIPJumpToClickTool, ReferenceCursors, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, BidirectionalTool, LabelTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, UltrasoundPleuraBLineTool, KeyImageTool, AnnotationEraserTool as EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, SplineContourSegmentationTool, BrushTool, MagnifyTool, AdvancedMagnifyTool, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, OrientationControllerTool, SculptorTool, SegmentSelectTool, VolumeRotateTool, RegionSegmentTool, RegionSegmentPlusTool, WholeBodySegmentTool, LabelmapBaseTool, SegmentBidirectionalTool, SegmentLabelTool, LabelMapEditWithContourTool, strategies, };
@@ -55,9 +55,10 @@ import CircleROIStartEndThresholdTool from './segmentation/CircleROIStartEndThre
55
55
  import BrushTool from './segmentation/BrushTool';
56
56
  import PaintFillTool from './segmentation/PaintFillTool';
57
57
  import OrientationMarkerTool from './OrientationMarkerTool';
58
+ import OrientationControllerTool from './OrientationControllerTool';
58
59
  import SegmentSelectTool from './segmentation/SegmentSelectTool';
59
60
  import SegmentBidirectionalTool from './segmentation/SegmentBidirectionalTool';
60
61
  import * as strategies from './segmentation/strategies';
61
62
  import SegmentLabelTool from './segmentation/SegmentLabelTool';
62
63
  import LabelMapEditWithContourTool from './segmentation/LabelmapEditWithContour';
63
- export { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, VolumeCroppingTool, VolumeCroppingControlTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, StackScrollTool, PlanarRotateTool, ZoomTool, MIPJumpToClickTool, ReferenceCursors, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, BidirectionalTool, LabelTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, UltrasoundPleuraBLineTool, KeyImageTool, AnnotationEraserTool as EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, SplineContourSegmentationTool, BrushTool, MagnifyTool, AdvancedMagnifyTool, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, SculptorTool, SegmentSelectTool, VolumeRotateTool, RegionSegmentTool, RegionSegmentPlusTool, WholeBodySegmentTool, LabelmapBaseTool, SegmentBidirectionalTool, SegmentLabelTool, LabelMapEditWithContourTool, strategies, };
64
+ export { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, VolumeCroppingTool, VolumeCroppingControlTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, StackScrollTool, PlanarRotateTool, ZoomTool, MIPJumpToClickTool, ReferenceCursors, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, BidirectionalTool, LabelTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, UltrasoundPleuraBLineTool, KeyImageTool, AnnotationEraserTool as EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, SplineContourSegmentationTool, BrushTool, MagnifyTool, AdvancedMagnifyTool, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, OrientationControllerTool, SculptorTool, SegmentSelectTool, VolumeRotateTool, RegionSegmentTool, RegionSegmentPlusTool, WholeBodySegmentTool, LabelmapBaseTool, SegmentBidirectionalTool, SegmentLabelTool, LabelMapEditWithContourTool, strategies, };
@@ -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,6 @@
1
+ export declare function calculateAdaptiveSphereRadius(diagonal: number, config: {
2
+ sphereRadius?: number;
3
+ sphereRadiusScale?: number;
4
+ minSphereRadius?: number;
5
+ maxSphereRadius?: number;
6
+ }): number;
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ export { addLine3DBetweenPoints } from './addLine3DBetweenPoints';
2
+ export { calculateAdaptiveSphereRadius } from './calculateAdaptiveSphereRadius';
@@ -0,0 +1,2 @@
1
+ export { addLine3DBetweenPoints } from './addLine3DBetweenPoints';
2
+ export { calculateAdaptiveSphereRadius } from './calculateAdaptiveSphereRadius';
@@ -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,2 @@
1
+ import type { ClippingPlane } from './types';
2
+ export declare function copyClippingPlanes(planes: ClippingPlane[]): ClippingPlane[];
@@ -0,0 +1,6 @@
1
+ export function copyClippingPlanes(planes) {
2
+ return planes.map((plane) => ({
3
+ origin: [...plane.origin],
4
+ normal: [...plane.normal],
5
+ }));
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,5 @@
1
+ import type { Types } from '@cornerstonejs/core';
2
+ export declare function findLineBoundsIntersection(linePoint: Types.Point3, lineDirection: Types.Point3, viewport: Types.IViewport): {
3
+ start: Types.Point2;
4
+ end: Types.Point2;
5
+ } | null;
@@ -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,2 @@
1
+ import type { Types } from '@cornerstonejs/core';
2
+ export declare function getOrientationFromNormal(normal: Types.Point3): 'AXIAL' | 'CORONAL' | 'SAGITTAL' | null;
@@ -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,8 @@
1
+ export declare function parseCornerKey(uid: string): {
2
+ isXMin: boolean;
3
+ isXMax: boolean;
4
+ isYMin: boolean;
5
+ isYMax: boolean;
6
+ isZMin: boolean;
7
+ isZMax: boolean;
8
+ };
@@ -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
+ }
@@ -0,0 +1,5 @@
1
+ import type { Types } from '@cornerstonejs/core';
2
+ export type ClippingPlane = {
3
+ origin: Types.Point3;
4
+ normal: Types.Point3;
5
+ };
File without changes
@@ -0,0 +1,31 @@
1
+ export function extend(publicAPI: any, model: any, initialValues?: {}): void;
2
+ export namespace DEFAULT_VALUES {
3
+ namespace defaultStyle {
4
+ let text: string;
5
+ let faceColor: string;
6
+ let faceRotation: number;
7
+ let fontFamily: string;
8
+ let fontColor: string;
9
+ let fontStyle: string;
10
+ function fontSizeScale(resolution: any): number;
11
+ let edgeThickness: number;
12
+ let edgeColor: string;
13
+ let resolution: number;
14
+ }
15
+ let xPlusFaceProperty: {};
16
+ let xMinusFaceProperty: {};
17
+ let yPlusFaceProperty: {};
18
+ let yMinusFaceProperty: {};
19
+ let zPlusFaceProperty: {};
20
+ let zMinusFaceProperty: {};
21
+ let showMainFaces: boolean;
22
+ let showEdgeFaces: boolean;
23
+ let showCornerFaces: boolean;
24
+ let scale: number;
25
+ }
26
+ export const newInstance: any;
27
+ declare namespace _default {
28
+ export { newInstance };
29
+ export { extend };
30
+ }
31
+ export default _default;