dcmjs 0.47.1 → 0.48.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.
package/build/dcmjs.es.js CHANGED
@@ -12292,6 +12292,8 @@ var DerivedDataset = /*#__PURE__*/function () {
12292
12292
  o.ClinicalTrialTimePointID = options.ClinicalTrialTimePointID || "";
12293
12293
  o.ClinicalTrialCoordinatingCenterName = options.ClinicalTrialCoordinatingCenterName || "";
12294
12294
  o.ClinicalTrialSeriesID = options.ClinicalTrialSeriesID || "";
12295
+
12296
+ // TODO: Move ImageComments (0020,4000) to DerivedPixels since it is not part of the Enhanced SR IOD.
12295
12297
  o.ImageComments = options.ImageComments || "NOT FOR CLINICAL USE";
12296
12298
  o.ContentQualification = "RESEARCH";
12297
12299
  this.referencedDatasets = datasets; // list of one or more dicom-like object instances
@@ -13429,7 +13431,7 @@ var TID1500MeasurementReport = /*#__PURE__*/function () {
13429
13431
  CodeMeaning: "Language of Content Item and Descendants"
13430
13432
  }),
13431
13433
  ConceptCodeSequence: addAccessors({
13432
- CodeValue: "eng",
13434
+ CodeValue: "en",
13433
13435
  CodingSchemeDesignator: "RFC5646",
13434
13436
  CodeMeaning: "English"
13435
13437
  }),
@@ -13456,9 +13458,9 @@ var TID1500MeasurementReport = /*#__PURE__*/function () {
13456
13458
  CodeMeaning: "Procedure reported"
13457
13459
  }),
13458
13460
  ConceptCodeSequence: addAccessors({
13459
- CodeValue: "1",
13460
- CodingSchemeDesignator: "99dcmjs",
13461
- CodeMeaning: "Unknown procedure"
13461
+ CodeValue: "363679005",
13462
+ CodingSchemeDesignator: "SCT",
13463
+ CodeMeaning: "Imaging procedure"
13462
13464
  })
