@cornerstonejs/adapters 2.0.0-beta.26 → 2.0.0-beta.28

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 (50) hide show
  1. package/dist/esm/adapters/Cornerstone/Angle.d.ts +0 -3
  2. package/dist/esm/adapters/Cornerstone/CircleRoi.d.ts +0 -7
  3. package/dist/esm/adapters/Cornerstone/MeasurementReport.d.ts +0 -7
  4. package/dist/esm/adapters/Cornerstone/ParametricMap.js +2 -8
  5. package/dist/esm/adapters/Cornerstone/Segmentation.d.ts +0 -31
  6. package/dist/esm/adapters/Cornerstone/Segmentation_3X.d.ts +0 -32
  7. package/dist/esm/adapters/Cornerstone/Segmentation_4X.d.ts +0 -41
  8. package/dist/esm/adapters/Cornerstone/Segmentation_4X.js +2 -3
  9. package/dist/esm/adapters/Cornerstone3D/Angle.js +9 -10
  10. package/dist/esm/adapters/Cornerstone3D/Bidirectional.js +8 -7
  11. package/dist/esm/adapters/Cornerstone3D/CircleROI.d.ts +0 -7
  12. package/dist/esm/adapters/Cornerstone3D/CircleROI.js +9 -16
  13. package/dist/esm/adapters/Cornerstone3D/CobbAngle.js +9 -9
  14. package/dist/esm/adapters/Cornerstone3D/EllipticalROI.js +8 -18
  15. package/dist/esm/adapters/Cornerstone3D/MeasurementReport.d.ts +0 -7
  16. package/dist/esm/adapters/Cornerstone3D/MeasurementReport.js +7 -40
  17. package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.d.ts +0 -2
  18. package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.js +9 -12
  19. package/dist/esm/adapters/Cornerstone3D/RTStruct/RTSS.d.ts +0 -23
  20. package/dist/esm/adapters/Cornerstone3D/RTStruct/RTSS.js +1 -76
  21. package/dist/esm/adapters/Cornerstone3D/RectangleROI.js +8 -6
  22. package/dist/esm/adapters/Cornerstone3D/Segmentation/generateLabelMaps2DFrom3D.d.ts +0 -6
  23. package/dist/esm/adapters/Cornerstone3D/Segmentation/generateLabelMaps2DFrom3D.js +0 -11
  24. package/dist/esm/adapters/Cornerstone3D/Segmentation/generateSegmentation.d.ts +0 -6
  25. package/dist/esm/adapters/Cornerstone3D/Segmentation/generateSegmentation.js +0 -18
  26. package/dist/esm/adapters/Cornerstone3D/Segmentation/generateToolState.d.ts +0 -14
  27. package/dist/esm/adapters/Cornerstone3D/Segmentation/generateToolState.js +0 -14
  28. package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.js +9 -9
  29. package/dist/esm/adapters/Cornerstone3D/isValidCornerstoneTrackingIdentifier.js +0 -2
  30. package/dist/esm/adapters/VTKjs/Segmentation.d.ts +0 -38
  31. package/dist/esm/adapters/enums/Events.d.ts +0 -6
  32. package/dist/esm/adapters/enums/Events.js +0 -6
  33. package/dist/esm/adapters/helpers/checkIfPerpendicular.d.ts +0 -8
  34. package/dist/esm/adapters/helpers/checkIfPerpendicular.js +0 -8
  35. package/dist/esm/adapters/helpers/checkOrientation.js +0 -2
  36. package/dist/esm/adapters/helpers/codeMeaningEquals.d.ts +0 -7
  37. package/dist/esm/adapters/helpers/codeMeaningEquals.js +0 -7
  38. package/dist/esm/adapters/helpers/compareArrays.d.ts +0 -8
  39. package/dist/esm/adapters/helpers/compareArrays.js +0 -8
  40. package/dist/esm/adapters/helpers/downloadDICOMData.d.ts +0 -5
  41. package/dist/esm/adapters/helpers/downloadDICOMData.js +0 -5
  42. package/dist/esm/adapters/helpers/getDatasetsFromImages.d.ts +0 -8
  43. package/dist/esm/adapters/helpers/getDatasetsFromImages.js +0 -8
  44. package/dist/esm/adapters/helpers/graphicTypeEquals.d.ts +0 -5
  45. package/dist/esm/adapters/helpers/graphicTypeEquals.js +0 -5
  46. package/dist/esm/adapters/index.js +0 -1
  47. package/dist/umd/adapters.umd.js +76 -303
  48. package/dist/umd/adapters.umd.js.map +1 -1
  49. package/package.json +41 -16
  50. package/dist/esm/node_modules/lodash.clonedeep/index.js +0 -1692
@@ -1,4 +1,4 @@
1
- import { defineProperty as _defineProperty, createClass as _createClass, objectSpread2 as _objectSpread2, classCallCheck as _classCallCheck } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
+ import { objectSpread2 as _objectSpread2, createClass as _createClass, classCallCheck as _classCallCheck } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { utilities, derivations, normalizers, data } from 'dcmjs';
3
3
  import CORNERSTONE_3D_TAG from './cornerstone3DTag.js';
