@cornerstonejs/adapters 0.1.5 → 0.2.0

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.
@@ -28040,6 +28040,130 @@ b" + i + "*=d\
28040
28040
 
28041
28041
  MeasurementReport$4.registerTool(Bidirectional$4);
28042
28042
 
28043
+ var TID300CobbAngle$2 = utilities.TID300.CobbAngle;
28044
+ var MEASUREMENT_TYPE = "CobbAngle";
28045
+ var trackingIdentifierTextValue$8 = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(MEASUREMENT_TYPE);
28046
+
28047
+ var CobbAngle$3 = /*#__PURE__*/function () {
28048
+ function CobbAngle() {
28049
+ _classCallCheck(this, CobbAngle);
28050
+ }
28051
+
28052
+ _createClass(CobbAngle, null, [{
28053
+ key: "getMeasurementData",
28054
+ value: // TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport.
28055
+ function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
28056
+ var _MeasurementReport$ge = MeasurementReport$4.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, CobbAngle.toolType),
28057
+ defaultState = _MeasurementReport$ge.defaultState,
28058
+ NUMGroup = _MeasurementReport$ge.NUMGroup,
28059
+ SCOORDGroup = _MeasurementReport$ge.SCOORDGroup,
28060
+ ReferencedFrameNumber = _MeasurementReport$ge.ReferencedFrameNumber;
28061
+
28062
+ var referencedImageId = defaultState.annotation.metadata.referencedImageId;
28063
+ var GraphicData = SCOORDGroup.GraphicData;
28064
+ var worldCoords = [];
28065
+
28066
+ for (var i = 0; i < GraphicData.length; i += 2) {
28067
+ var point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
28068
+ worldCoords.push(point);
28069
+ }
28070
+
28071
+ var state = defaultState;
28072
+ state.annotation.data = {
28073
+ handles: {
28074
+ points: [worldCoords[0], worldCoords[1], worldCoords[2], worldCoords[3]],
28075
+ activeHandleIndex: 0,
28076
+ textBox: {
28077
+ hasMoved: false
28078
+ }
28079
+ },
28080
+ cachedStats: _defineProperty({}, "imageId:".concat(referencedImageId), {
28081
+ angle: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : null
28082
+ }),
28083
+ frameNumber: ReferencedFrameNumber
28084
+ };
28085
+ return state;
28086
+ }
28087
+ }, {
28088
+ key: "getTID300RepresentationArguments",
28089
+ value: function getTID300RepresentationArguments(tool, worldToImageCoords) {
28090
+ var data = tool.data,
28091
+ finding = tool.finding,
28092
+ findingSites = tool.findingSites,
28093
+ metadata = tool.metadata;
28094
+ var _data$cachedStats = data.cachedStats,
28095
+ cachedStats = _data$cachedStats === void 0 ? {} : _data$cachedStats,
28096
+ handles = data.handles;
28097
+ var referencedImageId = metadata.referencedImageId;
28098
+
28099
+ if (!referencedImageId) {
28100
+ throw new Error("CobbAngle.getTID300RepresentationArguments: referencedImageId is not defined");
28101
+ }
28102
+
28103
+ var start1 = worldToImageCoords(referencedImageId, handles.points[0]);
28104
+ var end1 = worldToImageCoords(referencedImageId, handles.points[1]);
28105
+ var start2 = worldToImageCoords(referencedImageId, handles.points[2]);
28106
+ var end2 = worldToImageCoords(referencedImageId, handles.points[3]);
28107
+ var point1 = {
28108
+ x: start1[0],
28109
+ y: start1[1]
28110
+ };
28111
+ var point2 = {
28112
+ x: end1[0],
28113
+ y: end1[1]
28114
+ };
28115
+ var point3 = {
28116
+ x: start2[0],
28117
+ y: start2[1]
28118
+ };
28119
+ var point4 = {
28120
+ x: end2[0],
28121
+ y: end2[1]
28122
+ };
28123
+
28124
+ var _ref = cachedStats["imageId:".concat(referencedImageId)] || {},
28125
+ angle = _ref.angle;
28126
+
28127
+ return {
28128
+ point1: point1,
28129
+ point2: point2,
28130
+ point3: point3,
28131
+ point4: point4,
28132
+ rAngle: angle,
28133
+ trackingIdentifierTextValue: trackingIdentifierTextValue$8,
28134
+ finding: finding,
28135
+ findingSites: findingSites || []
28136
+ };
28137
+ }
28138
+ }]);
28139
+
28140
+ return CobbAngle;
28141
+ }();
28142
+
28143
+ CobbAngle$3.toolType = MEASUREMENT_TYPE;
28144
+ CobbAngle$3.utilityToolType = MEASUREMENT_TYPE;
28145
+ console.log("TID300CobbAngle=", TID300CobbAngle$2);
28146
+ CobbAngle$3.TID300Representation = TID300CobbAngle$2;
28147
+
28148
+ CobbAngle$3.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
28149
+ if (!TrackingIdentifier.includes(":")) {
28150
+ return false;
28151
+ }
28152
+
28153
+ var _TrackingIdentifier$s = TrackingIdentifier.split(":"),
28154
+ _TrackingIdentifier$s2 = _slicedToArray(_TrackingIdentifier$s, 2),
28155
+ cornerstone3DTag = _TrackingIdentifier$s2[0],
28156
+ toolType = _TrackingIdentifier$s2[1];
28157
+
28158
+ if (cornerstone3DTag !== CORNERSTONE_3D_TAG$1) {
28159
+ return false;
28160
+ }
28161
+
28162
+ return toolType === MEASUREMENT_TYPE;
28163
+ };
28164
+
28165
+ MeasurementReport$4.registerTool(CobbAngle$3);
28166
+
28043
28167
  /**
28044
28168
  * Common utilities
28045
28169
  * @module glMatrix
@@ -29332,7 +29456,7 @@ b" + i + "*=d\
29332
29456
  var TID300Ellipse$1 = utilities.TID300.Ellipse;
29333
29457
  var ELLIPTICALROI$3 = "EllipticalROI";
29334
29458
  var EPSILON$3 = 1e-4;
29335
- var trackingIdentifierTextValue$8 = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(ELLIPTICALROI$3);
29459
+ var trackingIdentifierTextValue$9 = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(ELLIPTICALROI$3);
29336
29460
 
29337
29461
  var EllipticalROI$1 = /*#__PURE__*/function () {
29338
29462
  function EllipticalROI() {
@@ -29482,7 +29606,7 @@ b" + i + "*=d\
29482
29606
  return {
29483
29607
  area: area,
29484
29608
  points: points,
29485
- trackingIdentifierTextValue: trackingIdentifierTextValue$8,
29609
+ trackingIdentifierTextValue: trackingIdentifierTextValue$9,
29486
29610
  finding: finding,
29487
29611
  findingSites: findingSites || []
29488
29612
  };
@@ -29519,7 +29643,7 @@ b" + i + "*=d\
29519
29643
 
29520
29644
  var TID300Length$1 = utilities.TID300.Length;
29521
29645
  var LENGTH$4 = "Length";
29522
- var trackingIdentifierTextValue$9 = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(LENGTH$4);
29646
+ var trackingIdentifierTextValue$a = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(LENGTH$4);
29523
29647
 
29524
29648
  var Length$4 = /*#__PURE__*/function () {
29525
29649
  function Length() {
@@ -29595,7 +29719,7 @@ b" + i + "*=d\
29595
29719
  point1: point1,
29596
29720
  point2: point2,
29597
29721
  distance: distance,
29598
- trackingIdentifierTextValue: trackingIdentifierTextValue$9,
29722
+ trackingIdentifierTextValue: trackingIdentifierTextValue$a,
29599
29723
  finding: finding,
29600
29724
  findingSites: findingSites || []
29601
29725
  };
@@ -29630,7 +29754,7 @@ b" + i + "*=d\
29630
29754
 
29631
29755
  var TID300Polyline$2 = utilities.TID300.Polyline;
29632
29756
  var PLANARFREEHANDROI$1 = "PlanarFreehandROI";
29633
- var trackingIdentifierTextValue$a = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(PLANARFREEHANDROI$1);
29757
+ var trackingIdentifierTextValue$b = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(PLANARFREEHANDROI$1);
29634
29758
  var closedContourThreshold$1 = 1e-5;
29635
29759
 
29636
29760
  var PlanarFreehandROI$1 = /*#__PURE__*/function () {
@@ -29718,7 +29842,7 @@ b" + i + "*=d\
29718
29842
  points: points,
29719
29843
  area: area,
29720
29844
  perimeter: perimeter,
29721
- trackingIdentifierTextValue: trackingIdentifierTextValue$a,
29845
+ trackingIdentifierTextValue: trackingIdentifierTextValue$b,
29722
29846
  finding: finding,
29723
29847
  findingSites: findingSites || []
29724
29848
  };
@@ -29753,7 +29877,7 @@ b" + i + "*=d\
29753
29877
 
29754
29878
  var TID300Point$2 = utilities.TID300.Point;
29755
29879
  var PROBE$1 = "Probe";
29756
- var trackingIdentifierTextValue$b = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(PROBE$1);
29880
+ var trackingIdentifierTextValue$c = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(PROBE$1);
29757
29881
 
29758
29882
  var Probe$1 = /*#__PURE__*/function () {
29759
29883
  function Probe() {
@@ -29813,7 +29937,7 @@ b" + i + "*=d\
29813
29937
  });
29814
29938
  var TID300RepresentationArguments = {
29815
29939
  points: pointsImage,
29816
- trackingIdentifierTextValue: trackingIdentifierTextValue$b,
29940
+ trackingIdentifierTextValue: trackingIdentifierTextValue$c,
29817
29941
  findingSites: findingSites || [],
29818
29942
  finding: finding
29819
29943
  };
@@ -29849,6 +29973,7 @@ b" + i + "*=d\
29849
29973
 
29850
29974
  var Cornerstone3D = {
29851
29975
  Bidirectional: Bidirectional$4,
29976
+ CobbAngle: CobbAngle$3,
29852
29977
  Length: Length$4,
29853
29978
  EllipticalROI: EllipticalROI$1,
29854
29979
  ArrowAnnotate: ArrowAnnotate$3,