13463
13465
  }, {
13464
13466
  RelationshipType: "CONTAINS",
@@ -14005,33 +14007,259 @@ var TID300Measurement = /*#__PURE__*/function () {
14005
14007
  return TID300Measurement;
14006
14008
  }();
14007
14009
 
14008
- var MM_UNIT = {
14010
+ /**
14011
+ * Builds a DICOM SR ContentSequence block for geometric measurements
14012
+ * that share the same structure across tools (Circle, Ellipse, Polyline, etc.)
14013
+ */
14014
+ var TID320ContentItem = /*#__PURE__*/function () {
14015
+ function TID320ContentItem(_ref) {
14016
+ var graphicType = _ref.graphicType,
14017
+ graphicData = _ref.graphicData,
14018
+ _ref$use3DSpatialCoor = _ref.use3DSpatialCoordinates,
14019
+ use3DSpatialCoordinates = _ref$use3DSpatialCoor === void 0 ? false : _ref$use3DSpatialCoor,
14020
+ referencedSOPSequence = _ref.referencedSOPSequence,
14021
+ referencedFrameOfReferenceUID = _ref.referencedFrameOfReferenceUID;
14022
+ _classCallCheck(this, TID320ContentItem);
14023
+ this.graphicType = graphicType;
14024
+ this.graphicData = graphicData;
14025
+ this.use3DSpatialCoordinates = use3DSpatialCoordinates;
14026
+ this.referencedSOPSequence = referencedSOPSequence;
14027
+ this.referencedFrameOfReferenceUID = referencedFrameOfReferenceUID;
14028
+ }
14029
+ _createClass(TID320ContentItem, [{
14030
+ key: "contentItem",
14031
+ value: function contentItem() {
14032
+ var content = {
14033
+ RelationshipType: "INFERRED FROM",
14034
+ ValueType: this.use3DSpatialCoordinates ? "SCOORD3D" : "SCOORD",
14035
+ GraphicType: this.graphicType,
14036
+ GraphicData: this.graphicData
14037
+ };
14038
+ if (this.use3DSpatialCoordinates) {
14039
+ content.ReferencedFrameOfReferenceUID = this.referencedFrameOfReferenceUID;
14040
+ } else {
14041
+ content.ContentSequence = {
14042
+ RelationshipType: "SELECTED FROM",
14043
+ ValueType: "IMAGE",
14044
+ ReferencedSOPSequence: this.referencedSOPSequence
14045
+ };
14046
+ }
14047
+ return content;
14048
+ }
14049
+ }]);
14050
+ return TID320ContentItem;
14051
+ }();
14052
+
14053
+ var OpenPolyline = /*#__PURE__*/function (_TID300Measurement) {
14054
+ _inherits(OpenPolyline, _TID300Measurement);
14055
+ function OpenPolyline() {
14056
+ _classCallCheck(this, OpenPolyline);
14057
+ return _callSuper(this, OpenPolyline, arguments);
14058
+ }
14059
+ _createClass(OpenPolyline, [{
14060
+ key: "getPoints",
14061
+ value: function getPoints() {
14062
+ throw new Error("getPoints() must be implemented by subclass");
14063
+ }
14064
+ }, {
14065
+ key: "getConceptNameCodeSequence",
14066
+ value: function getConceptNameCodeSequence() {
14067
+ throw new Error("getConceptNameCodeSequence() must be implemented");
14068
+ }
14069
+ }, {
14070
+ key: "getMeasuredValueSequence",
14071
+ value: function getMeasuredValueSequence() {
14072
+ return null;
14073
+ }
14074
+ }, {
14075
+ key: "buildGraphicContent",
14076
+ value: function buildGraphicContent() {
14077
+ var _this$props = this.props,
14078
+ _this$props$use3DSpat = _this$props.use3DSpatialCoordinates,
14079
+ use3DSpatialCoordinates = _this$props$use3DSpat === void 0 ? false : _this$props$use3DSpat,
14080
+ ReferencedSOPSequence = _this$props.ReferencedSOPSequence,
14081
+ ReferencedFrameOfReferenceUID = _this$props.ReferencedFrameOfReferenceUID;
14082
+ var GraphicData = this.flattenPoints({
14083
+ points: this.getPoints(),
14084
+ use3DSpatialCoordinates: use3DSpatialCoordinates
14085
+ });
14086
+ return new TID320ContentItem({
14087
+ graphicType: "POLYLINE",
14088
+ graphicData: GraphicData,
14089
+ use3DSpatialCoordinates: use3DSpatialCoordinates,
14090
+ referencedSOPSequence: ReferencedSOPSequence,
14091
+ referencedFrameOfReferenceUID: ReferencedFrameOfReferenceUID
14092
+ }).contentItem();
14093
+ }
14094
+ }, {
14095
+ key: "contentItem",
14096
+ value: function contentItem() {
14097
+ var concept = this.getConceptNameCodeSequence();
14098
+ var measuredValue = this.getMeasuredValueSequence();
14099
+ return this.getMeasurement([{
14100
+ RelationshipType: "CONTAINS",
14101
+ ValueType: "NUM",
14102
+ ConceptNameCodeSequence: concept,
14103
+ MeasuredValueSequence: measuredValue,
14104
+ ContentSequence: this.buildGraphicContent()
14105
+ }]);
14106
+ }
14107
+ }]);
14108
+ return OpenPolyline;
14109
+ }(TID300Measurement);
14110
+
14111
+ var knownUnits = [
14112
+ // Standard UCUM units.
14113
+ {
14114
+ CodingSchemeDesignator: "UCUM",
14115
+ CodingSchemeVersion: "1.4",
14009
14116
  CodeValue: "mm",
14117
+ CodeMeaning: "mm"
14118
+ }, {
14010
14119
  CodingSchemeDesignator: "UCUM",
14011
14120
  CodingSchemeVersion: "1.4",
14012
- CodeMeaning: "millimeter"
14013
- };
14014
- var MM2_UNIT = {
14015
14121
  CodeValue: "mm2",
14122
+ CodeMeaning: "mm2"
14123
+ },
14124
+ // Units defined in https://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_83.html
14125
+ {
14016
14126
  CodingSchemeDesignator: "UCUM",
14017
14127
  CodingSchemeVersion: "1.4",
14018
- CodeMeaning: "SquareMilliMeter"
14019
- };
14128
+ CodeValue: "[hnsf'U]",
14129
+ CodeMeaning: "Hounsfield unit"
14130
+ },
14131
+ // Units defined in https://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_84.html
14132
+ {
14133
+ CodingSchemeDesignator: "UCUM",
14134
+ CodingSchemeVersion: "1.4",
14135
+ CodeValue: "{counts}",
14136
+ CodeMeaning: "Counts"
14137
+ }, {
14138
+ CodingSchemeDesignator: "UCUM",
14139
+ CodingSchemeVersion: "1.4",
14140
+ CodeValue: "{counts}/s",
14141
+ CodeMeaning: "Counts per second"
14142
+ }, {
14143
+ CodingSchemeDesignator: "UCUM",
14144
+ CodingSchemeVersion: "1.4",
14145
+ CodeValue: "{propcounts}",
14146
+ CodeMeaning: "Proportional to counts"
14147
+ }, {
14148
+ CodingSchemeDesignator: "UCUM",
14149
+ CodingSchemeVersion: "1.4",
14150
+ CodeValue: "{propcounts}/s",
14151
+ CodeMeaning: "Proportional to counts per second"
14152
+ }, {
14153
+ CodingSchemeDesignator: "UCUM",
14154
+ CodingSchemeVersion: "1.4",
14155
+ CodeValue: "cm2",
14156
+ CodeMeaning: "cm2"
14157
+ }, {
14158
+ CodingSchemeDesignator: "UCUM",
14159
+ CodingSchemeVersion: "1.4",
14160
+ CodeValue: "cm2/ml",
14161
+ CodeMeaning: "cm2/ml"
14162
+ }, {
14163
+ CodingSchemeDesignator: "UCUM",
14164
+ CodingSchemeVersion: "1.4",
14165
+ CodeValue: "%",
14166
+ CodeMeaning: "Percent"
14167
+ }, {
14168
+ CodingSchemeDesignator: "UCUM",
14169
+ CodingSchemeVersion: "1.4",
14170
+ CodeValue: "Bq/ml",
14171
+ CodeMeaning: "Becquerels/milliliter"
14172
+ }, {
14173
+ CodingSchemeDesignator: "UCUM",
14174
+ CodingSchemeVersion: "1.4",
14175
+ CodeValue: "mg/min/ml",
14176
+ CodeMeaning: "Milligrams/minute/milliliter"
14177
+ }, {
14178
+ CodingSchemeDesignator: "UCUM",
14179
+ CodingSchemeVersion: "1.4",
14180
+ CodeValue: "umol/min/ml",
14181
+ CodeMeaning: "Micromole/minute/milliliter"
14182
+ }, {
14183
+ CodingSchemeDesignator: "UCUM",
14184
+ CodingSchemeVersion: "1.4",
14185
+ CodeValue: "ml/min/g",
14186
+ CodeMeaning: "Milliliter/minute/gram"
14187
+ }, {
14188
+ CodingSchemeDesignator: "UCUM",
14189
+ CodingSchemeVersion: "1.4",
14190
+ CodeValue: "ml/g",
14191
+ CodeMeaning: "Milliliter/gram"
14192
+ }, {
14193
+ CodingSchemeDesignator: "UCUM",
14194
+ CodingSchemeVersion: "1.4",
14195
+ CodeValue: "/cm",
14196
+ CodeMeaning: "/Centimeter"
14197
+ }, {
14198
+ CodingSchemeDesignator: "UCUM",
14199
+ CodingSchemeVersion: "1.4",
14200
+ CodeValue: "umol/ml",
14201
+ CodeMeaning: "Micromole/milliliter"
14202
+ },
14203
+ // Units defined in https://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_85.html
14204
+ {
14205
+ CodingSchemeDesignator: "UCUM",
14206
+ CodingSchemeVersion: "1.4",
14207
+ CodeValue: "g/ml{SUVbw}",
14208
+ CodeMeaning: "Standardized Uptake Value body weight"
14209
+ }, {
14210
+ CodingSchemeDesignator: "UCUM",
14211
+ CodingSchemeVersion: "1.4",
14212
+ CodeValue: "g/ml{SUVlbm}",
14213
+ CodeMeaning: "Standardized Uptake Value lean body mass (James)"
14214
+ }, {
14215
+ CodingSchemeDesignator: "UCUM",
14216
+ CodingSchemeVersion: "1.4",
14217
+ CodeValue: "g/ml{SUVlbm(James128)}",
14218
+ CodeMeaning: "Standardized Uptake Value lean body mass (James 128 multiplier)"
14219
+ }, {
14220
+ CodingSchemeDesignator: "UCUM",
14221
+ CodingSchemeVersion: "1.4",
14222
+ CodeValue: "g/ml{SUVlbm(Janma)}",
14223
+ CodeMeaning: "Standardized Uptake Value lean body mass (Janma)"
14224
+ }, {
14225
+ CodingSchemeDesignator: "UCUM",
14226
+ CodingSchemeVersion: "1.4",
14227
+ CodeValue: "cm2/ml{SUVbsa}",
14228
+ CodeMeaning: "Standardized Uptake Value body surface area"
14229
+ }, {
14230
+ CodingSchemeDesignator: "UCUM",
14231
+ CodingSchemeVersion: "1.4",
14232
+ CodeValue: "g/ml{SUVibw}",
14233
+ CodeMeaning: "Standardized Uptake Value ideal body weight"
14234
+ }];
14235
+
14236
+ // Create unitCodeMap from knownUnits for efficient lookup
14237
+ var unitCodeMap = {};
14238
+ knownUnits.forEach(function (unit) {
14239
+ unitCodeMap[unit.CodeValue] = unit;
14240
+ });
14241
+ var noUnitCodeValues = ["px", "px\xB2"];
14020
14242
  var NO_UNIT = {
14021
14243
  CodeValue: "1",
14022
14244
  CodingSchemeDesignator: "UCUM",
14023
14245
  CodingSchemeVersion: "1.4",
14024
14246
  CodeMeaning: "px"
14025
14247
  };
14026
- var NO2_UNIT = NO_UNIT;
14027
- var measurementMap = {
14028
- px: NO_UNIT,
14029
- mm: MM_UNIT,
14030
- mm2: MM2_UNIT,
14031
- "mm\xB2": MM2_UNIT,
14032
- "px\xB2": NO2_UNIT
14248
+ noUnitCodeValues.forEach(function (codeValue) {
14249
+ unitCodeMap[codeValue] = NO_UNIT;
14250
+ });
14251
+ unitCodeMap["mm\xB2"] = {
14252
+ CodingSchemeDesignator: "UCUM",
14253
+ CodingSchemeVersion: "1.4",
14254
+ CodeValue: "mm2",
14255
+ CodeMeaning: "mm2"
14256
+ };
14257
+ var MM_UNIT = {
14258
+ CodeValue: "mm",
14259
+ CodingSchemeDesignator: "UCUM",
14260
+ CodingSchemeVersion: "1.4",
14261
+ CodeMeaning: "millimeter"
14033
14262
  };
14034
-
14035
14263
  /** Converts the given unit into the
14036
14264
  * specified coding values.
14037
14265
  * Has .measurementMap on the function specifying global units for measurements.
@@ -14040,67 +14268,53 @@ var unit2CodingValue = function unit2CodingValue(units) {
14040
14268
  if (!units) return NO_UNIT;
14041
14269
  var space = units.indexOf(" ");
14042
14270
  var baseUnit = space === -1 ? units : units.substring(0, space);
14043
- var codingUnit = measurementMap[units] || measurementMap[baseUnit];
14271
+ var codingUnit = unitCodeMap[units] || unitCodeMap[baseUnit];
14044
14272
  if (!codingUnit) {
14045
14273
  log.error("Unspecified units", units);
14046
14274
  return MM_UNIT;
14047
14275
  }
14048
14276
  return codingUnit;
14049
14277
  };
14050
- unit2CodingValue.measurementMap = measurementMap;
14278
+ unit2CodingValue.measurementMap = unitCodeMap;
14051
14279
 
14052
- var Length$2 = /*#__PURE__*/function (_TID300Measurement) {
14053
- _inherits(Length, _TID300Measurement);
14280
+ var Length$2 = /*#__PURE__*/function (_OpenPolyline) {
14281
+ _inherits(Length, _OpenPolyline);
14054
14282
  function Length() {
14055
14283
  _classCallCheck(this, Length);
14056
14284
  return _callSuper(this, Length, arguments);
14057
14285
  }
14058
14286
  _createClass(Length, [{
14059
- key: "contentItem",
14060
- value: function contentItem() {
14287
+ key: "getPoints",
14288
+ value: function getPoints() {
14061
14289
  var _this$props = this.props,
14062
14290
  point1 = _this$props.point1,
14063
- point2 = _this$props.point2,
14064
- _this$props$unit = _this$props.unit,
14065
- unit = _this$props$unit === void 0 ? "mm" : _this$props$unit,
14066
- _this$props$use3DSpat = _this$props.use3DSpatialCoordinates,
14067
- use3DSpatialCoordinates = _this$props$use3DSpat === void 0 ? false : _this$props$use3DSpat,
14068
- distance = _this$props.distance,
14069
- ReferencedSOPSequence = _this$props.ReferencedSOPSequence,
14070
- ReferencedFrameOfReferenceUID = _this$props.ReferencedFrameOfReferenceUID;
14071
- var GraphicData = this.flattenPoints({
14072
- points: [point1, point2],
14073
- use3DSpatialCoordinates: use3DSpatialCoordinates
14074
- });
14075
- return this.getMeasurement([{
14076
- RelationshipType: "CONTAINS",
14077
- ValueType: "NUM",
14078
- ConceptNameCodeSequence: {
14079
- CodeValue: "G-D7FE",
14080
- CodingSchemeDesignator: "SRT",
14081
- CodeMeaning: "Length"
14082
- },
14083
- MeasuredValueSequence: {
14084
- MeasurementUnitsCodeSequence: unit2CodingValue(unit),
14085
- NumericValue: distance
14086
- },
14087
- ContentSequence: {
14088
- RelationshipType: "INFERRED FROM",
14089
- ValueType: use3DSpatialCoordinates ? "SCOORD3D" : "SCOORD",
14090
- GraphicType: "POLYLINE",
14091
- GraphicData: GraphicData,
14092
- ReferencedFrameOfReferenceUID: use3DSpatialCoordinates ? ReferencedFrameOfReferenceUID : undefined,
14093
- ContentSequence: use3DSpatialCoordinates ? undefined : {
14094
- RelationshipType: "SELECTED FROM",
14095
- ValueType: "IMAGE",
14096
- ReferencedSOPSequence: ReferencedSOPSequence
14097
- }
14098
- }
14099
- }]);
14291
+ point2 = _this$props.point2;
14292
+ return [point1, point2];
14293
+ }
14294
+ }, {
14295
+ key: "getConceptNameCodeSequence",
14296
+ value: function getConceptNameCodeSequence() {
14297
+ return {
14298
+ CodeValue: "410668003",
14299
+ CodingSchemeDesignator: "SCT",
14300
+ CodeMeaning: "Length"
14301
+ };
14302
+ }
14303
+ }, {
14304
+ key: "getMeasuredValueSequence",
14305
+ value: function getMeasuredValueSequence() {
14306
+ var _this$props2 = this.props,
14307
+ distance = _this$props2.distance,
14308
+ _this$props2$unit = _this$props2.unit,
14309
+ unit = _this$props2$unit === void 0 ? "mm" : _this$props2$unit;
14310
+ return {
14311
+ MeasurementUnitsCodeSequence: unit2CodingValue(unit),
14312
+ NumericValue: distance
14313
+ };
14100
14314
  }
14101
14315
  }]);
14102
14316
  return Length;
14103
- }(TID300Measurement);
14317
+ }(OpenPolyline);
14104
14318
 
14105
14319
  var CORNERSTONE_4_TAG = "cornerstoneTools@^4.0.0";
14106
14320
 
@@ -14180,6 +14394,120 @@ Length$1.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
14180
14394
  };
14181
14395
  MeasurementReport$3.registerTool(Length$1);
14182
14396
 
14397
+ /**
14398
+ * Utility class for constructing DICOM SR Numeric (NUM) measurement items
14399
+ * associated with a spatial coordinate (SCOORD) annotation.
14400
+ *
14401
+ * Each measurement produced by this builder includes:
14402
+ * - A NUM content item describing the measurement value
14403
+ * - A MeasuredValueSequence with its unit encoded in UCUM or another scheme
14404
+ * - A ContentSequence containing an INFERRED FROM reference linking the
14405
+ * measurement back to the SCOORD item using ReferencedContentItemIdentifier.
14406
+ *
14407
+ * This ensures that all derived measurements correctly reference the
14408
+ * annotation from which they were computed.
14409
+ */
14410
+ var MeasurementBuilder = /*#__PURE__*/function () {
14411
+ function MeasurementBuilder() {
14412
+ _classCallCheck(this, MeasurementBuilder);
14413
+ }
14414
+ _createClass(MeasurementBuilder, null, [{
14415
+ key: "createNumericMeasurement",
14416
+ value:
14417
+ /**
14418
+ * Creates a NUM (Numeric Measurement) content item for a DICOM SR.
14419
+ *
14420
+ * @param {string} codeValue - Code value representing the type of measurement.
14421
+ * @param {string} codingScheme - Coding scheme designator (e.g., "SCT", "DCM").
14422
+ * @param {string} codeMeaning - Human-readable meaning of the measurement code.
14423
+ * @param {number|string} value - The numeric measurement value.
14424
+ * @param {Object} unit - Unit definition object (UCUM or other coding scheme).
14425
+ *
14426
+ * @returns {Object} DICOM SR content item representing a numeric measurement.
14427
+ */
14428
+
14429
+ function createNumericMeasurement(codeValue, codingScheme, codeMeaning, value, unit) {
14430
+ var _ref = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {},
14431
+ _ref$scoordContentIte = _ref.scoordContentItem,
14432
+ scoordContentItem = _ref$scoordContentIte === void 0 ? null : _ref$scoordContentIte;
14433
+ var item = {
14434
+ RelationshipType: "CONTAINS",
14435
+ ValueType: "NUM",
14436
+ ConceptNameCodeSequence: {
14437
+ CodeValue: codeValue,
14438
+ CodingSchemeDesignator: codingScheme,
14439
+ CodeMeaning: codeMeaning
14440
+ },
14441
+ MeasuredValueSequence: {
14442
+ MeasurementUnitsCodeSequence: unit2CodingValue(unit),
14443
+ NumericValue: value
14444
+ }
14445
+ };
14446
+ if (scoordContentItem) {
14447
+ item.ContentSequence = scoordContentItem;
14448
+ }
14449
+ return item;
14450
+ }
14451
+ }, {
14452
+ key: "createAreaMeasurement",
14453
+ value: function createAreaMeasurement(area, areaUnit, _ref2) {
14454
+ var scoordContentItem = _ref2.scoordContentItem;
14455
+ return MeasurementBuilder.createNumericMeasurement("42798000", "SCT", "Area", area, areaUnit, {
14456
+ scoordContentItem: scoordContentItem
14457
+ });
14458
+ }
14459
+ }, {
14460
+ key: "createRadiusMeasurement",
14461
+ value: function createRadiusMeasurement(radius, radiusUnit, _ref3) {
14462
+ var scoordContentItem = _ref3.scoordContentItem;
14463
+ return MeasurementBuilder.createNumericMeasurement("131190003", "SCT", "Radius", radius, radiusUnit, {
14464
+ scoordContentItem: scoordContentItem
14465
+ });
14466
+ }
14467
+ }, {
14468
+ key: "createMaxMeasurement",
14469
+ value: function createMaxMeasurement(max, modalityUnit, _ref4) {
14470
+ var scoordContentItem = _ref4.scoordContentItem;
14471
+ return MeasurementBuilder.createNumericMeasurement("56851009", "SCT", "Maximum", max, modalityUnit, {
14472
+ scoordContentItem: scoordContentItem
14473
+ });
14474
+ }
14475
+ }, {
14476
+ key: "createMinMeasurement",
14477
+ value: function createMinMeasurement(min, modalityUnit, _ref5) {
14478
+ var scoordContentItem = _ref5.scoordContentItem;
14479
+ return MeasurementBuilder.createNumericMeasurement("255605001", "SCT", "Minimum", min, modalityUnit, {
14480
+ scoordContentItem: scoordContentItem
14481
+ });
14482
+ }
14483
+ }, {
14484
+ key: "createMeanMeasurement",
14485
+ value: function createMeanMeasurement(mean, modalityUnit, _ref6) {
14486
+ var scoordContentItem = _ref6.scoordContentItem;
14487
+ return MeasurementBuilder.createNumericMeasurement("373098007", "SCT", "Mean", mean, modalityUnit, {
14488
+ scoordContentItem: scoordContentItem
14489
+ });
14490
+ }
14491
+ }, {
14492
+ key: "createStdDevMeasurement",
14493
+ value: function createStdDevMeasurement(stdDev, modalityUnit, _ref7) {
14494
+ var scoordContentItem = _ref7.scoordContentItem;
14495
+ return MeasurementBuilder.createNumericMeasurement("386136009", "SCT", "Standard Deviation", stdDev, modalityUnit, {
14496
+ scoordContentItem: scoordContentItem
14497
+ });
14498
+ }
14499
+ }, {
14500
+ key: "createPerimeterMeasurement",
14501
+ value: function createPerimeterMeasurement(perimeter, unit, _ref8) {
14502
+ var scoordContentItem = _ref8.scoordContentItem;
14503
+ return MeasurementBuilder.createNumericMeasurement("131191004", "SCT", "Perimeter", perimeter, unit, {
14504
+ scoordContentItem: scoordContentItem
14505
+ });
14506
+ }
14507
+ }]);
14508
+ return MeasurementBuilder;
14509
+ }();
14510
+
14183
14511
  var Polyline$1 = /*#__PURE__*/function (_TID300Measurement) {
14184
14512
  _inherits(Polyline, _TID300Measurement);
14185
14513
  function Polyline() {
@@ -14200,63 +14528,56 @@ var Polyline$1 = /*#__PURE__*/function (_TID300Measurement) {
14200
14528
  perimeter = _this$props.perimeter,
14201
14529
  _this$props$unit = _this$props.unit,
14202
14530
  unit = _this$props$unit === void 0 ? "mm" : _this$props$unit,
14531
+ modalityUnit = _this$props.modalityUnit,
14532
+ min = _this$props.min,
14533
+ max = _this$props.max,
14534
+ mean = _this$props.mean,
14535
+ stdDev = _this$props.stdDev,
14203
14536
  ReferencedFrameOfReferenceUID = _this$props.ReferencedFrameOfReferenceUID;
14204
14537
  var GraphicData = this.flattenPoints({
14205
14538
  points: points,
14206
14539
  use3DSpatialCoordinates: use3DSpatialCoordinates
14207
14540
  });
14208
-
14209
- // TODO: Add Mean and STDev value of (modality?) pixels
14210
- return this.getMeasurement([{
14211
- RelationshipType: "CONTAINS",
14212
- ValueType: "NUM",
14213
- ConceptNameCodeSequence: {
14214
- CodeValue: "131191004",
14215
- CodingSchemeDesignator: "SCT",
14216
- CodeMeaning: "Perimeter"
14217
- },
14218
- MeasuredValueSequence: {
14219
- MeasurementUnitsCodeSequence: unit2CodingValue(unit),
14220
- NumericValue: perimeter
14221
- },
14222
- ContentSequence: {
14223
- RelationshipType: "INFERRED FROM",
14224
- ValueType: use3DSpatialCoordinates ? "SCOORD3D" : "SCOORD",
14225
- GraphicType: "POLYLINE",
14226
- GraphicData: GraphicData,
14227
- ReferencedFrameOfReferenceUID: use3DSpatialCoordinates ? ReferencedFrameOfReferenceUID : undefined,
14228
- ContentSequence: use3DSpatialCoordinates ? undefined : {
14229
- RelationshipType: "SELECTED FROM",
14230
- ValueType: "IMAGE",
14231
- ReferencedSOPSequence: ReferencedSOPSequence
14232
- }
14233
- }
14541
+ var measurementConfigs = [{
14542
+ value: perimeter,
14543
+ unit: unit,
14544
+ builder: MeasurementBuilder.createPerimeterMeasurement
14234
14545
  }, {
14235
- // TODO: This feels weird to repeat the GraphicData
14236
- RelationshipType: "CONTAINS",
14237
- ValueType: "NUM",
14238
- ConceptNameCodeSequence: {
14239
- CodeValue: "G-A166",
14240
- CodingSchemeDesignator: "SRT",
14241
- CodeMeaning: "Area" // TODO: Look this up from a Code Meaning dictionary
14242
- },
14243
- MeasuredValueSequence: {
14244
- MeasurementUnitsCodeSequence: unit2CodingValue(areaUnit),
14245
- NumericValue: area
14246
- },
14247
- ContentSequence: {
14248
- RelationshipType: "INFERRED FROM",
14249
- ValueType: use3DSpatialCoordinates ? "SCOORD3D" : "SCOORD",
14250
- GraphicType: "POLYLINE",
14251
- GraphicData: GraphicData,
14252
- ReferencedFrameOfReferenceUID: use3DSpatialCoordinates ? ReferencedFrameOfReferenceUID : undefined,
14253
- ContentSequence: use3DSpatialCoordinates ? undefined : {
14254
- RelationshipType: "SELECTED FROM",
14255
- ValueType: "IMAGE",
14256
- ReferencedSOPSequence: ReferencedSOPSequence
14257
- }
14258
- }
14259
- }]);
14546
+ value: area,
14547
+ unit: areaUnit,
14548
+ builder: MeasurementBuilder.createAreaMeasurement
14549
+ }, {
14550
+ value: max,
14551
+ unit: modalityUnit,
14552
+ builder: MeasurementBuilder.createMaxMeasurement
14553
+ }, {
14554
+ value: min,
14555
+ unit: modalityUnit,
14556
+ builder: MeasurementBuilder.createMinMeasurement
14557
+ }, {
14558
+ value: mean,
14559
+ unit: modalityUnit,
14560
+ builder: MeasurementBuilder.createMeanMeasurement
14561
+ }, {
14562
+ value: stdDev,
14563
+ unit: modalityUnit,
14564
+ builder: MeasurementBuilder.createStdDevMeasurement
14565
+ }];
14566
+ var scoordContentItem = new TID320ContentItem({
14567
+ graphicType: "POLYLINE",
14568
+ graphicData: GraphicData,
14569
+ use3DSpatialCoordinates: use3DSpatialCoordinates,
14570
+ referencedSOPSequence: ReferencedSOPSequence,
14571
+ referencedFrameOfReferenceUID: ReferencedFrameOfReferenceUID
14572
+ }).contentItem();
14573
+ var measurements = measurementConfigs.filter(function (config) {
14574
+ return config.value !== undefined;
14575
+ }).map(function (config, index) {
14576
+ return config.builder(config.value, config.unit, {
14577
+ scoordContentItem: index === 0 ? scoordContentItem : null
14578
+ });
14579
+ });
14580
+ return this.getMeasurement(measurements);
14260
14581
  }
14261
14582
  }]);
14262
14583
  return Polyline;
@@ -14372,54 +14693,46 @@ var Bidirectional$2 = /*#__PURE__*/function (_TID300Measurement) {
14372
14693
  points: [shortAxis.point1, shortAxis.point2],
14373
14694
  use3DSpatialCoordinates: use3DSpatialCoordinates
14374
14695
  });
