@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.
Files changed (108) hide show
  1. package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +6 -1
  2. package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -1
  3. package/dist/cjs/types/ContourSegmentationAnnotation.d.ts +5 -0
  4. package/dist/cjs/types/IToolGroup.d.ts +3 -1
  5. package/dist/cjs/types/ToolSpecificAnnotationTypes.d.ts +2 -1
  6. package/dist/cjs/utilities/contours/generateContourSetsFromLabelmap.js +1 -8
  7. package/dist/cjs/utilities/contours/generateContourSetsFromLabelmap.js.map +1 -1
  8. package/dist/cjs/utilities/contours/interpolation/getInterpolationData.js +15 -2
  9. package/dist/cjs/utilities/contours/interpolation/getInterpolationData.js.map +1 -1
  10. package/dist/cjs/utilities/contours/interpolation/interpolate.js +1 -4
  11. package/dist/cjs/utilities/contours/interpolation/interpolate.js.map +1 -1
  12. package/dist/cjs/utilities/contours/interpolation/selectHandles.js +2 -3
  13. package/dist/cjs/utilities/contours/interpolation/selectHandles.js.map +1 -1
  14. package/dist/cjs/utilities/math/line/index.d.ts +2 -1
  15. package/dist/cjs/utilities/math/line/index.js +3 -1
  16. package/dist/cjs/utilities/math/line/index.js.map +1 -1
  17. package/dist/cjs/utilities/math/line/isPointOnLineSegment.d.ts +2 -0
  18. package/dist/cjs/utilities/math/line/isPointOnLineSegment.js +22 -0
  19. package/dist/cjs/utilities/math/line/isPointOnLineSegment.js.map +1 -0
  20. package/dist/cjs/utilities/math/polyline/combinePolyline.js +2 -2
  21. package/dist/cjs/utilities/math/polyline/combinePolyline.js.map +1 -1
  22. package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js +2 -2
  23. package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js.map +1 -1
  24. package/dist/cjs/utilities/math/polyline/getLinesIntersection.d.ts +2 -0
  25. package/dist/cjs/utilities/math/polyline/getLinesIntersection.js +78 -0
  26. package/dist/cjs/utilities/math/polyline/getLinesIntersection.js.map +1 -0
  27. package/dist/cjs/utilities/segmentation/InterpolationManager/InterpolationManager.js +30 -12
  28. package/dist/cjs/utilities/segmentation/InterpolationManager/InterpolationManager.js.map +1 -1
  29. package/dist/cjs/utilities/segmentation/createBidirectionalToolData.d.ts +1 -1
  30. package/dist/cjs/utilities/segmentation/createBidirectionalToolData.js +2 -9
  31. package/dist/cjs/utilities/segmentation/createBidirectionalToolData.js.map +1 -1
  32. package/dist/cjs/utilities/segmentation/segmentContourAction.js +2 -3
  33. package/dist/cjs/utilities/segmentation/segmentContourAction.js.map +1 -1
  34. package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +6 -0
  35. package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -1
  36. package/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js +1 -8
  37. package/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js.map +1 -1
  38. package/dist/esm/utilities/contours/interpolation/getInterpolationData.js +15 -2
  39. package/dist/esm/utilities/contours/interpolation/getInterpolationData.js.map +1 -1
  40. package/dist/esm/utilities/contours/interpolation/interpolate.js +1 -4
  41. package/dist/esm/utilities/contours/interpolation/interpolate.js.map +1 -1
  42. package/dist/esm/utilities/contours/interpolation/selectHandles.js +2 -3
  43. package/dist/esm/utilities/contours/interpolation/selectHandles.js.map +1 -1
  44. package/dist/esm/utilities/math/line/index.js +2 -1
  45. package/dist/esm/utilities/math/line/index.js.map +1 -1
  46. package/dist/esm/utilities/math/line/isPointOnLineSegment.js +19 -0
  47. package/dist/esm/utilities/math/line/isPointOnLineSegment.js.map +1 -0
  48. package/dist/esm/utilities/math/polyline/combinePolyline.js +2 -2
  49. package/dist/esm/utilities/math/polyline/combinePolyline.js.map +1 -1
  50. package/dist/esm/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js +2 -2
  51. package/dist/esm/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js.map +1 -1
  52. package/dist/esm/utilities/math/polyline/getLinesIntersection.js +52 -0
  53. package/dist/esm/utilities/math/polyline/getLinesIntersection.js.map +1 -0
  54. package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js +30 -12
  55. package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js.map +1 -1
  56. package/dist/esm/utilities/segmentation/createBidirectionalToolData.js +2 -6
  57. package/dist/esm/utilities/segmentation/createBidirectionalToolData.js.map +1 -1
  58. package/dist/esm/utilities/segmentation/segmentContourAction.js +2 -3
  59. package/dist/esm/utilities/segmentation/segmentContourAction.js.map +1 -1
  60. package/dist/types/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts.map +1 -1
  61. package/dist/types/types/ContourSegmentationAnnotation.d.ts +5 -0
  62. package/dist/types/types/ContourSegmentationAnnotation.d.ts.map +1 -1
  63. package/dist/types/types/IToolGroup.d.ts +3 -1
  64. package/dist/types/types/IToolGroup.d.ts.map +1 -1
  65. package/dist/types/types/ToolSpecificAnnotationTypes.d.ts +2 -1
  66. package/dist/types/types/ToolSpecificAnnotationTypes.d.ts.map +1 -1
  67. package/dist/types/utilities/contours/generateContourSetsFromLabelmap.d.ts.map +1 -1
  68. package/dist/types/utilities/contours/interpolation/getInterpolationData.d.ts.map +1 -1
  69. package/dist/types/utilities/contours/interpolation/interpolate.d.ts.map +1 -1
  70. package/dist/types/utilities/contours/interpolation/selectHandles.d.ts.map +1 -1
  71. package/dist/types/utilities/math/line/index.d.ts +2 -1
  72. package/dist/types/utilities/math/line/index.d.ts.map +1 -1
  73. package/dist/types/utilities/math/line/isPointOnLineSegment.d.ts +3 -0
  74. package/dist/types/utilities/math/line/isPointOnLineSegment.d.ts.map +1 -0
  75. package/dist/types/utilities/math/polyline/combinePolyline.d.ts.map +1 -1
  76. package/dist/types/utilities/math/polyline/getLinesIntersection.d.ts +3 -0
  77. package/dist/types/utilities/math/polyline/getLinesIntersection.d.ts.map +1 -0
  78. package/dist/types/utilities/segmentation/InterpolationManager/InterpolationManager.d.ts.map +1 -1
  79. package/dist/types/utilities/segmentation/createBidirectionalToolData.d.ts +1 -1
  80. package/dist/types/utilities/segmentation/createBidirectionalToolData.d.ts.map +1 -1
  81. package/dist/types/utilities/segmentation/segmentContourAction.d.ts.map +1 -1
  82. package/dist/umd/index.js +1 -1
  83. package/dist/umd/index.js.map +1 -1
  84. package/package.json +3 -3
  85. package/src/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.ts +8 -0
  86. package/src/types/ContourSegmentationAnnotation.ts +6 -0
  87. package/src/types/IToolGroup.ts +1 -1
  88. package/src/types/ToolSpecificAnnotationTypes.ts +18 -11
  89. package/src/utilities/contours/generateContourSetsFromLabelmap.ts +1 -10
  90. package/src/utilities/contours/interpolation/getInterpolationData.ts +24 -5
  91. package/src/utilities/contours/interpolation/interpolate.ts +1 -5
  92. package/src/utilities/contours/interpolation/selectHandles.ts +9 -4
  93. package/src/utilities/math/line/index.ts +2 -0
  94. package/src/utilities/math/line/isPointOnLineSegment.ts +44 -0
  95. package/src/utilities/math/polyline/combinePolyline.ts +5 -7
  96. package/src/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.ts +2 -2
  97. package/src/utilities/math/polyline/getLinesIntersection.ts +94 -0
  98. package/src/utilities/segmentation/InterpolationManager/InterpolationManager.ts +52 -14
  99. package/src/utilities/segmentation/createBidirectionalToolData.ts +5 -13
  100. package/src/utilities/segmentation/segmentContourAction.ts +2 -5
  101. package/dist/cjs/utilities/math/polyline/getLineSegmentsIntersection.d.ts +0 -2
  102. package/dist/cjs/utilities/math/polyline/getLineSegmentsIntersection.js +0 -21
  103. package/dist/cjs/utilities/math/polyline/getLineSegmentsIntersection.js.map +0 -1
  104. package/dist/esm/utilities/math/polyline/getLineSegmentsIntersection.js +0 -18
  105. package/dist/esm/utilities/math/polyline/getLineSegmentsIntersection.js.map +0 -1
  106. package/dist/types/utilities/math/polyline/getLineSegmentsIntersection.d.ts +0 -3
  107. package/dist/types/utilities/math/polyline/getLineSegmentsIntersection.d.ts.map +0 -1
  108. 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 { referencedImageId } = newBidirectional;
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 - imageIndex,
133
+ imageIndex: imageIds.length - 1 - sliceIndex,
137
134
  });
