@cornerstonejs/tools 1.58.1 → 1.58.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/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +6 -1
- package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -1
- package/dist/cjs/types/ContourSegmentationAnnotation.d.ts +5 -0
- package/dist/cjs/types/IToolGroup.d.ts +3 -1
- package/dist/cjs/types/ToolSpecificAnnotationTypes.d.ts +2 -1
- package/dist/cjs/utilities/contours/generateContourSetsFromLabelmap.js +1 -8
- package/dist/cjs/utilities/contours/generateContourSetsFromLabelmap.js.map +1 -1
- package/dist/cjs/utilities/contours/interpolation/getInterpolationData.js +15 -2
- package/dist/cjs/utilities/contours/interpolation/getInterpolationData.js.map +1 -1
- package/dist/cjs/utilities/contours/interpolation/interpolate.js +1 -4
- package/dist/cjs/utilities/contours/interpolation/interpolate.js.map +1 -1
- package/dist/cjs/utilities/contours/interpolation/selectHandles.js +2 -3
- package/dist/cjs/utilities/contours/interpolation/selectHandles.js.map +1 -1
- package/dist/cjs/utilities/math/line/index.d.ts +2 -1
- package/dist/cjs/utilities/math/line/index.js +3 -1
- package/dist/cjs/utilities/math/line/index.js.map +1 -1
- package/dist/cjs/utilities/math/line/isPointOnLineSegment.d.ts +2 -0
- package/dist/cjs/utilities/math/line/isPointOnLineSegment.js +22 -0
- package/dist/cjs/utilities/math/line/isPointOnLineSegment.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/combinePolyline.js +2 -2
- package/dist/cjs/utilities/math/polyline/combinePolyline.js.map +1 -1
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js +2 -2
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js.map +1 -1
- package/dist/cjs/utilities/math/polyline/getLinesIntersection.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getLinesIntersection.js +78 -0
- package/dist/cjs/utilities/math/polyline/getLinesIntersection.js.map +1 -0
- package/dist/cjs/utilities/segmentation/InterpolationManager/InterpolationManager.js +30 -12
- package/dist/cjs/utilities/segmentation/InterpolationManager/InterpolationManager.js.map +1 -1
- package/dist/cjs/utilities/segmentation/createBidirectionalToolData.d.ts +1 -1
- package/dist/cjs/utilities/segmentation/createBidirectionalToolData.js +2 -9
- package/dist/cjs/utilities/segmentation/createBidirectionalToolData.js.map +1 -1
- package/dist/cjs/utilities/segmentation/segmentContourAction.js +2 -3
- package/dist/cjs/utilities/segmentation/segmentContourAction.js.map +1 -1
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +6 -0
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -1
- package/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js +1 -8
- package/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js.map +1 -1
- package/dist/esm/utilities/contours/interpolation/getInterpolationData.js +15 -2
- package/dist/esm/utilities/contours/interpolation/getInterpolationData.js.map +1 -1
- package/dist/esm/utilities/contours/interpolation/interpolate.js +1 -4
- package/dist/esm/utilities/contours/interpolation/interpolate.js.map +1 -1
- package/dist/esm/utilities/contours/interpolation/selectHandles.js +2 -3
- package/dist/esm/utilities/contours/interpolation/selectHandles.js.map +1 -1
- package/dist/esm/utilities/math/line/index.js +2 -1
- package/dist/esm/utilities/math/line/index.js.map +1 -1
- package/dist/esm/utilities/math/line/isPointOnLineSegment.js +19 -0
- package/dist/esm/utilities/math/line/isPointOnLineSegment.js.map +1 -0
- package/dist/esm/utilities/math/polyline/combinePolyline.js +2 -2
- package/dist/esm/utilities/math/polyline/combinePolyline.js.map +1 -1
- package/dist/esm/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js +2 -2
- package/dist/esm/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js.map +1 -1
- package/dist/esm/utilities/math/polyline/getLinesIntersection.js +52 -0
- package/dist/esm/utilities/math/polyline/getLinesIntersection.js.map +1 -0
- package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js +30 -12
- package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js.map +1 -1
- package/dist/esm/utilities/segmentation/createBidirectionalToolData.js +2 -6
- package/dist/esm/utilities/segmentation/createBidirectionalToolData.js.map +1 -1
- package/dist/esm/utilities/segmentation/segmentContourAction.js +2 -3
- package/dist/esm/utilities/segmentation/segmentContourAction.js.map +1 -1
- package/dist/types/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts.map +1 -1
- package/dist/types/types/ContourSegmentationAnnotation.d.ts +5 -0
- package/dist/types/types/ContourSegmentationAnnotation.d.ts.map +1 -1
- package/dist/types/types/IToolGroup.d.ts +3 -1
- package/dist/types/types/IToolGroup.d.ts.map +1 -1
- package/dist/types/types/ToolSpecificAnnotationTypes.d.ts +2 -1
- package/dist/types/types/ToolSpecificAnnotationTypes.d.ts.map +1 -1
- package/dist/types/utilities/contours/generateContourSetsFromLabelmap.d.ts.map +1 -1
- package/dist/types/utilities/contours/interpolation/getInterpolationData.d.ts.map +1 -1
- package/dist/types/utilities/contours/interpolation/interpolate.d.ts.map +1 -1
- package/dist/types/utilities/contours/interpolation/selectHandles.d.ts.map +1 -1
- package/dist/types/utilities/math/line/index.d.ts +2 -1
- package/dist/types/utilities/math/line/index.d.ts.map +1 -1
- package/dist/types/utilities/math/line/isPointOnLineSegment.d.ts +3 -0
- package/dist/types/utilities/math/line/isPointOnLineSegment.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/combinePolyline.d.ts.map +1 -1
- package/dist/types/utilities/math/polyline/getLinesIntersection.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getLinesIntersection.d.ts.map +1 -0
- package/dist/types/utilities/segmentation/InterpolationManager/InterpolationManager.d.ts.map +1 -1
- package/dist/types/utilities/segmentation/createBidirectionalToolData.d.ts +1 -1
- package/dist/types/utilities/segmentation/createBidirectionalToolData.d.ts.map +1 -1
- package/dist/types/utilities/segmentation/segmentContourAction.d.ts.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.ts +8 -0
- package/src/types/ContourSegmentationAnnotation.ts +6 -0
- package/src/types/IToolGroup.ts +1 -1
- package/src/types/ToolSpecificAnnotationTypes.ts +18 -11
- package/src/utilities/contours/generateContourSetsFromLabelmap.ts +1 -10
- package/src/utilities/contours/interpolation/getInterpolationData.ts +24 -5
- package/src/utilities/contours/interpolation/interpolate.ts +1 -5
- package/src/utilities/contours/interpolation/selectHandles.ts +9 -4
- package/src/utilities/math/line/index.ts +2 -0
- package/src/utilities/math/line/isPointOnLineSegment.ts +44 -0
- package/src/utilities/math/polyline/combinePolyline.ts +5 -7
- package/src/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.ts +2 -2
- package/src/utilities/math/polyline/getLinesIntersection.ts +94 -0
- package/src/utilities/segmentation/InterpolationManager/InterpolationManager.ts +52 -14
- package/src/utilities/segmentation/createBidirectionalToolData.ts +5 -13
- package/src/utilities/segmentation/segmentContourAction.ts +2 -5
- package/dist/cjs/utilities/math/polyline/getLineSegmentsIntersection.d.ts +0 -2
- package/dist/cjs/utilities/math/polyline/getLineSegmentsIntersection.js +0 -21
- package/dist/cjs/utilities/math/polyline/getLineSegmentsIntersection.js.map +0 -1
- package/dist/esm/utilities/math/polyline/getLineSegmentsIntersection.js +0 -18
- package/dist/esm/utilities/math/polyline/getLineSegmentsIntersection.js.map +0 -1
- package/dist/types/utilities/math/polyline/getLineSegmentsIntersection.d.ts +0 -3
- package/dist/types/utilities/math/polyline/getLineSegmentsIntersection.d.ts.map +0 -1
- package/src/utilities/math/polyline/getLineSegmentsIntersection.ts +0 -47
|
@@ -125,15 +125,12 @@ export default function segmentContourAction(
|
|
|
125
125
|
});
|
|
126
126
|
|
|
127
127
|
if (newBidirectional) {
|
|
128
|
-
const {
|
|
128
|
+
const { sliceIndex } = newBidirectional;
|
|
129
129
|
const imageIds = enabledElement.viewport.getImageIds();
|
|
130
|
-
const imageIndex = imageIds.findIndex(
|
|
131
|
-
(imageId) => imageId === referencedImageId
|
|
132
|
-
);
|
|
133
130
|
|
|
134
131
|
// TODO - figure out why this is reversed
|
|
135
132
|
jumpToSlice(element, {
|
|
136
|
-
imageIndex: imageIds.length - 1 -
|
|
133
|
+
imageIndex: imageIds.length - 1 - sliceIndex,
|
|
137
134
|
});
|
|
138
135
|
enabledElement.viewport.render();
|
|
139
136
|
} else {
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function getLineSegmentsIntersection(p1, q1, p2, q2) {
|
|
4
|
-
const diffQ1P1 = [q1[0] - p1[0], q1[1] - p1[1]];
|
|
5
|
-
const diffQ2P2 = [q2[0] - p2[0], q2[1] - p2[1]];
|
|
6
|
-
const denominator = diffQ2P2[1] * diffQ1P1[0] - diffQ2P2[0] * diffQ1P1[1];
|
|
7
|
-
if (denominator == 0) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
let a = p1[1] - p2[1];
|
|
11
|
-
let b = p1[0] - p2[0];
|
|
12
|
-
const numerator1 = diffQ2P2[0] * a - diffQ2P2[1] * b;
|
|
13
|
-
const numerator2 = diffQ1P1[0] * a - diffQ1P1[1] * b;
|
|
14
|
-
a = numerator1 / denominator;
|
|
15
|
-
b = numerator2 / denominator;
|
|
16
|
-
const resultX = p1[0] + a * diffQ1P1[0];
|
|
17
|
-
const resultY = p1[1] + a * diffQ1P1[1];
|
|
18
|
-
return [resultX, resultY];
|
|
19
|
-
}
|
|
20
|
-
exports.default = getLineSegmentsIntersection;
|
|
21
|
-
//# sourceMappingURL=getLineSegmentsIntersection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getLineSegmentsIntersection.js","sourceRoot":"","sources":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AAM,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAExC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5B,CAAC;AAzBD,8CAyBC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export default function getLineSegmentsIntersection(p1, q1, p2, q2) {
|
|
2
|
-
const diffQ1P1 = [q1[0] - p1[0], q1[1] - p1[1]];
|
|
3
|
-
const diffQ2P2 = [q2[0] - p2[0], q2[1] - p2[1]];
|
|
4
|
-
const denominator = diffQ2P2[1] * diffQ1P1[0] - diffQ2P2[0] * diffQ1P1[1];
|
|
5
|
-
if (denominator == 0) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
let a = p1[1] - p2[1];
|
|
9
|
-
let b = p1[0] - p2[0];
|
|
10
|
-
const numerator1 = diffQ2P2[0] * a - diffQ2P2[1] * b;
|
|
11
|
-
const numerator2 = diffQ1P1[0] * a - diffQ1P1[1] * b;
|
|
12
|
-
a = numerator1 / denominator;
|
|
13
|
-
b = numerator2 / denominator;
|
|
14
|
-
const resultX = p1[0] + a * diffQ1P1[0];
|
|
15
|
-
const resultY = p1[1] + a * diffQ1P1[1];
|
|
16
|
-
return [resultX, resultY];
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=getLineSegmentsIntersection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getLineSegmentsIntersection.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/getLineSegmentsIntersection.ts"],"names":[],"mappings":"AAqBA,MAAM,CAAC,OAAO,UAAU,2BAA2B,CACjD,EAAgB,EAChB,EAAgB,EAChB,EAAgB,EAChB,EAAgB;IAEhB,MAAM,QAAQ,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,C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sIntersection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAqB5C,MAAM,CAAC,OAAO,UAAU,2BAA2B,CACjD,EAAE,EAAE,KAAK,CAAC,MAAM,EAChB,EAAE,EAAE,KAAK,CAAC,MAAM,EAChB,EAAE,EAAE,KAAK,CAAC,MAAM,EAChB,EAAE,EAAE,KAAK,CAAC,MAAM,GACf,KAAK,CAAC,MAAM,CAoBd"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Types } from '@cornerstonejs/core';
|
|
2
|
-
|
|
3
|
-
// ATTENTION: this is an internal function and it should not be added to "polyline"
|
|
4
|
-
// namespace because there is another one from lineSegment.intersectLine that also
|
|
5
|
-
// finds an intersection between two line segments. This one should be removed but
|
|
6
|
-
// it is faster and able to find intersections when the intersection is one of the
|
|
7
|
-
// two points of a line segment.
|
|
8
|
-
//
|
|
9
|
-
// Example:
|
|
10
|
-
// Line 1: (0, 0), (1, 1) x Line 2 (1, 1), (1, 2)
|
|
11
|
-
// Line 1: (0, 1), (2, 1) x Line 2 (1, 1), (1, 2)
|
|
12
|
-
//
|
|
13
|
-
// This function must replace `lineSegment.intersectLine` but it requires some
|
|
14
|
-
// tests first
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Gets the intersection between the line segments (`p1`,`q1`) and (`p2`,`q2`)
|
|
18
|
-
*
|
|
19
|
-
* http://jsfiddle.net/justin_c_rounds/Gd2S2/light/
|
|
20
|
-
* https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line
|
|
21
|
-
*/
|
|
22
|
-
export default function getLineSegmentsIntersection(
|
|
23
|
-
p1: Types.Point2,
|
|
24
|
-
q1: Types.Point2,
|
|
25
|
-
p2: Types.Point2,
|
|
26
|
-
q2: Types.Point2
|
|
27
|
-
): Types.Point2 {
|
|
28
|
-
const diffQ1P1 = [q1[0] - p1[0], q1[1] - p1[1]];
|
|
29
|
-
const diffQ2P2 = [q2[0] - p2[0], q2[1] - p2[1]];
|
|
30
|
-
const denominator = diffQ2P2[1] * diffQ1P1[0] - diffQ2P2[0] * diffQ1P1[1];
|
|
31
|
-
|
|
32
|
-
if (denominator == 0) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
let a = p1[1] - p2[1];
|
|
37
|
-
let b = p1[0] - p2[0];
|
|
38
|
-
const numerator1 = diffQ2P2[0] * a - diffQ2P2[1] * b;
|
|
39
|
-
const numerator2 = diffQ1P1[0] * a - diffQ1P1[1] * b;
|
|
40
|
-
a = numerator1 / denominator;
|
|
41
|
-
b = numerator2 / denominator;
|
|
42
|
-
|
|
43
|
-
const resultX = p1[0] + a * diffQ1P1[0];
|
|
44
|
-
const resultY = p1[1] + a * diffQ1P1[1];
|
|
45
|
-
|
|
46
|
-
return [resultX, resultY];
|
|
47
|
-
}
|