14696
+ var longAxisContentSequence = new TID320ContentItem({
14697
+ graphicType: "POLYLINE",
14698
+ graphicData: longAxisGraphicData,
14699
+ use3DSpatialCoordinates: use3DSpatialCoordinates,
14700
+ referencedSOPSequence: ReferencedSOPSequence,
14701
+ referencedFrameOfReferenceUID: ReferencedFrameOfReferenceUID
14702
+ }).contentItem();
14703
+ var shortAxisContentSequence = new TID320ContentItem({
14704
+ graphicType: "POLYLINE",
14705
+ graphicData: shortAxisGraphicData,
14706
+ use3DSpatialCoordinates: use3DSpatialCoordinates,
14707
+ referencedSOPSequence: ReferencedSOPSequence,
14708
+ referencedFrameOfReferenceUID: ReferencedFrameOfReferenceUID
14709
+ }).contentItem();
14375
14710
  return this.getMeasurement([{
14376
14711
  RelationshipType: "CONTAINS",
14377
14712
  ValueType: "NUM",
14378
14713
  ConceptNameCodeSequence: {
14379
- CodeValue: "G-A185",
14380
- CodingSchemeDesignator: "SRT",
14714
+ CodeValue: "103339001",
14715
+ CodingSchemeDesignator: "SCT",
14381
14716
  CodeMeaning: "Long Axis"
14382
14717
  },
14383
14718
  MeasuredValueSequence: {
14384
14719
  MeasurementUnitsCodeSequence: unit2CodingValue(unit),
14385
14720
  NumericValue: longAxisLength
14386
14721
  },
14387
- ContentSequence: {
14388
- RelationshipType: "INFERRED FROM",
14389
- ValueType: use3DSpatialCoordinates ? "SCOORD3D" : "SCOORD",
14390
- GraphicType: "POLYLINE",
14391
- GraphicData: longAxisGraphicData,
14392
- ReferencedFrameOfReferenceUID: use3DSpatialCoordinates ? ReferencedFrameOfReferenceUID : undefined,
14393
- ContentSequence: use3DSpatialCoordinates ? undefined : {
14394
- RelationshipType: "SELECTED FROM",
14395
- ValueType: "IMAGE",
14396
- ReferencedSOPSequence: ReferencedSOPSequence
14397
- }
14398
- }
14722
+ ContentSequence: longAxisContentSequence
14399
14723
  }, {
14400
14724
  RelationshipType: "CONTAINS",
14401
14725
  ValueType: "NUM",
14402
14726
  ConceptNameCodeSequence: {
14403
- CodeValue: "G-A186",
14404
- CodingSchemeDesignator: "SRT",
14727
+ CodeValue: "103340004",
14728
+ CodingSchemeDesignator: "SCT",
14405
14729
  CodeMeaning: "Short Axis"
14406
14730
  },
14407
14731
  MeasuredValueSequence: {
14408
14732
  MeasurementUnitsCodeSequence: unit2CodingValue(unit),
14409
14733
  NumericValue: shortAxisLength
14410
14734
  },
14411
- ContentSequence: {
14412
- RelationshipType: "INFERRED FROM",
14413
- ValueType: use3DSpatialCoordinates ? "SCOORD3D" : "SCOORD",
14414
- GraphicType: "POLYLINE",
14415
- GraphicData: shortAxisGraphicData,
14416
- ReferencedFrameOfReferenceUID: use3DSpatialCoordinates ? ReferencedFrameOfReferenceUID : undefined,
14417
- ContentSequence: use3DSpatialCoordinates ? undefined : {
14418
- RelationshipType: "SELECTED FROM",
14419
- ValueType: "IMAGE",
14420
- ReferencedSOPSequence: ReferencedSOPSequence
14421
- }
14422
- }
14735
+ ContentSequence: shortAxisContentSequence
14423
14736
  }]);