138
135
  enabledElement.viewport.render();
139
136
  } else {
@@ -1,2 +0,0 @@
1
- import { Types } from '@cornerstonejs/core';
2
- export default function getLineSegmentsIntersection(p1: Types.Point2, q1: Types.Point2, p2: Types.Point2, q2: Types.Point2): Types.Point2;
@@ -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":["../../../../../src/utilities/math/polyline/getLineSegmentsIntersection.ts"],"names":[],"mappings":";;AAqBA,SAAwB,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,CAAC,CAAC,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,MAAM,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE1E,IAAI,WAAW,IAAI,CAAC,EAAE;QACpB,OAAO;KACR;IAED,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IACtB,MAAM,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACrD,CAAC,GAAG,UAAU,GAAG,WAAW,CAAC;IAC7B,CAAC,GAAG,UAAU,GAAG,WAAW,CAAC;IAE7B,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,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,CAAC,CAAC,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,MAAM,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE1E,IAAI,WAAW,IAAI,CAAC,EAAE;QACpB,OAAO;KACR;IAED,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IACtB,MAAM,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACrD,CAAC,GAAG,UAAU,GAAG,WAAW,CAAC;IAC7B,CAAC,GAAG,UAAU,GAAG,WAAW,CAAC;IAE7B,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAExC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5B,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Types } from '@cornerstonejs/core';
2
- export default function getLineSegmentsIntersection(p1: Types.Point2, q1: Types.Point2, p2: Types.Point2, q2: Types.Point2): Types.Point2;
3
- //# sourceMappingURL=getLineSegmentsIntersection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getLineSegmentsIntersection.d.ts","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/getLineSegmentsIntersection.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
- }