@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.
@@ -28034,6 +28034,130 @@ Bidirectional$4.isValidCornerstoneTrackingIdentifier = function (TrackingIdentif
28034
28034
 
28035
28035
  MeasurementReport$4.registerTool(Bidirectional$4);
28036
28036
 
28037
+ var TID300CobbAngle$2 = utilities.TID300.CobbAngle;
28038
+ var MEASUREMENT_TYPE = "CobbAngle";
28039
+ var trackingIdentifierTextValue$8 = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(MEASUREMENT_TYPE);
28040
+
28041
+ var CobbAngle$3 = /*#__PURE__*/function () {
28042
+ function CobbAngle() {
28043
+ _classCallCheck(this, CobbAngle);
28044
+ }
28045
+
28046
+ _createClass(CobbAngle, null, [{
28047
+ key: "getMeasurementData",
28048
+ value: // TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport.
28049
+ function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
28050
+ var _MeasurementReport$ge = MeasurementReport$4.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, CobbAngle.toolType),
28051
+ defaultState = _MeasurementReport$ge.defaultState,
28052
+ NUMGroup = _MeasurementReport$ge.NUMGroup,
28053
+ SCOORDGroup = _MeasurementReport$ge.SCOORDGroup,
28054
+ ReferencedFrameNumber = _MeasurementReport$ge.ReferencedFrameNumber;
28055
+
28056
+ var referencedImageId = defaultState.annotation.metadata.referencedImageId;
28057
+ var GraphicData = SCOORDGroup.GraphicData;
28058
+ var worldCoords = [];
28059
+
28060
+ for (var i = 0; i < GraphicData.length; i += 2) {
28061
+ var point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
28062
+ worldCoords.push(point);
28063
+ }
28064
+
28065
+ var state = defaultState;
28066
+ state.annotation.data = {
28067
+ handles: {
28068
+ points: [worldCoords[0], worldCoords[1], worldCoords[2], worldCoords[3]],
28069
+ activeHandleIndex: 0,
28070
+ textBox: {
28071
+ hasMoved: false
28072
+ }
28073
+ },
28074
+ cachedStats: _defineProperty({}, "imageId:".concat(referencedImageId), {
28075
+ angle: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : null
28076
+ }),
28077
+ frameNumber: ReferencedFrameNumber
28078
+ };
28079
+ return state;
28080
+ }
28081
+ }, {
28082
+ key: "getTID300RepresentationArguments",
28083
+ value: function getTID300RepresentationArguments(tool, worldToImageCoords) {
28084
+ var data = tool.data,
28085
+ finding = tool.finding,
28086
+ findingSites = tool.findingSites,
28087
+ metadata = tool.metadata;
28088
+ var _data$cachedStats = data.cachedStats,
28089
+ cachedStats = _data$cachedStats === void 0 ? {} : _data$cachedStats,
28090
+ handles = data.handles;
28091
+ var referencedImageId = metadata.referencedImageId;
28092
+
28093
+ if (!referencedImageId) {
28094
+ throw new Error("CobbAngle.getTID300RepresentationArguments: referencedImageId is not defined");
28095
+ }
28096
+
28097
+ var start1 = worldToImageCoords(referencedImageId, handles.points[0]);
28098
+ var end1 = worldToImageCoords(referencedImageId, handles.points[1]);
28099
+ var start2 = worldToImageCoords(referencedImageId, handles.points[2]);
28100
+ var end2 = worldToImageCoords(referencedImageId, handles.points[3]);
28101
+ var point1 = {
28102
+ x: start1[0],
28103
+ y: start1[1]
28104
+ };
28105
+ var point2 = {
28106
+ x: end1[0],
28107
+ y: end1[1]
28108
+ };
28109
+ var point3 = {
28110
+ x: start2[0],
28111
+ y: start2[1]
28112
+ };
28113
+ var point4 = {
28114
+ x: end2[0],
28115
+ y: end2[1]
28116
+ };
28117
+
28118
+ var _ref = cachedStats["imageId:".concat(referencedImageId)] || {},
28119
+ angle = _ref.angle;
28120
+
28121
+ return {
28122
+ point1: point1,
28123
+ point2: point2,
28124
+ point3: point3,
28125
+ point4: point4,
28126
+ rAngle: angle,
28127
+ trackingIdentifierTextValue: trackingIdentifierTextValue$8,
28128
+ finding: finding,
28129
+ findingSites: findingSites || []
28130
+ };
28131
+ }
28132
+ }]);
28133
+
28134
+ return CobbAngle;
28135
+ }();
28136
+
28137
+ CobbAngle$3.toolType = MEASUREMENT_TYPE;
28138
+ CobbAngle$3.utilityToolType = MEASUREMENT_TYPE;
28139
+ console.log("TID300CobbAngle=", TID300CobbAngle$2);
28140
+ CobbAngle$3.TID300Representation = TID300CobbAngle$2;
28141
+
28142
+ CobbAngle$3.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
28143
+ if (!TrackingIdentifier.includes(":")) {
28144
+ return false;
28145
+ }
28146
+
28147
+ var _TrackingIdentifier$s = TrackingIdentifier.split(":"),
28148
+ _TrackingIdentifier$s2 = _slicedToArray(_TrackingIdentifier$s, 2),
28149
+ cornerstone3DTag = _TrackingIdentifier$s2[0],
28150
+ toolType = _TrackingIdentifier$s2[1];
28151
+
28152
+ if (cornerstone3DTag !== CORNERSTONE_3D_TAG$1) {
28153
+ return false;
28154
+ }
28155
+
28156
+ return toolType === MEASUREMENT_TYPE;
28157
+ };
28158
+
28159
+ MeasurementReport$4.registerTool(CobbAngle$3);
28160
+
28037
28161
  /**
28038
28162
  * Common utilities
28039
28163
  * @module glMatrix
@@ -29326,7 +29450,7 @@ var forEach$5 = function () {
29326
29450
  var TID300Ellipse$1 = utilities.TID300.Ellipse;
29327
29451
  var ELLIPTICALROI$3 = "EllipticalROI";
29328
29452
  var EPSILON$3 = 1e-4;
29329
- var trackingIdentifierTextValue$8 = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(ELLIPTICALROI$3);
29453
+ var trackingIdentifierTextValue$9 = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(ELLIPTICALROI$3);
29330
29454
 
29331
29455
  var EllipticalROI$1 = /*#__PURE__*/function () {
29332
29456
  function EllipticalROI() {
@@ -29476,7 +29600,7 @@ var EllipticalROI$1 = /*#__PURE__*/function () {
29476
29600
  return {
29477
29601
  area: area,
29478
29602
  points: points,
29479
- trackingIdentifierTextValue: trackingIdentifierTextValue$8,
29603
+ trackingIdentifierTextValue: trackingIdentifierTextValue$9,
29480
29604
  finding: finding,
29481
29605
  findingSites: findingSites || []
29482
29606
  };
@@ -29513,7 +29637,7 @@ MeasurementReport$4.registerTool(EllipticalROI$1);
29513
29637
 
29514
29638
  var TID300Length$1 = utilities.TID300.Length;
29515
29639
  var LENGTH$4 = "Length";
29516
- var trackingIdentifierTextValue$9 = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(LENGTH$4);
29640
+ var trackingIdentifierTextValue$a = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(LENGTH$4);
29517
29641
 
29518
29642
  var Length$4 = /*#__PURE__*/function () {
29519
29643
  function Length() {
@@ -29589,7 +29713,7 @@ var Length$4 = /*#__PURE__*/function () {
29589
29713
  point1: point1,
29590
29714
  point2: point2,
29591
29715
  distance: distance,
29592
- trackingIdentifierTextValue: trackingIdentifierTextValue$9,
29716
+ trackingIdentifierTextValue: trackingIdentifierTextValue$a,
29593
29717
  finding: finding,
29594
29718
  findingSites: findingSites || []
29595
29719
  };
@@ -29624,7 +29748,7 @@ MeasurementReport$4.registerTool(Length$4);
29624
29748
 
29625
29749
  var TID300Polyline$2 = utilities.TID300.Polyline;
29626
29750
  var PLANARFREEHANDROI$1 = "PlanarFreehandROI";
29627
- var trackingIdentifierTextValue$a = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(PLANARFREEHANDROI$1);
29751
+ var trackingIdentifierTextValue$b = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(PLANARFREEHANDROI$1);
29628
29752
  var closedContourThreshold$1 = 1e-5;
29629
29753
 
29630
29754
  var PlanarFreehandROI$1 = /*#__PURE__*/function () {
@@ -29712,7 +29836,7 @@ var PlanarFreehandROI$1 = /*#__PURE__*/function () {
29712
29836
  points: points,
29713
29837
  area: area,
29714
29838
  perimeter: perimeter,
29715
- trackingIdentifierTextValue: trackingIdentifierTextValue$a,
29839
+ trackingIdentifierTextValue: trackingIdentifierTextValue$b,
29716
29840
  finding: finding,
29717
29841
  findingSites: findingSites || []
29718
29842
  };
@@ -29747,7 +29871,7 @@ MeasurementReport$4.registerTool(PlanarFreehandROI$1);
29747
29871
 
29748
29872
  var TID300Point$2 = utilities.TID300.Point;
29749
29873
  var PROBE$1 = "Probe";
29750
- var trackingIdentifierTextValue$b = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(PROBE$1);
29874
+ var trackingIdentifierTextValue$c = "".concat(CORNERSTONE_3D_TAG$1, ":").concat(PROBE$1);
29751
29875
 
29752
29876
  var Probe$1 = /*#__PURE__*/function () {
29753
29877
  function Probe() {
@@ -29807,7 +29931,7 @@ var Probe$1 = /*#__PURE__*/function () {
29807
29931
  });
29808
29932
  var TID300RepresentationArguments = {
29809
29933
  points: pointsImage,
29810
- trackingIdentifierTextValue: trackingIdentifierTextValue$b,
29934
+ trackingIdentifierTextValue: trackingIdentifierTextValue$c,
29811
29935
  findingSites: findingSites || [],
29812
29936
  finding: finding
29813
29937
  };
@@ -29843,6 +29967,7 @@ MeasurementReport$4.registerTool(Probe$1);
29843
29967
 
29844
29968
  var Cornerstone3D = {
29845
29969
  Bidirectional: Bidirectional$4,
29970
+ CobbAngle: CobbAngle$3,
29846
29971
  Length: Length$4,
29847
29972
  EllipticalROI: EllipticalROI$1,
29848
29973
  ArrowAnnotate: ArrowAnnotate$3,