14424
14737
  }
14425
14738
  }]);
@@ -14604,36 +14917,52 @@ var Ellipse$1 = /*#__PURE__*/function (_TID300Measurement) {
14604
14917
  ReferencedSOPSequence = _this$props.ReferencedSOPSequence,
14605
14918
  area = _this$props.area,
14606
14919
  areaUnit = _this$props.areaUnit,
14920
+ max = _this$props.max,
14921
+ min = _this$props.min,
14922
+ mean = _this$props.mean,
14923
+ stdDev = _this$props.stdDev,
14924
+ modalityUnit = _this$props.modalityUnit,
14607
14925
  ReferencedFrameOfReferenceUID = _this$props.ReferencedFrameOfReferenceUID;
14608
14926
  var GraphicData = this.flattenPoints({
14609
14927
  points: points,
14610
14928
  use3DSpatialCoordinates: use3DSpatialCoordinates
14611
14929
  });
14612
- return this.getMeasurement([{
14613
- RelationshipType: "CONTAINS",
14614
- ValueType: "NUM",
14615
- ConceptNameCodeSequence: {
14616
- CodeValue: "G-D7FE",
14617
- CodingSchemeDesignator: "SRT",
14618
- CodeMeaning: "AREA"
14619
- },
14620
- MeasuredValueSequence: {
14621
- MeasurementUnitsCodeSequence: unit2CodingValue(areaUnit),
14622
- NumericValue: area
14623
- },
14624
- ContentSequence: {
14625
- RelationshipType: "INFERRED FROM",
14626
- ValueType: use3DSpatialCoordinates ? "SCOORD3D" : "SCOORD",
14627
- GraphicType: "ELLIPSE",
14628
- GraphicData: GraphicData,
14629
- ReferencedFrameOfReferenceUID: use3DSpatialCoordinates ? ReferencedFrameOfReferenceUID : undefined,
14630
- ContentSequence: use3DSpatialCoordinates ? undefined : {
14631
- RelationshipType: "SELECTED FROM",
14632
- ValueType: "IMAGE",
14633
- ReferencedSOPSequence: ReferencedSOPSequence
14634
- }
14635
- }
14636
- }]);
14930
+ var measurementConfigs = [{
14931
+ value: area,
14932
+ unit: areaUnit,
14933
+ builder: MeasurementBuilder.createAreaMeasurement
14934
+ }, {
14935
+ value: max,
14936
+ unit: modalityUnit,
14937
+ builder: MeasurementBuilder.createMaxMeasurement
14938
+ }, {
14939
+ value: min,
14940
+ unit: modalityUnit,
14941
+ builder: MeasurementBuilder.createMinMeasurement
14942
+ }, {
14943
+ value: mean,
14944
+ unit: modalityUnit,
14945
+ builder: MeasurementBuilder.createMeanMeasurement
14946
+ }, {
14947
+ value: stdDev,
14948
+ unit: modalityUnit,
14949
+ builder: MeasurementBuilder.createStdDevMeasurement
14950
+ }];
14951
+ var scoordContentItem = new TID320ContentItem({
14952
+ graphicType: "ELLIPSE",
14953
+ graphicData: GraphicData,
14954
+ use3DSpatialCoordinates: use3DSpatialCoordinates,
14955
+ referencedSOPSequence: ReferencedSOPSequence,
14956
+ referencedFrameOfReferenceUID: ReferencedFrameOfReferenceUID
14957
+ }).contentItem();
14958
+ var measurements = measurementConfigs.filter(function (config) {
14959
+ return config.value !== undefined;
14960
+ }).map(function (config, index) {
14961
+ return config.builder(config.value, config.unit, {
14962
+ scoordContentItem: index === 0 ? scoordContentItem : null
14963
+ });
14964
+ });
14965
+ return this.getMeasurement(measurements);
14637
14966
  }