4
4
  import { toArray } from '../helpers/toArray.js';
@@ -47,8 +47,6 @@ function getMeasurementGroup(toolType, toolData, ReferencedSOPSequence, worldToI
47
47
  if (!toolTypeData || !toolTypeData.data || !toolTypeData.data.length || !toolClass) {
48
48
  return;
49
49
  }
50
- // Loop through the array of tool instances
51
- // for this tool
52
50
  var Measurements = toolTypeData.data.map(function (tool) {
53
51
  return getTID300ContentItem(tool, toolType, ReferencedSOPSequence, toolClass, worldToImageCoords);
54
52
  });
@@ -78,9 +76,6 @@ var MeasurementReport = /*#__PURE__*/function () {
78
76
  }, {
79
77
  key: "generateDatasetMeta",
80
78
  value: function generateDatasetMeta() {
81
- // TODO: what is the correct metaheader
82
- // http://dicom.nema.org/medical/Dicom/current/output/chtml/part10/chapter_7.html
83
- // TODO: move meta creation to happen in derivations.js
84
79
  var fileMetaInformationVersionArray = new Uint8Array(2);
85
80
  fileMetaInformationVersionArray[1] = 1;
86
81
  var _meta = {
@@ -88,15 +83,12 @@ var MeasurementReport = /*#__PURE__*/function () {
88
83
  Value: [fileMetaInformationVersionArray.buffer],
89
84
  vr: "OB"
90
85
  },
91
- //MediaStorageSOPClassUID
92
- //MediaStorageSOPInstanceUID: sopCommonModule.sopInstanceUID,
93
86
  TransferSyntaxUID: {
94
87
  Value: ["1.2.840.10008.1.2.1"],
95
88
  vr: "UI"
96
89
  },
97
90
  ImplementationClassUID: {
98
91
  Value: [DicomMetaDictionary.uid()],
99
- // TODO: could be git hash or other valid id
100
92
  vr: "UI"
101
93
  },
102
94
  ImplementationVersionName: {
@@ -164,19 +156,10 @@ var MeasurementReport = /*#__PURE__*/function () {
164
156
  }, {
165
157
  key: "generateReport",
166
158
  value: function generateReport(toolState, metadataProvider, worldToImageCoords, options) {
167
- // ToolState for array of imageIDs to a Report
168
- // Assume Cornerstone metadata provider has access to Study / Series / Sop Instance UID
169
159
  var allMeasurementGroups = [];
170
- /* Patient ID
171
- Warning - Missing attribute or value that would be needed to build DICOMDIR - Patient ID
172
- Warning - Missing attribute or value that would be needed to build DICOMDIR - Study Date
173
- Warning - Missing attribute or value that would be needed to build DICOMDIR - Study Time
174
- Warning - Missing attribute or value that would be needed to build DICOMDIR - Study ID
175
- */
176
160
  var sopInstanceUIDsToSeriesInstanceUIDMap = {};
177
161
  var derivationSourceDatasets = [];
178
162
  var _meta = MeasurementReport.generateDatasetMeta();
179
- // Loop through each image in the toolData
180
163
  Object.keys(toolState).forEach(function (imageId) {
181
164
  var sopCommonModule = metadataProvider.get("sopCommonModule", imageId);
182
165
  var instance = metadataProvider.get("instance", imageId);
@@ -187,7 +170,6 @@ var MeasurementReport = /*#__PURE__*/function () {
187
170
  if (!derivationSourceDatasets.find(function (dsd) {
188
171
  return dsd.SeriesInstanceUID === seriesInstanceUID;
189
172
  })) {
190
- // Entry not present for series, create one.
191
173
  var derivationSourceDataset = MeasurementReport.generateDerivationSourceDataset(instance);
192
174
  derivationSourceDatasets.push(derivationSourceDataset);
193
175
  }
@@ -202,7 +184,6 @@ var MeasurementReport = /*#__PURE__*/function () {
202
184
  if (instance && instance.NumberOfFrames && instance.NumberOfFrames > 1 || Normalizer.isMultiframeSOPClassUID(sopClassUID)) {
203
185
  ReferencedSOPSequence.ReferencedFrameNumber = frameNumber;
204
186
  }
205
- // Loop through each tool type for the image
206
187
  var measurementGroups = [];
207
188
  toolTypes.forEach(function (toolType) {
208
189
  var group = getMeasurementGroup(toolType, toolData, ReferencedSOPSequence, worldToImageCoords);
@@ -219,19 +200,14 @@ var MeasurementReport = /*#__PURE__*/function () {
219
200
  var contentItem = tid1500MeasurementReport.contentItem(derivationSourceDatasets, _objectSpread2(_objectSpread2({}, options), {}, {
220
201
  sopInstanceUIDsToSeriesInstanceUIDMap: sopInstanceUIDsToSeriesInstanceUIDMap
221
202
  }));
222
- // Merge the derived dataset with the content from the Measurement Report
223
203
  report.dataset = Object.assign(report.dataset, contentItem);
224
204
  report.dataset._meta = _meta;
225
205
  report.SpecificCharacterSet = "ISO_IR 192";
226
206
  return report;
227
207
  }
228
- /**
229
- * Generate Cornerstone tool state from dataset
230
- */
231
208
  }, {
232
209
  key: "generateToolState",
233
210
  value: function generateToolState(dataset, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata, hooks) {
234
- // For now, bail out if the dataset is not a TID1500 SR with length measurements
235
211
  if (dataset.ContentTemplateSequence.TemplateIdentifier !== "1500") {
236
212
  throw new Error("This package can currently only interpret DICOM SR TID 1500");
237
213
  }
@@ -239,11 +215,8 @@ var MeasurementReport = /*#__PURE__*/function () {
239
215
  var GROUP = "Measurement Group";
240
216
  var TRACKING_IDENTIFIER = "Tracking Identifier";
241
217
  var TRACKING_UNIQUE_IDENTIFIER = "Tracking Unique Identifier";
242
- // Identify the Imaging Measurements
243
218
  var imagingMeasurementContent = toArray(dataset.ContentSequence).find(codeMeaningEquals(REPORT));
244
- // Retrieve the Measurements themselves
245
219
  var measurementGroups = toArray(imagingMeasurementContent.ContentSequence).filter(codeMeaningEquals(GROUP));
246
- // For each of the supported measurement types, compute the measurement data
247
220
  var measurementData = {};
248
221
  var cornerstoneToolClasses = MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE;
249
222
  var registeredToolClasses = [];
@@ -277,14 +250,8 @@ var MeasurementReport = /*#__PURE__*/function () {
277
250
  console.warn("Unable to generate tool state for", measurementGroup, e);
278
251
  }
279
252
  });
280
- // NOTE: There is no way of knowing the cornerstone imageIds as that could be anything.
281
- // That is up to the consumer to derive from the SOPInstanceUIDs.
282
253
  return measurementData;
283
254
  }
284
- /**
285
- * Register a new tool type.
286
- * @param toolClass to perform I/O to DICOM for this tool
287
- */
288
255
  }, {
289
256
  key: "registerTool",
290
257
  value: function registerTool(toolClass) {
@@ -295,11 +262,11 @@ var MeasurementReport = /*#__PURE__*/function () {
295
262
  }]);
296
263
  }();
297
264
  _MeasurementReport = MeasurementReport;
298
- _defineProperty(MeasurementReport, "CORNERSTONE_3D_TAG", CORNERSTONE_3D_TAG);
299
- _defineProperty(MeasurementReport, "MEASUREMENT_BY_TOOLTYPE", {});
300
- _defineProperty(MeasurementReport, "CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE", {});
301
- _defineProperty(MeasurementReport, "CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE", {});
302
- _defineProperty(MeasurementReport, "generateDerivationSourceDataset", function (instance) {
265
+ _MeasurementReport.CORNERSTONE_3D_TAG = CORNERSTONE_3D_TAG;
266
+ _MeasurementReport.MEASUREMENT_BY_TOOLTYPE = {};
267
+ _MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE = {};
268
+ _MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE = {};
269
+ _MeasurementReport.generateDerivationSourceDataset = function (instance) {
303
270
  var _vrMap = {
304
271
  PixelData: "OW"
305
272
  };
@@ -309,6 +276,6 @@ _defineProperty(MeasurementReport, "generateDerivationSourceDataset", function (
309
276
  _vrMap: _vrMap
310
277
  });
311
278
  return derivationSourceDataset;
312
- });
279
+ };
313
280
 
314
281
  export { MeasurementReport as default };
@@ -20,7 +20,6 @@ declare class PlanarFreehandROI {
20
20
  findingSites: any[];
21
21
  };
22
22
  static getTID300RepresentationArguments(tool: any, worldToImageCoords: any): {
23
- /** From cachedStats */
24
23
  points: any;
25
24
  area: any;
26
25
  areaUnit: any;
@@ -29,7 +28,6 @@ declare class PlanarFreehandROI {
29
28
  mean: any;
30
29
  max: any;
31
30
  stdDev: any;
32
- /** Other */
33
31
  trackingIdentifierTextValue: string;
34
32
  finding: any;
35
33
  findingSites: any;
@@ -1,9 +1,10 @@
1
- import { defineProperty as _defineProperty, createClass as _createClass, slicedToArray as _slicedToArray, classCallCheck as _classCallCheck } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
+ import { slicedToArray as _slicedToArray, createClass as _createClass, defineProperty as _defineProperty, classCallCheck as _classCallCheck } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import MeasurementReport from './MeasurementReport.js';
3
3
  import { utilities } from 'dcmjs';
4
4
  import CORNERSTONE_3D_TAG from './cornerstone3DTag.js';
5
5
  import { vec3 } from 'gl-matrix';
6
6
 
7
+ var _PlanarFreehandROI;
7
8
  var TID300Polyline = utilities.TID300.Polyline;
8
9
  var PLANARFREEHANDROI = "PlanarFreehandROI";
9
10
  var trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(PLANARFREEHANDROI);
@@ -29,9 +30,8 @@ var PlanarFreehandROI = /*#__PURE__*/function () {
29
30
  }
30
31
  var distanceBetweenFirstAndLastPoint = vec3.distance(worldCoords[worldCoords.length - 1], worldCoords[0]);
31
32
  var isOpenContour = true;
32
- // If the contour is closed, this should have been encoded as exactly the same point, so check for a very small difference.
33
33
  if (distanceBetweenFirstAndLastPoint < closedContourThreshold) {
34
- worldCoords.pop(); // Remove the last element which is duplicated.
34
+ worldCoords.pop();
35
35
  isOpenContour = false;
36
36
  }
37
37
  var points = [];
@@ -77,9 +77,7 @@ var PlanarFreehandROI = /*#__PURE__*/function () {
77
77
  return worldToImageCoords(referencedImageId, worldPos);
78
78
  });
79
79
  if (!isOpenContour) {
80
- // Need to repeat the first point at the end of to have an explicitly closed contour.
81
80
  var firstPoint = points[0];
82
- // Explicitly expand to avoid circular references.
83
81
  points.push([firstPoint[0], firstPoint[1]]);
84
82
  }
85
83
  var _ref = data.cachedStats["imageId:".concat(referencedImageId)] || {},
@@ -91,7 +89,6 @@ var PlanarFreehandROI = /*#__PURE__*/function () {
91
89
  max = _ref.max,
92
90
  stdDev = _ref.stdDev;
93
91
  return {
94
- /** From cachedStats */
95
92
  points: points,
96
93
  area: area,
97
94
  areaUnit: areaUnit,
@@ -100,7 +97,6 @@ var PlanarFreehandROI = /*#__PURE__*/function () {
100
97
  mean: mean,
101
98
  max: max,
102
99
  stdDev: stdDev,
103
- /** Other */
104
100
  trackingIdentifierTextValue: trackingIdentifierTextValue,
105
101
  finding: finding,
106
102
  findingSites: findingSites || []
@@ -108,10 +104,11 @@ var PlanarFreehandROI = /*#__PURE__*/function () {
108
104
  }
109
105
  }]);
110
106
  }();
111
- _defineProperty(PlanarFreehandROI, "toolType", PLANARFREEHANDROI);
112
- _defineProperty(PlanarFreehandROI, "utilityToolType", PLANARFREEHANDROI);
113
- _defineProperty(PlanarFreehandROI, "TID300Representation", TID300Polyline);
114
- _defineProperty(PlanarFreehandROI, "isValidCornerstoneTrackingIdentifier", function (TrackingIdentifier) {
107
+ _PlanarFreehandROI = PlanarFreehandROI;
108
+ _PlanarFreehandROI.toolType = PLANARFREEHANDROI;
109
+ _PlanarFreehandROI.utilityToolType = PLANARFREEHANDROI;
110
+ _PlanarFreehandROI.TID300Representation = TID300Polyline;
111
+ _PlanarFreehandROI.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
115
112
  if (!TrackingIdentifier.includes(":")) {
116
113
  return false;
117
114
  }
@@ -123,7 +120,7 @@ _defineProperty(PlanarFreehandROI, "isValidCornerstoneTrackingIdentifier", funct
123
120
  return false;
124
121
  }
125
122
  return toolType === PLANARFREEHANDROI;
126
- });
123
+ };
127
124
  MeasurementReport.registerTool(PlanarFreehandROI);
128
125
 
129
126
  export { PlanarFreehandROI as default };
@@ -1,16 +1,3 @@
1
- /**
2
- * Convert handles to RTSS report containing the dcmjs dicom dataset.
3
- *
4
- * Note: current WIP and using segmentation to contour conversion,
5
- * routine that is not fully tested
6
- *
7
- * @param segmentations - Cornerstone tool segmentations data
8
- * @param metadataProvider - Metadata provider
9
- * @param DicomMetadataStore - metadata store instance
10
- * @param cs - cornerstone instance
11
- * @param csTools - cornerstone tool instance
12
- * @returns Report object containing the dataset
13
- */
14
1
  declare function generateRTSSFromSegmentations(segmentations: any, metadataProvider: any, DicomMetadataStore: any): {
15
2
  StudyInstanceUID: any;
16
3
  SOPClassUID: string;
@@ -44,16 +31,6 @@ declare function generateRTSSFromSegmentations(segmentations: any, metadataProvi
44
31
  ReferencedSeriesSequence: any[];
45
32
  ReferencedFrameOfReferenceSequence: any[];
46
33
  };
47
- /**
48
- * Convert handles to RTSSReport report object containing the dcmjs dicom dataset.
49
- *
50
- * Note: The tool data needs to be formatted in a specific way, and currently
51
- * it is limited to the RectangleROIStartEndTool in the Cornerstone.
52
- *
53
- * @param annotations - Array of Cornerstone tool annotation data
54
- * @param metadataProvider - Metadata provider
55
- * @returns Report object containing the dataset
56
- */
57
34
  declare function generateRTSSFromAnnotations(annotations: any, metadataProvider: any, DicomMetadataStore: any): {
58
35
  StudyInstanceUID: any;
59
36
  SOPClassUID: string;
@@ -12,64 +12,22 @@ var _utilities$contours = utilities.contours,
12
12
  generateContourSetsFromLabelmap = _utilities$contours.generateContourSetsFromLabelmap,
13
13
  AnnotationToPointData = _utilities$contours.AnnotationToPointData;
14
14
  var DicomMetaDictionary = dcmjs.data.DicomMetaDictionary;
15
- /**
16
- * Convert handles to RTSS report containing the dcmjs dicom dataset.
17
- *
18
- * Note: current WIP and using segmentation to contour conversion,
19
- * routine that is not fully tested
20
- *
21
- * @param segmentations - Cornerstone tool segmentations data
22
- * @param metadataProvider - Metadata provider
23
- * @param DicomMetadataStore - metadata store instance
24
- * @param cs - cornerstone instance
25
- * @param csTools - cornerstone tool instance
26
- * @returns Report object containing the dataset
27
- */
28
15
  function generateRTSSFromSegmentations(segmentations, metadataProvider, DicomMetadataStore) {
29
- // Convert segmentations to ROIContours
30
16
  var roiContours = [];
31
17
  var contourSets = generateContourSetsFromLabelmap({
32
18
  segmentations: segmentations
33
19
  });
34
20
  contourSets.forEach(function (contourSet, segIndex) {
35
- // Check contour set isn't undefined
36
21
  if (contourSet) {
37
22
  var contourSequence = [];
38
23
  contourSet.sliceContours.forEach(function (sliceContour) {
39
- /**
40
- * addContour - Adds a new ROI with related contours to ROIContourSequence
41
- *
42
- * @param newContour - cornerstoneTools `ROIContour` object
43
- *
44
- * newContour = {
45
- * name: string,
46
- * description: string,
47
- * contourSequence: array[contour]
48
- * color: array[number],
49
- * metadata: {
50
- * referencedImageId: string,
51
- * FrameOfReferenceUID: string
52
- * }
53
- * }
54
- *
55
- * contour = {
56
- * ContourImageSequence: array[
57
- * { ReferencedSOPClassUID: string, ReferencedSOPInstanceUID: string}
58
- * ]
59
- * ContourGeometricType: string,
60
- * NumberOfContourPoints: number,
61
- * ContourData: array[number]
62
- * }
63
- */
64
- // Note: change needed if support non-planar contour representation is needed
65
24
  var sopCommon = metadataProvider.get("sopCommonModule", sliceContour.referencedImageId);
66
25
  var ReferencedSOPClassUID = sopCommon.sopClassUID;
67
26
  var ReferencedSOPInstanceUID = sopCommon.sopInstanceUID;
68
27
  var ContourImageSequence = [{
69
28
  ReferencedSOPClassUID: ReferencedSOPClassUID,
70
29
  ReferencedSOPInstanceUID: ReferencedSOPInstanceUID
71
- } // NOTE: replace in dcmjs?
72
- ];
30
+ }];
73
31
  var sliceContourPolyData = sliceContour.polyData;
74
32
  sliceContour.contours.forEach(function (contour, index) {
75
33
  var ContourGeometricType = contour.type;
@@ -117,9 +75,7 @@ function generateRTSSFromSegmentations(segmentations, metadataProvider, DicomMet
117
75
  };
118
76
  dataset.StructureSetROISequence.push(getStructureSetModule(contour, index));
119
77
  dataset.ROIContourSequence.push(roiContour);
120
- // ReferencedSeriesSequence
121
78
  dataset.ReferencedSeriesSequence = getReferencedSeriesSequence(contour.metadata, index, metadataProvider, DicomMetadataStore);
122
- // ReferencedFrameOfReferenceSequence
123
79
  dataset.ReferencedFrameOfReferenceSequence = getReferencedFrameOfReferenceSequence(contour.metadata, metadataProvider, dataset);
124
80
  });
125
81
  var fileMetaInformationVersionArray = new Uint8Array(2);
@@ -135,7 +91,6 @@ function generateRTSSFromSegmentations(segmentations, metadataProvider, DicomMet
135
91
  },
136
92
  ImplementationClassUID: {
137
93
  Value: [DicomMetaDictionary.uid()],
138
- // TODO: could be git hash or other valid id
139
94
  vr: "UI"
140
95
  },
141
96
  ImplementationVersionName: {
@@ -144,20 +99,9 @@ function generateRTSSFromSegmentations(segmentations, metadataProvider, DicomMet
144
99
  }
145
100
  };
146
101
  dataset._meta = _meta;
147
- // @ts-ignore
148
102
  dataset.SpecificCharacterSet = "ISO_IR 192";
149
103
  return dataset;
150
104
  }
151
- /**
152
- * Convert handles to RTSSReport report object containing the dcmjs dicom dataset.
153
- *
154
- * Note: The tool data needs to be formatted in a specific way, and currently
155
- * it is limited to the RectangleROIStartEndTool in the Cornerstone.
156
- *
157
- * @param annotations - Array of Cornerstone tool annotation data
158
- * @param metadataProvider - Metadata provider
159
- * @returns Report object containing the dataset
160
- */
161
105
  function generateRTSSFromAnnotations(annotations, metadataProvider, DicomMetadataStore) {
162
106
  var rtMetadata = {
163
107
  name: "RTSS from Annotations",
@@ -169,10 +113,7 @@ function generateRTSSFromAnnotations(annotations, metadataProvider, DicomMetadat
169
113
  dataset.StructureSetROISequence.push(getStructureSetModule(annotation, index));
170
114
  dataset.ROIContourSequence.push(ContourSequence);
171
115
  dataset.RTROIObservationsSequence.push(getRTROIObservationsSequence(annotation, index));
172
- // ReferencedSeriesSequence
173
- // Todo: handle more than one series
174
116
  dataset.ReferencedSeriesSequence = getReferencedSeriesSequence(annotation.metadata, index, metadataProvider, DicomMetadataStore);
175
- // ReferencedFrameOfReferenceSequence
176
117
  dataset.ReferencedFrameOfReferenceSequence = getReferencedFrameOfReferenceSequence(annotation.metadata, metadataProvider, dataset);
177
118
  });
178
119
  var fileMetaInformationVersionArray = new Uint8Array(2);
@@ -188,7 +129,6 @@ function generateRTSSFromAnnotations(annotations, metadataProvider, DicomMetadat
188
129
  },
189
130
  ImplementationClassUID: {
190
131
  Value: [DicomMetaDictionary.uid()],
191
- // TODO: could be git hash or other valid id
192
132
  vr: "UI"
193
133
  },
194
134
  ImplementationVersionName: {
@@ -197,25 +137,11 @@ function generateRTSSFromAnnotations(annotations, metadataProvider, DicomMetadat
197
137
  }
198
138
  };
199
139
  dataset._meta = _meta;
200
- //@ts-ignore
201
140
  dataset.SpecificCharacterSet = "ISO_IR 192";
202
141
  return dataset;
203
142
  }
204
- // /**
205
- // * Generate Cornerstone tool state from dataset
206
- // * @param {object} dataset dataset
207
- // * @param {object} hooks
208
- // * @param {function} hooks.getToolClass Function to map dataset to a tool class
209
- // * @returns
210
- // */
211
- // //static generateToolState(_dataset, _hooks = {}) {
212
- // function generateToolState() {
213
- // // Todo
214
- // console.warn("RTSS.generateToolState not implemented");
215
- // }
216
143
  function _initializeDataset(rtMetadata, imgMetadata, metadataProvider) {
217
144
  var rtSOPInstanceUID = DicomMetaDictionary.uid();
218
- // get the first annotation data
219
145
  var imageId = imgMetadata.referencedImageId,
220
146
  FrameOfReferenceUID = imgMetadata.FrameOfReferenceUID;
221
147
  var _metadataProvider$get = metadataProvider.get("generalSeriesModule", imageId),
@@ -231,7 +157,6 @@ function _initializeDataset(rtMetadata, imgMetadata, metadataProvider) {
231
157
  }, patientModule), rtSeriesModule), {}, {
232
158
  StudyInstanceUID: studyInstanceUID,
233
159
  SOPClassUID: "1.2.840.10008.5.1.4.1.1.481.3",
234
- // RT Structure Set Storage
235
160
  SOPInstanceUID: rtSOPInstanceUID,
236
161
  Manufacturer: "dcmjs",
237
162
  Modality: "RTSTRUCT",
@@ -1,8 +1,9 @@
1
- import { defineProperty as _defineProperty, createClass as _createClass, slicedToArray as _slicedToArray, classCallCheck as _classCallCheck } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
+ import { slicedToArray as _slicedToArray, createClass as _createClass, defineProperty as _defineProperty, classCallCheck as _classCallCheck } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { utilities } from 'dcmjs';
3
3
  import CORNERSTONE_3D_TAG from './cornerstone3DTag.js';
4
4
  import MeasurementReport from './MeasurementReport.js';
5
5
 
6
+ var _RectangleROI;
6
7
  var TID300Polyline = utilities.TID300.Polyline;
7
8
  var TOOLTYPE = "RectangleROI";
8
9
  var trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(TOOLTYPE);
@@ -71,10 +72,11 @@ var RectangleROI = /*#__PURE__*/function () {
71
72
  }
72
73
  }]);
73
74
  }();
74
- _defineProperty(RectangleROI, "toolType", TOOLTYPE);
75
- _defineProperty(RectangleROI, "utilityToolType", TOOLTYPE);
76
- _defineProperty(RectangleROI, "TID300Representation", TID300Polyline);
77
- _defineProperty(RectangleROI, "isValidCornerstoneTrackingIdentifier", function (TrackingIdentifier) {
75
+ _RectangleROI = RectangleROI;
76
+ _RectangleROI.toolType = TOOLTYPE;
77
+ _RectangleROI.utilityToolType = TOOLTYPE;
78
+ _RectangleROI.TID300Representation = TID300Polyline;
79
+ _RectangleROI.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
78
80
  if (!TrackingIdentifier.includes(":")) {
79
81
  return false;
80
82
  }
@@ -86,7 +88,7 @@ _defineProperty(RectangleROI, "isValidCornerstoneTrackingIdentifier", function (
86
88
  return false;
87
89
  }
88
90
  return toolType === TOOLTYPE;
89
- });
91
+ };
90
92
  MeasurementReport.registerTool(RectangleROI);
91
93
 
92
94
  export { RectangleROI as default };
@@ -1,9 +1,3 @@
1
- /**
2
- * Generates 2D label maps from a 3D label map.
3
- * @param labelmap3D - The 3D label map object to generate 2D label maps from. It is derived
4
- * from the volume labelmap.
5
- * @returns The label map object containing the 2D label maps and segments on label maps.
6
- */
7
1
  declare function generateLabelMaps2DFrom3D(labelmap3D: any): {
8
2
  scalarData: number[];
9
3
  dimensions: number[];
@@ -1,18 +1,8 @@
1
- /**
2
- * Generates 2D label maps from a 3D label map.
3
- * @param labelmap3D - The 3D label map object to generate 2D label maps from. It is derived
4
- * from the volume labelmap.
5
- * @returns The label map object containing the 2D label maps and segments on label maps.
6
- */
7
1
  function generateLabelMaps2DFrom3D(labelmap3D) {
8
- // 1. we need to generate labelmaps2D from labelmaps3D, a labelmap2D is for each
9
- // slice
10
2
  var scalarData = labelmap3D.scalarData,
11
3
  dimensions = labelmap3D.dimensions;
12
- // scalarData is a flat array of all the pixels in the volume.
13
4
  var labelmaps2D = [];
14
5
  var segmentsOnLabelmap3D = new Set();
15
- // X-Y are the row and column dimensions, Z is the number of slices.
16
6
  for (var z = 0; z < dimensions[2]; z++) {
17
7
  var pixelData = scalarData.slice(z * dimensions[0] * dimensions[1], (z + 1) * dimensions[0] * dimensions[1]);
18
8
  var segmentsOnLabelmap = [];
@@ -36,7 +26,6 @@ function generateLabelMaps2DFrom3D(labelmap3D) {
36
26
  });
37
27
  labelmaps2D[dimensions[2] - 1 - z] = labelmap2D;
38
28
  }
39
- // remove segment 0 from segmentsOnLabelmap3D
40
29
  labelmap3D.segmentsOnLabelmap = Array.from(segmentsOnLabelmap3D);
41
30
  labelmap3D.labelmaps2D = labelmaps2D;
42
31
  return labelmap3D;
@@ -1,8 +1,2 @@
1
- /**
2
- * generateSegmentation - Generates a DICOM Segmentation object given cornerstoneTools data.
3
- *
4
- * @param images - An array of the cornerstone image objects, which includes imageId and metadata
5
- * @param labelmaps - An array of the 3D Volumes that contain the segmentation data.
6
- */
7
1
  declare function generateSegmentation(images: any, labelmaps: any, metadata: any, options?: {}): any;
8
2
  export { generateSegmentation };
@@ -4,33 +4,15 @@ import { fillSegmentation } from '../../Cornerstone/Segmentation_4X.js';
4
4
 
5
5
  var Normalizer = normalizers.Normalizer;
6
6
  var SegmentationDerivation = derivations.Segmentation;
7
- /**
8
- * generateSegmentation - Generates a DICOM Segmentation object given cornerstoneTools data.
9
- *
10
- * @param images - An array of the cornerstone image objects, which includes imageId and metadata
11
- * @param labelmaps - An array of the 3D Volumes that contain the segmentation data.
12
- */
13
7
  function generateSegmentation(images, labelmaps, metadata) {
14
8
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
15
9
  var segmentation = _createMultiframeSegmentationFromReferencedImages(images, metadata, options);
16
10
  return fillSegmentation(segmentation, labelmaps, options);
17
11
  }
18
- /**
19
- * _createMultiframeSegmentationFromReferencedImages - description
20
- *
21
- * @param images - An array of the cornerstone image objects related to the reference
22
- * series that the segmentation is derived from. You can use methods such as
23
- * volume.getCornerstoneImages() to get this array.
24
- *
25
- * @param options - the options object for the SegmentationDerivation.
26
- * @returns The Seg derived dataSet.
27
- */
28
12
  function _createMultiframeSegmentationFromReferencedImages(images, metadata, options) {
29
13
  var datasets = images.map(function (image) {
30
- // add the sopClassUID to the dataset
31
14
  var instance = metadata.get("instance", image.imageId);
32
15
  return _objectSpread2(_objectSpread2(_objectSpread2({}, image), instance), {}, {
33
- // Todo: move to dcmjs tag style
34
16
  SOPClassUID: instance.SopClassUID || instance.SOPClassUID,
35
17
  SOPInstanceUID: instance.SopInstanceUID || instance.SOPInstanceUID,
36
18
  PixelData: image.voxelManager.getScalarData(),
@@ -1,16 +1,2 @@
1
- /**
2
- * generateToolState - Given a set of cornerstoneTools imageIds and a Segmentation buffer,
3
- * derive cornerstoneTools toolState and brush metadata.
4
- *
5
- * @param imageIds - An array of the imageIds.
6
- * @param arrayBuffer - The SEG arrayBuffer.
7
- * @param skipOverlapping - skip checks for overlapping segs, default value false.
8
- * @param tolerance - default value 1.e-3.
9
- *
10
- * @returns a list of array buffer for each labelMap
11
- * an object from which the segment metadata can be derived
12
- * list containing the track of segments per frame
13
- * list containing the track of segments per frame for each labelMap (available only for the overlapping case).
14
- */
15
1
  declare function generateToolState(imageIds: any, arrayBuffer: any, metadataProvider: any, skipOverlapping?: boolean, tolerance?: number): any;
16
2
  export { generateToolState };
@@ -2,20 +2,6 @@ import { CornerstoneSEG } from '../../Cornerstone/index.js';
2
2
 
3
3
  var Segmentation = CornerstoneSEG.Segmentation;
4
4
  var generateToolStateCornerstoneLegacy = Segmentation.generateToolState;
5
- /**
6
- * generateToolState - Given a set of cornerstoneTools imageIds and a Segmentation buffer,
7
- * derive cornerstoneTools toolState and brush metadata.
8
- *
9
- * @param imageIds - An array of the imageIds.
10
- * @param arrayBuffer - The SEG arrayBuffer.
11
- * @param skipOverlapping - skip checks for overlapping segs, default value false.
12
- * @param tolerance - default value 1.e-3.
13
- *
14
- * @returns a list of array buffer for each labelMap
15
- * an object from which the segment metadata can be derived
16
- * list containing the track of segments per frame
17
- * list containing the track of segments per frame for each labelMap (available only for the overlapping case).
18
- */
19
5
  function generateToolState(imageIds, arrayBuffer, metadataProvider) {
20
6
  var skipOverlapping = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
21
7
  var tolerance = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1e-3;
@@ -1,8 +1,9 @@
1
- import { defineProperty as _defineProperty, createClass as _createClass, slicedToArray as _slicedToArray, classCallCheck as _classCallCheck } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
+ import { slicedToArray as _slicedToArray, createClass as _createClass, classCallCheck as _classCallCheck } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { utilities } from 'dcmjs';
3
3
  import CORNERSTONE_3D_TAG from './cornerstone3DTag.js';
4
4
  import MeasurementReport from './MeasurementReport.js';
5
5
 
6
+ var _UltrasoundDirectional;
6
7
  var TID300Length = utilities.TID300.Length;
7
8
  var ULTRASOUND_DIRECTIONAL = "UltrasoundDirectionalTool";
8
9
  var trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(ULTRASOUND_DIRECTIONAL);
@@ -12,9 +13,7 @@ var UltrasoundDirectional = /*#__PURE__*/function () {
12
13
  }
13
14
  return _createClass(UltrasoundDirectional, null, [{
14
15
  key: "getMeasurementData",
15
- value:
16
- // TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport.
17
- function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
16
+ value: function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
18
17
  var _MeasurementReport$ge = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, UltrasoundDirectional.toolType),
19
18
  defaultState = _MeasurementReport$ge.defaultState,
20
19
  SCOORDGroup = _MeasurementReport$ge.SCOORDGroup,
@@ -72,10 +71,11 @@ var UltrasoundDirectional = /*#__PURE__*/function () {
72
71
  }
73
72
  }]);
74
73
  }();
75
- _defineProperty(UltrasoundDirectional, "toolType", ULTRASOUND_DIRECTIONAL);
76
- _defineProperty(UltrasoundDirectional, "utilityToolType", ULTRASOUND_DIRECTIONAL);
77
- _defineProperty(UltrasoundDirectional, "TID300Representation", TID300Length);
78
- _defineProperty(UltrasoundDirectional, "isValidCornerstoneTrackingIdentifier", function (TrackingIdentifier) {
74
+ _UltrasoundDirectional = UltrasoundDirectional;
75
+ _UltrasoundDirectional.toolType = ULTRASOUND_DIRECTIONAL;
76
+ _UltrasoundDirectional.utilityToolType = ULTRASOUND_DIRECTIONAL;
77
+ _UltrasoundDirectional.TID300Representation = TID300Length;
78
+ _UltrasoundDirectional.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
79
79
  if (!TrackingIdentifier.includes(":")) {
80
80
  return false;
81
81
  }
@@ -87,7 +87,7 @@ _defineProperty(UltrasoundDirectional, "isValidCornerstoneTrackingIdentifier", f
87
87
  return false;
88
88
  }
89
89
  return toolType === ULTRASOUND_DIRECTIONAL;
90
- });
90
+ };
91
91
  MeasurementReport.registerTool(UltrasoundDirectional);
92
92
 
93
93
  export { UltrasoundDirectional as default };
@@ -12,8 +12,6 @@ function isValidCornerstoneTrackingIdentifier(trackingIdentifier) {
12
12
  if (cornerstone3DTag !== CORNERSTONE_3D_TAG) {
13
13
  return false;
14
14
  }
15
- // The following is needed since the new cornerstone3D has changed
16
- // case names such as EllipticalRoi to EllipticalROI
17
15
  return toolType.toLowerCase() === this.toolType.toLowerCase();
18
16
  }
19
17