14638
14967
  }]);
14639
14968
  return Ellipse;
@@ -14831,7 +15160,14 @@ var Circle$1 = /*#__PURE__*/function (_TID300Measurement) {
14831
15160
  areaUnit = _this$props$areaUnit === void 0 ? "mm2" : _this$props$areaUnit,
14832
15161
  _this$props$unit = _this$props.unit,
14833
15162
  unit = _this$props$unit === void 0 ? "mm" : _this$props$unit,
14834
- ReferencedFrameOfReferenceUID = _this$props.ReferencedFrameOfReferenceUID;
15163
+ max = _this$props.max,
15164
+ min = _this$props.min,
15165
+ mean = _this$props.mean,
15166
+ stdDev = _this$props.stdDev,
15167
+ radiusUnit = _this$props.radiusUnit,
15168
+ modalityUnit = _this$props.modalityUnit,
15169
+ ReferencedFrameOfReferenceUID = _this$props.ReferencedFrameOfReferenceUID,
15170
+ radius = _this$props.radius;
14835
15171
 
14836
15172
  // Combine all lengths to save the perimeter
14837
15173
  // @ToDO The permiter has to be implemented
@@ -14841,58 +15177,50 @@ var Circle$1 = /*#__PURE__*/function (_TID300Measurement) {
14841
15177
  points: points,
14842
15178
  use3DSpatialCoordinates: use3DSpatialCoordinates
14843
15179
  });
14844
-
14845
- // TODO: Add Mean and STDev value of (modality?) pixels
14846
-
14847
- return this.getMeasurement([{
14848
- RelationshipType: "CONTAINS",
14849
- ValueType: "NUM",
14850
- ConceptNameCodeSequence: {
14851
- CodeValue: "G-A197",
14852
- CodingSchemeDesignator: "SRT",
14853
- CodeMeaning: "Perimeter" // TODO: Look this up from a Code Meaning dictionary
14854
- },
14855
- MeasuredValueSequence: {
14856
- MeasurementUnitsCodeSequence: unit2CodingValue(unit),
14857
- NumericValue: perimeter
14858
- },
14859
- ContentSequence: {
14860
- RelationshipType: "INFERRED FROM",
14861
- ValueType: use3DSpatialCoordinates ? "SCOORD3D" : "SCOORD",
14862
- GraphicType: "CIRCLE",
14863
- GraphicData: GraphicData,
14864
- ReferencedFrameOfReferenceUID: use3DSpatialCoordinates ? ReferencedFrameOfReferenceUID : undefined,
14865
- ContentSequence: use3DSpatialCoordinates ? undefined : {
14866
- RelationshipType: "SELECTED FROM",
14867
- ValueType: "IMAGE",
14868
- ReferencedSOPSequence: ReferencedSOPSequence
14869
- }
14870
- }
15180
+ var measurementConfigs = [{
15181
+ value: perimeter,
15182
+ unit: unit,
15183
+ builder: MeasurementBuilder.createPerimeterMeasurement
14871
15184
  }, {
14872
- // TODO: This feels weird to repeat the GraphicData
14873
- RelationshipType: "CONTAINS",
14874
- ValueType: "NUM",
14875
- ConceptNameCodeSequence: {
14876
- CodeValue: "G-A166",
14877
- CodingSchemeDesignator: "SRT",
14878
- CodeMeaning: "Area" // TODO: Look this up from a Code Meaning dictionary
14879
- },
14880
- MeasuredValueSequence: {
14881
- MeasurementUnitsCodeSequence: unit2CodingValue(areaUnit),
14882
- NumericValue: area
14883
- },
14884
- ContentSequence: {
14885
- RelationshipType: "INFERRED FROM",
14886
- ValueType: use3DSpatialCoordinates ? "SCOORD3D" : "SCOORD",
14887
- GraphicType: "CIRCLE",
14888
- GraphicData: GraphicData,
14889
- ContentSequence: use3DSpatialCoordinates ? undefined : {
14890
- RelationshipType: "SELECTED FROM",
14891
- ValueType: "IMAGE",
14892
- ReferencedSOPSequence: ReferencedSOPSequence
14893
- }
14894
- }
14895
- }]);
15185
+ value: area,
15186
+ unit: areaUnit,
15187
+ builder: MeasurementBuilder.createAreaMeasurement
15188
+ }, {
15189
+ value: radius,
15190
+ unit: radiusUnit,
15191
+ builder: MeasurementBuilder.createRadiusMeasurement
15192
+ }, {
15193
+ value: max,
15194
+ unit: modalityUnit,
15195
+ builder: MeasurementBuilder.createMaxMeasurement
15196
+ }, {
15197
+ value: min,
15198
+ unit: modalityUnit,
15199
+ builder: MeasurementBuilder.createMinMeasurement
15200
+ }, {
15201
+ value: mean,
15202
+ unit: modalityUnit,
15203
+ builder: MeasurementBuilder.createMeanMeasurement
15204
+ }, {
15205
+ value: stdDev,
15206
+ unit: modalityUnit,
15207
+ builder: MeasurementBuilder.createStdDevMeasurement
15208
+ }];
15209
+ var scoordContentItem = new TID320ContentItem({
15210
+ graphicType: "CIRCLE",
15211
+ graphicData: GraphicData,
15212
+ use3DSpatialCoordinates: use3DSpatialCoordinates,
15213
+ referencedSOPSequence: ReferencedSOPSequence,
15214
+ referencedFrameOfReferenceUID: ReferencedFrameOfReferenceUID
15215
+ }).contentItem();
15216
+ var measurements = measurementConfigs.filter(function (config) {
15217
+ return config.value !== undefined;
15218
+ }).map(function (config, index) {
15219
+ return config.builder(config.value, config.unit, {
15220
+ scoordContentItem: index === 0 ? scoordContentItem : null
15221
+ });
15222
+ });
15223
+ return this.getMeasurement(measurements);
14896
15224
  }
14897
15225
  }]);
14898
15226
  return Circle;
@@ -15029,11 +15357,17 @@ var Point$1 = /*#__PURE__*/function (_TID300Measurement) {
15029
15357
  _this$props$use3DSpat = _this$props.use3DSpatialCoordinates,
15030
15358
  use3DSpatialCoordinates = _this$props$use3DSpat === void 0 ? false : _this$props$use3DSpat,
15031
15359
  ReferencedFrameOfReferenceUID = _this$props.ReferencedFrameOfReferenceUID;
15032
- var GraphicData = this.flattenPoints({
15033
- // Allow storing another point as part of an indicator showing a single point
15034
- points: points.slice(0, 2),
15035
- use3DSpatialCoordinates: use3DSpatialCoordinates
15036
- });
15360
+
15361
+ // Point must contain exactly one coordinate
15362
+ var point = points[0];
15363
+ var GraphicData = use3DSpatialCoordinates ? [point.x, point.y, point.z] : [point.x, point.y];
15364
+ var graphicContentSequence = new TID320ContentItem({
15365
+ graphicType: "POINT",
15366
+ graphicData: GraphicData,
15367
+ use3DSpatialCoordinates: use3DSpatialCoordinates,
15368
+ referencedSOPSequence: ReferencedSOPSequence,
15369
+ referencedFrameOfReferenceUID: ReferencedFrameOfReferenceUID
15370
+ }).contentItem();
15037
15371
  return this.getMeasurement([{
15038
15372
  RelationshipType: "CONTAINS",
15039
15373
  ValueType: "NUM",
@@ -15042,19 +15376,16 @@ var Point$1 = /*#__PURE__*/function (_TID300Measurement) {
15042
15376
  CodingSchemeDesignator: "DCM",
15043
15377
  CodeMeaning: "Center"
15044
15378
  },
15045
- //MeasuredValueSequence: ,
15046
- ContentSequence: {
15047
- RelationshipType: "INFERRED FROM",
15048
- ValueType: use3DSpatialCoordinates ? "SCOORD3D" : "SCOORD",
15049
- GraphicType: "POINT",
15050
- GraphicData: GraphicData,
15051
- ReferencedFrameOfReferenceUID: use3DSpatialCoordinates ? ReferencedFrameOfReferenceUID : undefined,
15052
- ContentSequence: use3DSpatialCoordinates ? undefined : {
15053
- RelationshipType: "SELECTED FROM",
15054
- ValueType: "IMAGE",
15055
- ReferencedSOPSequence: ReferencedSOPSequence
15379
+ // MeasuredValueSequence is required for NUM items per TID 300/1501
15380
+ MeasuredValueSequence: {
15381
+ NumericValue: 0,
15382
+ MeasurementUnitsCodeSequence: {
15383
+ CodeValue: "1",
15384
+ CodingSchemeDesignator: "UCUM",
15385
+ CodeMeaning: "no units"
15056
15386
  }
15057
- }
15387
+ },
15388
+ ContentSequence: graphicContentSequence
15058
15389
  }]);
15059
15390
  }
15060
15391
  }]);
@@ -15063,7 +15394,7 @@ var Point$1 = /*#__PURE__*/function (_TID300Measurement) {
15063
15394
 
15064
15395
  var ARROW_ANNOTATE$1 = "ArrowAnnotate";
15065
15396
  var CORNERSTONEFREETEXT$1 = "CORNERSTONEFREETEXT";
15066
- var ArrowAnnotate$1 = /*#__PURE__*/function () {
15397
+ var ArrowAnnotate$2 = /*#__PURE__*/function () {
15067
15398
  function ArrowAnnotate() {
15068
15399
  _classCallCheck(this, ArrowAnnotate);
15069
15400
  }
@@ -15134,10 +15465,10 @@ var ArrowAnnotate$1 = /*#__PURE__*/function () {
15134
15465
  }]);
15135
15466
  return ArrowAnnotate;
15136
15467
  }();
15137
- ArrowAnnotate$1.toolType = ARROW_ANNOTATE$1;
15138
- ArrowAnnotate$1.utilityToolType = ARROW_ANNOTATE$1;
15139
- ArrowAnnotate$1.TID300Representation = Point$1;
15140
- ArrowAnnotate$1.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
15468
+ ArrowAnnotate$2.toolType = ARROW_ANNOTATE$1;
15469
+ ArrowAnnotate$2.utilityToolType = ARROW_ANNOTATE$1;
15470
+ ArrowAnnotate$2.TID300Representation = Point$1;
15471
+ ArrowAnnotate$2.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
15141
15472
  if (!TrackingIdentifier.includes(":")) {
15142
15473
  return false;
15143
15474
  }
@@ -15150,7 +15481,7 @@ ArrowAnnotate$1.isValidCornerstoneTrackingIdentifier = function (TrackingIdentif
15150
15481
  }
15151
15482
  return toolType === ARROW_ANNOTATE$1;
15152
15483
  };
15153
- MeasurementReport$3.registerTool(ArrowAnnotate$1);
15484
+ MeasurementReport$3.registerTool(ArrowAnnotate$2);
15154
15485
 
15155
15486
  function iota$1(n) {
15156
15487
  var result = new Array(n);
@@ -18999,62 +19330,48 @@ function fillSegmentation(segmentation, inputLabelmaps3D) {
18999
19330
  console.warn("No generateSegmentation adapater for cornerstone version ".concat(cornerstoneToolsVersion, ", exiting."));
19000
19331
  }
19001
19332
 
19002
- var CobbAngle$1 = /*#__PURE__*/function (_TID300Measurement) {
19003
- _inherits(CobbAngle, _TID300Measurement);
19333
+ var CobbAngle$1 = /*#__PURE__*/function (_OpenPolyline) {
19334
+ _inherits(CobbAngle, _OpenPolyline);
19004
19335
  function CobbAngle() {
19005
19336
  _classCallCheck(this, CobbAngle);
19006
19337
  return _callSuper(this, CobbAngle, arguments);
19007
19338
  }
19008
19339
  _createClass(CobbAngle, [{
19009
- key: "contentItem",
19010
- value: function contentItem() {
19340
+ key: "getPoints",
19341
+ value: function getPoints() {
19011
19342
  var _this$props = this.props,
19012
19343
  point1 = _this$props.point1,
19013
19344
  point2 = _this$props.point2,
19014
19345
  point3 = _this$props.point3,
19015
- point4 = _this$props.point4,
19016
- rAngle = _this$props.rAngle,
19017
- use3DSpatialCoordinates = _this$props.use3DSpatialCoordinates,
19018
- ReferencedSOPSequence = _this$props.ReferencedSOPSequence,
19019
- ReferencedFrameOfReferenceUID = _this$props.ReferencedFrameOfReferenceUID;
19020
- var GraphicData = this.flattenPoints({
19021
- points: [point1, point2, point3, point4],
19022
- use3DSpatialCoordinates: use3DSpatialCoordinates
19023
- });
19024
- return this.getMeasurement([{
19025
- RelationshipType: "CONTAINS",
19026
- ValueType: "NUM",
19027
- ConceptNameCodeSequence: {
19028
- CodeValue: "285285000",
19029
- CodingSchemeDesignator: "SCT",
19030
- CodeMeaning: "Cobb angle"
19031
- },
19032
- MeasuredValueSequence: {
19033
- MeasurementUnitsCodeSequence: {
19034
- CodeValue: "deg",
19035
- CodingSchemeDesignator: "UCUM",
19036
- CodingSchemeVersion: "1.4",
19037
- CodeMeaning: "\xB0"
19038
- },
19039
- NumericValue: rAngle
19346
+ point4 = _this$props.point4;
19347
+ return [point1, point2, point3, point4];
19348
+ }
19349
+ }, {
19350
+ key: "getConceptNameCodeSequence",
19351
+ value: function getConceptNameCodeSequence() {
19352
+ return {
19353
+ CodeValue: "285285000",
19354
+ CodingSchemeDesignator: "SCT",
19355
+ CodeMeaning: "Cobb angle"
19356
+ };
19357
+ }
19358
+ }, {
19359
+ key: "getMeasuredValueSequence",
19360
+ value: function getMeasuredValueSequence() {
19361
+ var rAngle = this.props.rAngle;
19362
+ return {
19363
+ MeasurementUnitsCodeSequence: {
19364
+ CodeValue: "deg",
19365
+ CodingSchemeDesignator: "UCUM",
19366
+ CodingSchemeVersion: "1.4",
19367
+ CodeMeaning: "\xB0"
19040
19368
  },
19041
- ContentSequence: {
19042
- RelationshipType: "INFERRED FROM",
19043
- ValueType: use3DSpatialCoordinates ? "SCOORD3D" : "SCOORD",
19044
- GraphicType: "POLYLINE",
19045
- GraphicData: GraphicData,
19046
- ReferencedFrameOfReferenceUID: use3DSpatialCoordinates ? ReferencedFrameOfReferenceUID : undefined,
19047
- ContentSequence: use3DSpatialCoordinates ? undefined : {
19048
- RelationshipType: "SELECTED FROM",
19049
- ValueType: "IMAGE",
19050
- ReferencedSOPSequence: ReferencedSOPSequence
19051
- }
19052
- }
19053
- }]);
19369
+ NumericValue: rAngle
19370
+ };
19054
19371
  }
19055
19372
  }]);
19056
19373
  return CobbAngle;
19057
- }(TID300Measurement);
19374
+ }(OpenPolyline);
19058
19375
 
19059
19376
  var COBB_ANGLE = "CobbAngle";
19060
19377
  var CobbAngle = /*#__PURE__*/function () {
@@ -19336,7 +19653,7 @@ var Cornerstone = {
19336
19653
  Bidirectional: Bidirectional$1,
19337
19654
  EllipticalRoi: EllipticalRoi,
19338
19655
  CircleRoi: CircleRoi,
19339
- ArrowAnnotate: ArrowAnnotate$1,
19656
+ ArrowAnnotate: ArrowAnnotate$2,
19340
19657
  MeasurementReport: MeasurementReport$3,
19341
19658
  Segmentation: Segmentation$1,
19342
19659
  CobbAngle: CobbAngle,
@@ -19347,17 +19664,46 @@ var Cornerstone = {
19347
19664
  // This is a custom coding scheme defined to store some annotations from Cornerstone.
19348
19665
  // Note: CodeMeaning is VR type LO, which means we only actually support 64 characters
19349
19666
  // here this is fine for most labels, but may be problematic at some point.
19350
- var CORNERSTONEFREETEXT = "CORNERSTONEFREETEXT";
19667
+ // CodeValue must be ≤ 16 characters (SH VR constraint)
19668
+ var FREE_TEXT_CODE_VALUE = "CS3DTEXT";
19669
+
19670
+ // Private coding scheme designator for dcmjs
19671
+ var CodingSchemeDesignator$1 = "99dcmjs";
19351
19672
 
19352
- // Cornerstone specified coding scheme for storing findings
19353
- var CodingSchemeDesignator$1 = "CORNERSTONEJS";
19673
+ // Legacy code value for backward compatibility (deprecated, exceeds SH VR limit)
19674
+ var CORNERSTONEFREETEXT = "CORNERSTONEFREETEXT";
19354
19675
  var CodingScheme = {
19355
19676
  CodingSchemeDesignator: CodingSchemeDesignator$1,
19356
19677
  codeValues: {
19678
+ FREE_TEXT_CODE_VALUE: FREE_TEXT_CODE_VALUE,
19679
+ // Legacy support - kept for reading old files
19357
19680
  CORNERSTONEFREETEXT: CORNERSTONEFREETEXT
19358
19681
  }
19359
19682
  };
19360
19683
 
19684
+ /**
19685
+ * Checks if the given code value is the free text annotation code value
19686
+ * @param {string} codeValue - The code value to check
19687
+ * @returns {boolean} True if the code value matches the free text annotation code (CS3DTEXT)
19688
+ */
19689
+ var isFreeTextCodeValue = function isFreeTextCodeValue(codeValue) {
19690
+ return codeValue === CodingScheme.FREE_TEXT_CODE_VALUE;
19691
+ };
19692
+
19693
+ /**
19694
+ * Checks if the given code value is the legacy free text code value
19695
+ *
19696
+ * NOTE:
19697
+ * This is kept only for backward compatibility when reading old DICOM SRs.
19698
+ * New SRs must NOT use this legacy code value.
19699
+ *
19700
+ * @param {string} codeValue - The code value to check
19701
+ * @returns {boolean} True if the code value matches the legacy free text code (CORNERSTONEFREETEXT)
19702
+ */
19703
+ var isLegacyFreeTextCodeValue = function isLegacyFreeTextCodeValue(codeValue) {
19704
+ return codeValue === CodingScheme.CORNERSTONEFREETEXT;
19705
+ };
19706
+
19361
19707
  var FINDING = {
19362
19708
  CodingSchemeDesignator: "DCM",
19363
19709
  CodeValue: "121071"
@@ -19407,14 +19753,17 @@ var MeasurementReport$2 = /*#__PURE__*/function () {
19407
19753
  var _defaultState$finding = defaultState.findingSites,
19408
19754
  findingSites = _defaultState$finding === void 0 ? [] : _defaultState$finding,
19409
19755
  finding = defaultState.finding;
19410
- var cornersoneFreeTextCodingValue = CodingScheme.codeValues.CORNERSTONEFREETEXT;
19756
+
19757
+ // Check finding sites for new or legacy free text annotation codes
19411
19758
  var freeTextLabel = findingSites.find(function (fs) {
19412
- return fs.CodeValue === cornersoneFreeTextCodingValue;
19759
+ return isFreeTextCodeValue(fs.CodeValue) || isLegacyFreeTextCodeValue(fs.CodeValue);
19413
19760
  });
19414
19761
  if (freeTextLabel) {
19415
19762
  return freeTextLabel.CodeMeaning;
19416
19763
  }
19417
- if (finding && finding.CodeValue === cornersoneFreeTextCodingValue) {
19764
+
19765
+ // Check finding for new or legacy free text annotation codes
19766
+ if (finding && (isFreeTextCodeValue(finding.CodeValue) || isLegacyFreeTextCodeValue(finding.CodeValue))) {
19418
19767
  return finding.CodeMeaning;
19419
19768
  }
19420
19769
  }
@@ -20888,10 +21237,13 @@ var EllipticalROI = /*#__PURE__*/function () {
20888
21237
  y: bottom[1]
20889
21238
  });
20890
21239
  }
20891
- var _ref = cachedStats["imageId:".concat(referencedImageId)] || {},
20892
- area = _ref.area;
21240
+ var stats = cachedStats["imageId:".concat(referencedImageId)] || {};
20893
21241
  return {
20894
- area: area,
21242
+ area: stats.area,
21243
+ mean: stats.mean,
21244
+ max: stats.max,
21245
+ min: stats.min,
21246
+ stdDev: stats.stdDev,
20895
21247
  points: points,
20896
21248
  trackingIdentifierTextValue: trackingIdentifierTextValue$3,
20897
21249
  finding: finding,
@@ -20922,6 +21274,42 @@ EllipticalROI.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifie
20922
21274
  };
20923
21275
  MeasurementReport$2.registerTool(EllipticalROI);
20924
21276
 
21277
+ var ArrowAnnotate$1 = /*#__PURE__*/function (_OpenPolyline) {
21278
+ _inherits(ArrowAnnotate, _OpenPolyline);
21279
+ function ArrowAnnotate() {
21280
+ _classCallCheck(this, ArrowAnnotate);
21281
+ return _callSuper(this, ArrowAnnotate, arguments);
21282
+ }
21283
+ _createClass(ArrowAnnotate, [{
21284
+ key: "getPoints",
21285
+ value: function getPoints() {
21286
+ return this.props.points;
21287
+ }
21288
+ }, {
21289
+ key: "getConceptNameCodeSequence",
21290
+ value: function getConceptNameCodeSequence() {
21291
+ return addAccessors({
21292
+ CodeValue: "111010",
21293
+ CodingSchemeDesignator: "DCM",
21294
+ CodeMeaning: "label"
21295
+ });
21296
+ }
21297
+ }, {
21298
+ key: "getMeasuredValueSequence",
21299
+ value: function getMeasuredValueSequence() {
21300
+ return {
21301
+ NumericValue: 0,
21302
+ MeasurementUnitsCodeSequence: {
21303
+ CodeValue: "1",
21304
+ CodingSchemeDesignator: "UCUM",
21305
+ CodeMeaning: "no units"
21306
+ }
21307
+ };
21308
+ }
21309
+ }]);
21310
+ return ArrowAnnotate;
21311
+ }(OpenPolyline);
21312
+
20925
21313
  var ARROW_ANNOTATE = "ArrowAnnotate";
20926
21314
  var trackingIdentifierTextValue$2 = "".concat(CORNERSTONE_3D_TAG, ":").concat(ARROW_ANNOTATE);
20927
21315
  var codeValues = CodingScheme.codeValues,
@@ -21007,9 +21395,9 @@ var ArrowAnnotate = /*#__PURE__*/function () {
21007
21395
  };
21008
21396
 
21009
21397
  // If freetext finding isn't present, add it from the tool text.
21010
- if (!finding || finding.CodeValue !== codeValues.CORNERSTONEFREETEXT) {
21398
+ if (!finding || !isFreeTextCodeValue(finding.CodeValue) && !isLegacyFreeTextCodeValue(finding.CodeValue)) {
21011
21399
  finding = {
21012
- CodeValue: codeValues.CORNERSTONEFREETEXT,
21400
+ CodeValue: codeValues.FREE_TEXT_CODE_VALUE,
21013
21401
  CodingSchemeDesignator: CodingSchemeDesignator,
21014
21402
  CodeMeaning: data.text
21015
21403
  };
@@ -21022,7 +21410,7 @@ var ArrowAnnotate = /*#__PURE__*/function () {
21022
21410
  }();
21023
21411
  ArrowAnnotate.toolType = ARROW_ANNOTATE;
21024
21412
  ArrowAnnotate.utilityToolType = ARROW_ANNOTATE;
21025
- ArrowAnnotate.TID300Representation = Point$1;
21413
+ ArrowAnnotate.TID300Representation = ArrowAnnotate$1;
21026
21414
  ArrowAnnotate.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
21027
21415
  if (!TrackingIdentifier.includes(":")) {
21028
21416
  return false;
@@ -21657,6 +22045,13 @@ var Polygon$1 = /*#__PURE__*/function (_TID300Measurement) {
21657
22045
  points: points,
21658
22046
  use3DSpatialCoordinates: use3DSpatialCoordinates
21659
22047
  });
22048
+ var graphicContentSequence = new TID320ContentItem({
22049
+ graphicType: "POLYGON",
22050
+ graphicData: GraphicData,
22051
+ use3DSpatialCoordinates: use3DSpatialCoordinates,
22052
+ referencedSOPSequence: ReferencedSOPSequence,
22053
+ referencedFrameOfReferenceUID: ReferencedFrameOfReferenceUID
22054
+ }).contentItem();
21660
22055
  return this.getMeasurement([{
21661
22056
  RelationshipType: "CONTAINS",
21662
22057
  ValueType: "NUM",
@@ -21669,18 +22064,7 @@ var Polygon$1 = /*#__PURE__*/function (_TID300Measurement) {
21669
22064
  MeasurementUnitsCodeSequence: unit2CodingValue(unit),
21670
22065
  NumericValue: perimeter
21671
22066
  },
21672
- ContentSequence: {
21673
- RelationshipType: "INFERRED FROM",
21674
- ValueType: use3DSpatialCoordinates ? "SCOORD3D" : "SCOORD",
21675
- GraphicType: "POLYGON",
21676
- GraphicData: GraphicData,
21677
- ReferencedFrameOfReferenceUID: use3DSpatialCoordinates ? ReferencedFrameOfReferenceUID : undefined,
21678
- ContentSequence: use3DSpatialCoordinates ? undefined : {
21679
- RelationshipType: "SELECTED FROM",
21680
- ValueType: "IMAGE",
21681
- ReferencedSOPSequence: ReferencedSOPSequence
21682
- }
21683
- }
22067
+ ContentSequence: graphicContentSequence
21684
22068
  }, {
21685
22069
  RelationshipType: "CONTAINS",
21686
22070
  ValueType: "NUM",
@@ -21693,18 +22077,7 @@ var Polygon$1 = /*#__PURE__*/function (_TID300Measurement) {
21693
22077
  MeasurementUnitsCodeSequence: unit2CodingValue(areaUnit),
21694
22078
  NumericValue: area
21695
22079
  },
21696
- ContentSequence: {
21697
- RelationshipType: "INFERRED FROM",
21698
- ValueType: use3DSpatialCoordinates ? "SCOORD3D" : "SCOORD",
21699
- GraphicType: "POLYGON",
21700
- GraphicData: GraphicData,
21701
- ReferencedFrameOfReferenceUID: use3DSpatialCoordinates ? ReferencedFrameOfReferenceUID : undefined,
21702
- ContentSequence: use3DSpatialCoordinates ? undefined : {
21703
- RelationshipType: "SELECTED FROM",
21704
- ValueType: "IMAGE",
21705
- ReferencedSOPSequence: ReferencedSOPSequence
21706
- }
21707
- }
22080
+ ContentSequence: graphicContentSequence
21708
22081
  }]);
21709
22082
  }
21710
22083
  }]);
@@ -21919,58 +22292,44 @@ var TID1500 = {
21919
22292
  TID1501MeasurementGroup: TID1501MeasurementGroup
21920
22293
  };
21921
22294
 
21922
- var Calibration = /*#__PURE__*/function (_TID300Measurement) {
21923
- _inherits(Calibration, _TID300Measurement);
22295
+ var Calibration = /*#__PURE__*/function (_OpenPolyline) {
22296
+ _inherits(Calibration, _OpenPolyline);
21924
22297
  function Calibration() {
21925
22298
  _classCallCheck(this, Calibration);
21926
22299
  return _callSuper(this, Calibration, arguments);
21927
22300
  }
21928
22301
  _createClass(Calibration, [{
21929
- key: "contentItem",
21930
- value: function contentItem() {
22302
+ key: "getPoints",
22303
+ value: function getPoints() {
21931
22304
  var _this$props = this.props,
21932
22305
  point1 = _this$props.point1,
21933
- point2 = _this$props.point2,
21934
- _this$props$unit = _this$props.unit,
21935
- unit = _this$props$unit === void 0 ? "mm" : _this$props$unit,
21936
- _this$props$use3DSpat = _this$props.use3DSpatialCoordinates,
21937
- use3DSpatialCoordinates = _this$props$use3DSpat === void 0 ? false : _this$props$use3DSpat,
21938
- distance = _this$props.distance,
21939
- ReferencedSOPSequence = _this$props.ReferencedSOPSequence,
21940
- ReferencedFrameOfReferenceUID = _this$props.ReferencedFrameOfReferenceUID;
21941
- var GraphicData = this.flattenPoints({
21942
- points: [point1, point2],
21943
- use3DSpatialCoordinates: use3DSpatialCoordinates
21944
- });
21945
- return this.getMeasurement([{
21946
- RelationshipType: "CONTAINS",
21947
- ValueType: "NUM",
21948
- ConceptNameCodeSequence: {
21949
- CodeValue: "102304005",
21950
- CodingSchemeDesignator: "SCT",
21951
- CodeMeaning: "Calibration Ruler"
21952
- },
21953
- MeasuredValueSequence: {
21954
- MeasurementUnitsCodeSequence: unit2CodingValue(unit),
21955
- NumericValue: distance
21956
- },
21957
- ContentSequence: {
21958
- RelationshipType: "INFERRED FROM",
21959
- ValueType: use3DSpatialCoordinates ? "SCOORD3D" : "SCOORD",
21960
- GraphicType: "POLYLINE",
21961
- GraphicData: GraphicData,
21962
- ReferencedFrameOfReferenceUID: use3DSpatialCoordinates ? ReferencedFrameOfReferenceUID : undefined,
21963
- ContentSequence: use3DSpatialCoordinates ? undefined : {
21964
- RelationshipType: "SELECTED FROM",
21965
- ValueType: "IMAGE",
21966
- ReferencedSOPSequence: ReferencedSOPSequence
21967
- }
21968
- }
21969
- }]);
22306
+ point2 = _this$props.point2;
22307
+ return [point1, point2];
22308
+ }
22309
+ }, {
22310
+ key: "getConceptNameCodeSequence",
22311
+ value: function getConceptNameCodeSequence() {
22312
+ return {
22313
+ CodeValue: "102304005",
22314
+ CodingSchemeDesignator: "SCT",
22315
+ CodeMeaning: "Calibration Ruler"
22316
+ };
22317
+ }
22318
+ }, {
22319
+ key: "getMeasuredValueSequence",
22320
+ value: function getMeasuredValueSequence() {
22321
+ var _this$props2 = this.props,
22322
+ distance = _this$props2.distance,
22323
+ _this$props2$unit = _this$props2.unit,
22324
+ unit = _this$props2$unit === void 0 ? "mm" : _this$props2$unit;
22325
+ return {
22326
+ MeasurementUnitsCodeSequence: unit2CodingValue(unit),
22327
+ NumericValue: distance
22328
+ };
21970
22329
  }
21971
22330
  }]);
21972
22331
  return Calibration;
21973
- }(TID300Measurement);
22332
+ }(OpenPolyline);
21974
22333
 
21975
22334
  // To be implemented:
21976
22335
  // - Cornerstone Probe
@@ -22032,6 +22391,7 @@ var TID300 = {
22032
22391
  TID300Measurement: TID300Measurement,
22033
22392
  Point: Point$1,
22034
22393
  Length: Length$2,
22394
+ ArrowAnnotate: ArrowAnnotate$1,
22035
22395
  CobbAngle: CobbAngle$1,
22036
22396
  Bidirectional: Bidirectional$2,
22037
22397
  Polyline: Polyline$1,
@@ -22581,7 +22941,7 @@ var ContentItem = /*#__PURE__*/_createClass(function ContentItem(options) {
22581
22941
  if (!(options.name instanceof CodedConcept)) {
22582
22942
  throw new Error("Option 'name' must have type CodedConcept.");
22583
22943
  }
22584
- this.ConceptNameCodeSequence = [options.name];
22944
+ this.ConceptNameCodeSequence = addAccessors([options.name]);
22585
22945
  if (options.valueType === undefined) {
22586
22946
  throw new Error("Option 'valueType' is required for ContentItem.");
22587
22947
  }
@@ -22619,7 +22979,7 @@ var CodeContentItem = /*#__PURE__*/function (_ContentItem) {
22619
22979
  if (!(options.value instanceof CodedConcept)) {
22620
22980
  throw new Error("Option 'value' must have type CodedConcept.");
22621
22981
  }
22622
- _this.ConceptCodeSequence = [options.value];
22982
+ _this.ConceptCodeSequence = addAccessors([options.value]);
22623
22983
  return _this;
22624
22984
  }
22625
22985
  return _createClass(CodeContentItem);
@@ -22919,6 +23279,7 @@ var ScoordContentItem = /*#__PURE__*/function (_ContentItem10) {
22919
23279
  if (options.graphicData[0] instanceof Array) {
22920
23280
  options.graphicData = [].concat.apply([], options.graphicData);
22921
23281
  }
23282
+ _this10.GraphicType = options.graphicType;
22922
23283
  _this10.GraphicData = options.graphicData;
22923
23284
  options.pixelOriginInterpretation = options.pixelOriginInterpretation || PixelOriginInterpretations.VOLUME;
22924
23285
  if (!(typeof options.pixelOriginInterpretation === "string" || options.pixelOriginInterpretation instanceof String)) {