@cornerstonejs/adapters 2.0.0-beta.2 → 2.0.0-beta.21
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/dist/esm/_virtual/_rollupPluginBabelHelpers.js +493 -0
- package/dist/esm/adapters/Cornerstone/Angle.d.ts +45 -0
- package/dist/esm/adapters/Cornerstone/Angle.js +93 -0
- package/dist/esm/adapters/Cornerstone/ArrowAnnotate.d.ts +49 -0
- package/dist/esm/adapters/Cornerstone/ArrowAnnotate.js +97 -0
- package/dist/esm/adapters/Cornerstone/Bidirectional.d.ts +89 -0
- package/dist/esm/adapters/Cornerstone/Bidirectional.js +170 -0
- package/dist/esm/adapters/Cornerstone/CircleRoi.d.ts +65 -0
- package/dist/esm/adapters/Cornerstone/CircleRoi.js +115 -0
- package/dist/esm/adapters/Cornerstone/CobbAngle.d.ts +49 -0
- package/dist/esm/adapters/Cornerstone/CobbAngle.js +98 -0
- package/dist/esm/adapters/Cornerstone/EllipticalRoi.d.ts +57 -0
- package/dist/esm/adapters/Cornerstone/EllipticalRoi.js +178 -0
- package/dist/esm/adapters/Cornerstone/FreehandRoi.d.ts +42 -0
- package/dist/esm/adapters/Cornerstone/FreehandRoi.js +89 -0
- package/dist/esm/adapters/Cornerstone/Length.d.ts +39 -0
- package/dist/esm/adapters/Cornerstone/Length.js +82 -0
- package/dist/esm/adapters/Cornerstone/MeasurementReport.d.ts +36 -0
- package/dist/esm/adapters/Cornerstone/MeasurementReport.js +276 -0
- package/dist/esm/adapters/Cornerstone/RectangleRoi.d.ts +44 -0
- package/dist/esm/adapters/Cornerstone/RectangleRoi.js +97 -0
- package/dist/esm/adapters/Cornerstone/Segmentation.d.ts +44 -0
- package/dist/esm/adapters/Cornerstone/Segmentation.js +79 -0
- package/dist/esm/adapters/Cornerstone/Segmentation_3X.d.ts +45 -0
- package/dist/esm/adapters/Cornerstone/Segmentation_3X.js +428 -0
- package/dist/esm/adapters/Cornerstone/Segmentation_4X.d.ts +54 -0
- package/dist/esm/adapters/Cornerstone/Segmentation_4X.js +1200 -0
- package/dist/esm/adapters/Cornerstone/cornerstone4Tag.d.ts +2 -0
- package/dist/esm/adapters/Cornerstone/cornerstone4Tag.js +3 -0
- package/dist/esm/adapters/Cornerstone/index.d.ts +34 -0
- package/dist/esm/adapters/Cornerstone/index.js +29 -0
- package/dist/esm/adapters/Cornerstone3D/Angle.js +110 -0
- package/dist/esm/adapters/Cornerstone3D/ArrowAnnotate.d.ts +35 -0
- package/dist/esm/adapters/Cornerstone3D/ArrowAnnotate.js +123 -0
- package/dist/esm/adapters/Cornerstone3D/Bidirectional.js +146 -0
- package/dist/esm/adapters/Cornerstone3D/CircleROI.js +103 -0
- package/dist/esm/adapters/Cornerstone3D/CobbAngle.js +113 -0
- package/dist/esm/adapters/Cornerstone3D/CodingScheme.d.ts +9 -0
- package/dist/esm/adapters/Cornerstone3D/CodingScheme.js +15 -0
- package/dist/esm/adapters/Cornerstone3D/EllipticalROI.js +170 -0
- package/dist/esm/adapters/Cornerstone3D/Length.d.ts +41 -0
- package/dist/esm/adapters/Cornerstone3D/Length.js +101 -0
- package/dist/{types → esm}/adapters/Cornerstone3D/MeasurementReport.d.ts +1 -1
- package/dist/esm/adapters/Cornerstone3D/MeasurementReport.js +314 -0
- package/dist/{types → esm}/adapters/Cornerstone3D/PlanarFreehandROI.d.ts +9 -2
- package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.js +129 -0
- package/dist/esm/adapters/Cornerstone3D/Probe.d.ts +33 -0
- package/dist/esm/adapters/Cornerstone3D/Probe.js +87 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/RTSS.d.ts +90 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/RTSS.js +250 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/index.d.ts +4 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/index.js +6 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getPatientModule.d.ts +13 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getPatientModule.js +22 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getRTROIObservationsSequence.d.ts +6 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getRTROIObservationsSequence.js +10 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getRTSeriesModule.d.ts +4 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getRTSeriesModule.js +9 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getReferencedFrameOfReferenceSequence.d.ts +11 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getReferencedFrameOfReferenceSequence.js +22 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getReferencedSeriesSequence.d.ts +4 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getReferencedSeriesSequence.js +27 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getStructureSetModule.d.ts +7 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getStructureSetModule.js +12 -0
- package/dist/esm/adapters/Cornerstone3D/RectangleROI.js +92 -0
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateLabelMaps2DFrom3D.js +45 -0
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateSegmentation.js +47 -0
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateToolState.js +25 -0
- package/dist/esm/adapters/Cornerstone3D/Segmentation/index.js +3 -0
- package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.d.ts +36 -0
- package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.js +93 -0
- package/dist/esm/adapters/Cornerstone3D/cornerstone3DTag.d.ts +2 -0
- package/dist/esm/adapters/Cornerstone3D/cornerstone3DTag.js +3 -0
- package/dist/{types → esm}/adapters/Cornerstone3D/index.d.ts +20 -6
- package/dist/esm/adapters/Cornerstone3D/index.js +41 -0
- package/dist/esm/adapters/Cornerstone3D/isValidCornerstoneTrackingIdentifier.js +20 -0
- package/dist/esm/adapters/VTKjs/Segmentation.d.ts +41 -0
- package/dist/esm/adapters/VTKjs/Segmentation.js +186 -0
- package/dist/esm/adapters/VTKjs/index.d.ts +5 -0
- package/dist/esm/adapters/VTKjs/index.js +7 -0
- package/dist/esm/adapters/enums/Events.js +13 -0
- package/dist/esm/adapters/enums/index.js +1 -0
- package/dist/esm/adapters/helpers/codeMeaningEquals.js +14 -0
- package/dist/{types → esm}/adapters/helpers/downloadDICOMData.d.ts +1 -1
- package/dist/esm/adapters/helpers/downloadDICOMData.js +31 -0
- package/dist/esm/adapters/helpers/graphicTypeEquals.js +12 -0
- package/dist/esm/adapters/helpers/index.js +4 -0
- package/dist/esm/adapters/helpers/toArray.js +5 -0
- package/dist/esm/adapters/index.d.ts +62 -0
- package/dist/esm/adapters/index.js +20 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +5 -0
- package/dist/umd/adapters.umd.js +5738 -0
- package/dist/umd/adapters.umd.js.map +1 -0
- package/package.json +14 -10
- package/dist/adapters.es.js +0 -5194
- package/dist/adapters.es.js.map +0 -1
- package/dist/types/adapters/Cornerstone/index.d.ts +0 -16
- package/dist/types/adapters/VTKjs/index.d.ts +0 -4
- package/dist/types/adapters/index.d.ts +0 -43
- package/dist/types/index.d.ts +0 -2
- /package/dist/{types → esm}/adapters/Cornerstone3D/Angle.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/Bidirectional.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/CircleROI.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/CobbAngle.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/EllipticalROI.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/RectangleROI.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/Segmentation/generateLabelMaps2DFrom3D.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/Segmentation/generateSegmentation.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/Segmentation/generateToolState.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/Segmentation/index.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/isValidCornerstoneTrackingIdentifier.d.ts +0 -0
- /package/dist/{types → esm}/adapters/enums/Events.d.ts +0 -0
- /package/dist/{types → esm}/adapters/enums/index.d.ts +0 -0
- /package/dist/{types → esm}/adapters/helpers/codeMeaningEquals.d.ts +0 -0
- /package/dist/{types → esm}/adapters/helpers/graphicTypeEquals.d.ts +0 -0
- /package/dist/{types → esm}/adapters/helpers/index.d.ts +0 -0
- /package/dist/{types → esm}/adapters/helpers/toArray.d.ts +0 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { defineProperty as _defineProperty, createClass as _createClass, objectSpread2 as _objectSpread2, classCallCheck as _classCallCheck } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { utilities, derivations, normalizers, data } from 'dcmjs';
|
|
3
|
+
import CORNERSTONE_3D_TAG from './cornerstone3DTag.js';
|
|
4
|
+
import { toArray } from '../helpers/toArray.js';
|
|
5
|
+
import { codeMeaningEquals } from '../helpers/codeMeaningEquals.js';
|
|
6
|
+
import '../helpers/downloadDICOMData.js';
|
|
7
|
+
import CodingScheme from './CodingScheme.js';
|
|
8
|
+
|
|
9
|
+
var _MeasurementReport;
|
|
10
|
+
var TID1500 = utilities.TID1500,
|
|
11
|
+
addAccessors = utilities.addAccessors;
|
|
12
|
+
var StructuredReport = derivations.StructuredReport;
|
|
13
|
+
var Normalizer = normalizers.Normalizer;
|
|
14
|
+
var TID1500MeasurementReport = TID1500.TID1500MeasurementReport,
|
|
15
|
+
TID1501MeasurementGroup = TID1500.TID1501MeasurementGroup;
|
|
16
|
+
var DicomMetaDictionary = data.DicomMetaDictionary;
|
|
17
|
+
var FINDING = {
|
|
18
|
+
CodingSchemeDesignator: "DCM",
|
|
19
|
+
CodeValue: "121071"
|
|
20
|
+
};
|
|
21
|
+
var FINDING_SITE = {
|
|
22
|
+
CodingSchemeDesignator: "SCT",
|
|
23
|
+
CodeValue: "363698007"
|
|
24
|
+
};
|
|
25
|
+
var FINDING_SITE_OLD = {
|
|
26
|
+
CodingSchemeDesignator: "SRT",
|
|
27
|
+
CodeValue: "G-C0E3"
|
|
28
|
+
};
|
|
29
|
+
var codeValueMatch = function codeValueMatch(group, code, oldCode) {
|
|
30
|
+
var ConceptNameCodeSequence = group.ConceptNameCodeSequence;
|
|
31
|
+
if (!ConceptNameCodeSequence) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
var CodingSchemeDesignator = ConceptNameCodeSequence.CodingSchemeDesignator,
|
|
35
|
+
CodeValue = ConceptNameCodeSequence.CodeValue;
|
|
36
|
+
return CodingSchemeDesignator == code.CodingSchemeDesignator && CodeValue == code.CodeValue || oldCode && CodingSchemeDesignator == oldCode.CodingSchemeDesignator && CodeValue == oldCode.CodeValue;
|
|
37
|
+
};
|
|
38
|
+
function getTID300ContentItem(tool, toolType, ReferencedSOPSequence, toolClass, worldToImageCoords) {
|
|
39
|
+
var args = toolClass.getTID300RepresentationArguments(tool, worldToImageCoords);
|
|
40
|
+
args.ReferencedSOPSequence = ReferencedSOPSequence;
|
|
41
|
+
var TID300Measurement = new toolClass.TID300Representation(args);
|
|
42
|
+
return TID300Measurement;
|
|
43
|
+
}
|
|
44
|
+
function getMeasurementGroup(toolType, toolData, ReferencedSOPSequence, worldToImageCoords) {
|
|
45
|
+
var toolTypeData = toolData[toolType];
|
|
46
|
+
var toolClass = MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE[toolType];
|
|
47
|
+
if (!toolTypeData || !toolTypeData.data || !toolTypeData.data.length || !toolClass) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
// Loop through the array of tool instances
|
|
51
|
+
// for this tool
|
|
52
|
+
var Measurements = toolTypeData.data.map(function (tool) {
|
|
53
|
+
return getTID300ContentItem(tool, toolType, ReferencedSOPSequence, toolClass, worldToImageCoords);
|
|
54
|
+
});
|
|
55
|
+
return new TID1501MeasurementGroup(Measurements);
|
|
56
|
+
}
|
|
57
|
+
var MeasurementReport = /*#__PURE__*/function () {
|
|
58
|
+
function MeasurementReport() {
|
|
59
|
+
_classCallCheck(this, MeasurementReport);
|
|
60
|
+
}
|
|
61
|
+
return _createClass(MeasurementReport, null, [{
|
|
62
|
+
key: "getCornerstoneLabelFromDefaultState",
|
|
63
|
+
value: function getCornerstoneLabelFromDefaultState(defaultState) {
|
|
64
|
+
var _defaultState$finding = defaultState.findingSites,
|
|
65
|
+
findingSites = _defaultState$finding === void 0 ? [] : _defaultState$finding,
|
|
66
|
+
finding = defaultState.finding;
|
|
67
|
+
var cornersoneFreeTextCodingValue = CodingScheme.codeValues.CORNERSTONEFREETEXT;
|
|
68
|
+
var freeTextLabel = findingSites.find(function (fs) {
|
|
69
|
+
return fs.CodeValue === cornersoneFreeTextCodingValue;
|
|
70
|
+
});
|
|
71
|
+
if (freeTextLabel) {
|
|
72
|
+
return freeTextLabel.CodeMeaning;
|
|
73
|
+
}
|
|
74
|
+
if (finding && finding.CodeValue === cornersoneFreeTextCodingValue) {
|
|
75
|
+
return finding.CodeMeaning;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
79
|
+
key: "generateDatasetMeta",
|
|
80
|
+
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
|
+
var fileMetaInformationVersionArray = new Uint8Array(2);
|
|
85
|
+
fileMetaInformationVersionArray[1] = 1;
|
|
86
|
+
var _meta = {
|
|
87
|
+
FileMetaInformationVersion: {
|
|
88
|
+
Value: [fileMetaInformationVersionArray.buffer],
|
|
89
|
+
vr: "OB"
|
|
90
|
+
},
|
|
91
|
+
//MediaStorageSOPClassUID
|
|
92
|
+
//MediaStorageSOPInstanceUID: sopCommonModule.sopInstanceUID,
|
|
93
|
+
TransferSyntaxUID: {
|
|
94
|
+
Value: ["1.2.840.10008.1.2.1"],
|
|
95
|
+
vr: "UI"
|
|
96
|
+
},
|
|
97
|
+
ImplementationClassUID: {
|
|
98
|
+
Value: [DicomMetaDictionary.uid()],
|
|
99
|
+
// TODO: could be git hash or other valid id
|
|
100
|
+
vr: "UI"
|
|
101
|
+
},
|
|
102
|
+
ImplementationVersionName: {
|
|
103
|
+
Value: ["dcmjs"],
|
|
104
|
+
vr: "SH"
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
return _meta;
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
key: "getSetupMeasurementData",
|
|
111
|
+
value: function getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, toolType) {
|
|
112
|
+
var ContentSequence = MeasurementGroup.ContentSequence;
|
|
113
|
+
var contentSequenceArr = toArray(ContentSequence);
|
|
114
|
+
var findingGroup = contentSequenceArr.find(function (group) {
|
|
115
|
+
return codeValueMatch(group, FINDING);
|
|
116
|
+
});
|
|
117
|
+
var findingSiteGroups = contentSequenceArr.filter(function (group) {
|
|
118
|
+
return codeValueMatch(group, FINDING_SITE, FINDING_SITE_OLD);
|
|
119
|
+
}) || [];
|
|
120
|
+
var NUMGroup = contentSequenceArr.find(function (group) {
|
|
121
|
+
return group.ValueType === "NUM";
|
|
122
|
+
});
|
|
123
|
+
var SCOORDGroup = toArray(NUMGroup.ContentSequence).find(function (group) {
|
|
124
|
+
return group.ValueType === "SCOORD";
|
|
125
|
+
});
|
|
126
|
+
var ReferencedSOPSequence = SCOORDGroup.ContentSequence.ReferencedSOPSequence;
|
|
127
|
+
var ReferencedSOPInstanceUID = ReferencedSOPSequence.ReferencedSOPInstanceUID,
|
|
128
|
+
ReferencedFrameNumber = ReferencedSOPSequence.ReferencedFrameNumber;
|
|
129
|
+
var referencedImageId = sopInstanceUIDToImageIdMap[ReferencedSOPInstanceUID];
|
|
130
|
+
var imagePlaneModule = metadata.get("imagePlaneModule", referencedImageId);
|
|
131
|
+
var finding = findingGroup ? addAccessors(findingGroup.ConceptCodeSequence) : undefined;
|
|
132
|
+
var findingSites = findingSiteGroups.map(function (fsg) {
|
|
133
|
+
return addAccessors(fsg.ConceptCodeSequence);
|
|
134
|
+
});
|
|
135
|
+
var defaultState = {
|
|
136
|
+
description: undefined,
|
|
137
|
+
sopInstanceUid: ReferencedSOPInstanceUID,
|
|
138
|
+
annotation: {
|
|
139
|
+
annotationUID: DicomMetaDictionary.uid(),
|
|
140
|
+
metadata: {
|
|
141
|
+
toolName: toolType,
|
|
142
|
+
referencedImageId: referencedImageId,
|
|
143
|
+
FrameOfReferenceUID: imagePlaneModule.frameOfReferenceUID,
|
|
144
|
+
label: ""
|
|
145
|
+
},
|
|
146
|
+
data: undefined
|
|
147
|
+
},
|
|
148
|
+
finding: finding,
|
|
149
|
+
findingSites: findingSites
|
|
150
|
+
};
|
|
151
|
+
if (defaultState.finding) {
|
|
152
|
+
defaultState.description = defaultState.finding.CodeMeaning;
|
|
153
|
+
}
|
|
154
|
+
defaultState.annotation.metadata.label = MeasurementReport.getCornerstoneLabelFromDefaultState(defaultState);
|
|
155
|
+
return {
|
|
156
|
+
defaultState: defaultState,
|
|
157
|
+
NUMGroup: NUMGroup,
|
|
158
|
+
SCOORDGroup: SCOORDGroup,
|
|
159
|
+
ReferencedSOPSequence: ReferencedSOPSequence,
|
|
160
|
+
ReferencedSOPInstanceUID: ReferencedSOPInstanceUID,
|
|
161
|
+
ReferencedFrameNumber: ReferencedFrameNumber
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
}, {
|
|
165
|
+
key: "generateReport",
|
|
166
|
+
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
|
+
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
|
+
var sopInstanceUIDsToSeriesInstanceUIDMap = {};
|
|
177
|
+
var derivationSourceDatasets = [];
|
|
178
|
+
var _meta = MeasurementReport.generateDatasetMeta();
|
|
179
|
+
// Loop through each image in the toolData
|
|
180
|
+
Object.keys(toolState).forEach(function (imageId) {
|
|
181
|
+
var sopCommonModule = metadataProvider.get("sopCommonModule", imageId);
|
|
182
|
+
var instance = metadataProvider.get("instance", imageId);
|
|
183
|
+
var sopInstanceUID = sopCommonModule.sopInstanceUID,
|
|
184
|
+
sopClassUID = sopCommonModule.sopClassUID;
|
|
185
|
+
var seriesInstanceUID = instance.SeriesInstanceUID;
|
|
186
|
+
sopInstanceUIDsToSeriesInstanceUIDMap[sopInstanceUID] = seriesInstanceUID;
|
|
187
|
+
if (!derivationSourceDatasets.find(function (dsd) {
|
|
188
|
+
return dsd.SeriesInstanceUID === seriesInstanceUID;
|
|
189
|
+
})) {
|
|
190
|
+
// Entry not present for series, create one.
|
|
191
|
+
var derivationSourceDataset = MeasurementReport.generateDerivationSourceDataset(instance);
|
|
192
|
+
derivationSourceDatasets.push(derivationSourceDataset);
|
|
193
|
+
}
|
|
194
|
+
var frameNumber = metadataProvider.get("frameNumber", imageId);
|
|
195
|
+
var toolData = toolState[imageId];
|
|
196
|
+
var toolTypes = Object.keys(toolData);
|
|
197
|
+
var ReferencedSOPSequence = {
|
|
198
|
+
ReferencedSOPClassUID: sopClassUID,
|
|
199
|
+
ReferencedSOPInstanceUID: sopInstanceUID,
|
|
200
|
+
ReferencedFrameNumber: undefined
|
|
201
|
+
};
|
|
202
|
+
if (instance && instance.NumberOfFrames && instance.NumberOfFrames > 1 || Normalizer.isMultiframeSOPClassUID(sopClassUID)) {
|
|
203
|
+
ReferencedSOPSequence.ReferencedFrameNumber = frameNumber;
|
|
204
|
+
}
|
|
205
|
+
// Loop through each tool type for the image
|
|
206
|
+
var measurementGroups = [];
|
|
207
|
+
toolTypes.forEach(function (toolType) {
|
|
208
|
+
var group = getMeasurementGroup(toolType, toolData, ReferencedSOPSequence, worldToImageCoords);
|
|
209
|
+
if (group) {
|
|
210
|
+
measurementGroups.push(group);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
allMeasurementGroups = allMeasurementGroups.concat(measurementGroups);
|
|
214
|
+
});
|
|
215
|
+
var tid1500MeasurementReport = new TID1500MeasurementReport({
|
|
216
|
+
TID1501MeasurementGroups: allMeasurementGroups
|
|
217
|
+
}, options);
|
|
218
|
+
var report = new StructuredReport(derivationSourceDatasets, options);
|
|
219
|
+
var contentItem = tid1500MeasurementReport.contentItem(derivationSourceDatasets, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
220
|
+
sopInstanceUIDsToSeriesInstanceUIDMap: sopInstanceUIDsToSeriesInstanceUIDMap
|
|
221
|
+
}));
|
|
222
|
+
// Merge the derived dataset with the content from the Measurement Report
|
|
223
|
+
report.dataset = Object.assign(report.dataset, contentItem);
|
|
224
|
+
report.dataset._meta = _meta;
|
|
225
|
+
report.SpecificCharacterSet = "ISO_IR 192";
|
|
226
|
+
return report;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Generate Cornerstone tool state from dataset
|
|
230
|
+
*/
|
|
231
|
+
}, {
|
|
232
|
+
key: "generateToolState",
|
|
233
|
+
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
|
+
if (dataset.ContentTemplateSequence.TemplateIdentifier !== "1500") {
|
|
236
|
+
throw new Error("This package can currently only interpret DICOM SR TID 1500");
|
|
237
|
+
}
|
|
238
|
+
var REPORT = "Imaging Measurements";
|
|
239
|
+
var GROUP = "Measurement Group";
|
|
240
|
+
var TRACKING_IDENTIFIER = "Tracking Identifier";
|
|
241
|
+
var TRACKING_UNIQUE_IDENTIFIER = "Tracking Unique Identifier";
|
|
242
|
+
// Identify the Imaging Measurements
|
|
243
|
+
var imagingMeasurementContent = toArray(dataset.ContentSequence).find(codeMeaningEquals(REPORT));
|
|
244
|
+
// Retrieve the Measurements themselves
|
|
245
|
+
var measurementGroups = toArray(imagingMeasurementContent.ContentSequence).filter(codeMeaningEquals(GROUP));
|
|
246
|
+
// For each of the supported measurement types, compute the measurement data
|
|
247
|
+
var measurementData = {};
|
|
248
|
+
var cornerstoneToolClasses = MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE;
|
|
249
|
+
var registeredToolClasses = [];
|
|
250
|
+
Object.keys(cornerstoneToolClasses).forEach(function (key) {
|
|
251
|
+
registeredToolClasses.push(cornerstoneToolClasses[key]);
|
|
252
|
+
measurementData[key] = [];
|
|
253
|
+
});
|
|
254
|
+
measurementGroups.forEach(function (measurementGroup) {
|
|
255
|
+
try {
|
|
256
|
+
var _hooks$getToolClass;
|
|
257
|
+
var measurementGroupContentSequence = toArray(measurementGroup.ContentSequence);
|
|
258
|
+
var TrackingIdentifierGroup = measurementGroupContentSequence.find(function (contentItem) {
|
|
259
|
+
return contentItem.ConceptNameCodeSequence.CodeMeaning === TRACKING_IDENTIFIER;
|
|
260
|
+
});
|
|
261
|
+
var TrackingIdentifierValue = TrackingIdentifierGroup.TextValue;
|
|
262
|
+
var TrackingUniqueIdentifierGroup = measurementGroupContentSequence.find(function (contentItem) {
|
|
263
|
+
return contentItem.ConceptNameCodeSequence.CodeMeaning === TRACKING_UNIQUE_IDENTIFIER;
|
|
264
|
+
});
|
|
265
|
+
var TrackingUniqueIdentifierValue = TrackingUniqueIdentifierGroup === null || TrackingUniqueIdentifierGroup === void 0 ? void 0 : TrackingUniqueIdentifierGroup.UID;
|
|
266
|
+
var toolClass = (hooks === null || hooks === void 0 || (_hooks$getToolClass = hooks.getToolClass) === null || _hooks$getToolClass === void 0 ? void 0 : _hooks$getToolClass.call(hooks, measurementGroup, dataset, registeredToolClasses)) || registeredToolClasses.find(function (tc) {
|
|
267
|
+
return tc.isValidCornerstoneTrackingIdentifier(TrackingIdentifierValue);
|
|
268
|
+
});
|
|
269
|
+
if (toolClass) {
|
|
270
|
+
var measurement = toolClass.getMeasurementData(measurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata);
|
|
271
|
+
measurement.TrackingUniqueIdentifier = TrackingUniqueIdentifierValue;
|
|
272
|
+
console.log("=== ".concat(toolClass.toolType, " ==="));
|
|
273
|
+
console.log(measurement);
|
|
274
|
+
measurementData[toolClass.toolType].push(measurement);
|
|
275
|
+
}
|
|
276
|
+
} catch (e) {
|
|
277
|
+
console.warn("Unable to generate tool state for", measurementGroup, e);
|
|
278
|
+
}
|
|
279
|
+
});
|
|
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
|
+
return measurementData;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Register a new tool type.
|
|
286
|
+
* @param toolClass to perform I/O to DICOM for this tool
|
|
287
|
+
*/
|
|
288
|
+
}, {
|
|
289
|
+
key: "registerTool",
|
|
290
|
+
value: function registerTool(toolClass) {
|
|
291
|
+
MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE[toolClass.utilityToolType] = toolClass;
|
|
292
|
+
MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE[toolClass.toolType] = toolClass;
|
|
293
|
+
MeasurementReport.MEASUREMENT_BY_TOOLTYPE[toolClass.toolType] = toolClass.utilityToolType;
|
|
294
|
+
}
|
|
295
|
+
}]);
|
|
296
|
+
}();
|
|
297
|
+
_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) {
|
|
303
|
+
var _vrMap = {
|
|
304
|
+
PixelData: "OW"
|
|
305
|
+
};
|
|
306
|
+
var _meta = _MeasurementReport.generateDatasetMeta();
|
|
307
|
+
var derivationSourceDataset = _objectSpread2(_objectSpread2({}, instance), {}, {
|
|
308
|
+
_meta: _meta,
|
|
309
|
+
_vrMap: _vrMap
|
|
310
|
+
});
|
|
311
|
+
return derivationSourceDataset;
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
export { MeasurementReport as default };
|
|
@@ -20,9 +20,16 @@ declare class PlanarFreehandROI {
|
|
|
20
20
|
findingSites: any[];
|
|
21
21
|
};
|
|
22
22
|
static getTID300RepresentationArguments(tool: any, worldToImageCoords: any): {
|
|
23
|
+
/** From cachedStats */
|
|
23
24
|
points: any;
|
|
24
|
-
area:
|
|
25
|
-
|
|
25
|
+
area: any;
|
|
26
|
+
areaUnits: any;
|
|
27
|
+
perimeter: any;
|
|
28
|
+
pixelValueUnits: any;
|
|
29
|
+
mean: any;
|
|
30
|
+
max: any;
|
|
31
|
+
stdDev: any;
|
|
32
|
+
/** Other */
|
|
26
33
|
trackingIdentifierTextValue: string;
|
|
27
34
|
finding: any;
|
|
28
35
|
findingSites: any;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { defineProperty as _defineProperty, createClass as _createClass, slicedToArray as _slicedToArray, classCallCheck as _classCallCheck } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import MeasurementReport from './MeasurementReport.js';
|
|
3
|
+
import { utilities } from 'dcmjs';
|
|
4
|
+
import CORNERSTONE_3D_TAG from './cornerstone3DTag.js';
|
|
5
|
+
import { vec3 } from 'gl-matrix';
|
|
6
|
+
|
|
7
|
+
var TID300Polyline = utilities.TID300.Polyline;
|
|
8
|
+
var PLANARFREEHANDROI = "PlanarFreehandROI";
|
|
9
|
+
var trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(PLANARFREEHANDROI);
|
|
10
|
+
var closedContourThreshold = 1e-5;
|
|
11
|
+
var PlanarFreehandROI = /*#__PURE__*/function () {
|
|
12
|
+
function PlanarFreehandROI() {
|
|
13
|
+
_classCallCheck(this, PlanarFreehandROI);
|
|
14
|
+
}
|
|
15
|
+
return _createClass(PlanarFreehandROI, null, [{
|
|
16
|
+
key: "getMeasurementData",
|
|
17
|
+
value: function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
18
|
+
var _MeasurementReport$ge = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, PlanarFreehandROI.toolType),
|
|
19
|
+
defaultState = _MeasurementReport$ge.defaultState,
|
|
20
|
+
NUMGroup = _MeasurementReport$ge.NUMGroup,
|
|
21
|
+
SCOORDGroup = _MeasurementReport$ge.SCOORDGroup,
|
|
22
|
+
ReferencedFrameNumber = _MeasurementReport$ge.ReferencedFrameNumber;
|
|
23
|
+
var referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
24
|
+
var GraphicData = SCOORDGroup.GraphicData;
|
|
25
|
+
var worldCoords = [];
|
|
26
|
+
for (var i = 0; i < GraphicData.length; i += 2) {
|
|
27
|
+
var point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
|
|
28
|
+
worldCoords.push(point);
|
|
29
|
+
}
|
|
30
|
+
var distanceBetweenFirstAndLastPoint = vec3.distance(worldCoords[worldCoords.length - 1], worldCoords[0]);
|
|
31
|
+
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
|
+
if (distanceBetweenFirstAndLastPoint < closedContourThreshold) {
|
|
34
|
+
worldCoords.pop(); // Remove the last element which is duplicated.
|
|
35
|
+
isOpenContour = false;
|
|
36
|
+
}
|
|
37
|
+
var points = [];
|
|
38
|
+
if (isOpenContour) {
|
|
39
|
+
points.push(worldCoords[0], worldCoords[worldCoords.length - 1]);
|
|
40
|
+
}
|
|
41
|
+
var state = defaultState;
|
|
42
|
+
state.annotation.data = {
|
|
43
|
+
contour: {
|
|
44
|
+
polyline: worldCoords,
|
|
45
|
+
closed: !isOpenContour
|
|
46
|
+
},
|
|
47
|
+
handles: {
|
|
48
|
+
points: points,
|
|
49
|
+
activeHandleIndex: null,
|
|
50
|
+
textBox: {
|
|
51
|
+
hasMoved: false
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
cachedStats: _defineProperty({}, "imageId:".concat(referencedImageId), {
|
|
55
|
+
area: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : null
|
|
56
|
+
}),
|
|
57
|
+
frameNumber: ReferencedFrameNumber
|
|
58
|
+
};
|
|
59
|
+
return state;
|
|
60
|
+
}
|
|
61
|
+
}, {
|
|
62
|
+
key: "getTID300RepresentationArguments",
|
|
63
|
+
value: function getTID300RepresentationArguments(tool, worldToImageCoords) {
|
|
64
|
+
var data = tool.data,
|
|
65
|
+
finding = tool.finding,
|
|
66
|
+
findingSites = tool.findingSites,
|
|
67
|
+
metadata = tool.metadata;
|
|
68
|
+
var _data$contour = data.contour,
|
|
69
|
+
polyline = _data$contour.polyline,
|
|
70
|
+
closed = _data$contour.closed;
|
|
71
|
+
var isOpenContour = closed !== true;
|
|
72
|
+
var referencedImageId = metadata.referencedImageId;
|
|
73
|
+
if (!referencedImageId) {
|
|
74
|
+
throw new Error("PlanarFreehandROI.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
75
|
+
}
|
|
76
|
+
var points = polyline.map(function (worldPos) {
|
|
77
|
+
return worldToImageCoords(referencedImageId, worldPos);
|
|
78
|
+
});
|
|
79
|
+
if (!isOpenContour) {
|
|
80
|
+
// Need to repeat the first point at the end of to have an explicitly closed contour.
|
|
81
|
+
var firstPoint = points[0];
|
|
82
|
+
// Explicitly expand to avoid circular references.
|
|
83
|
+
points.push([firstPoint[0], firstPoint[1]]);
|
|
84
|
+
}
|
|
85
|
+
var _ref = data.cachedStats["imageId:".concat(referencedImageId)] || {},
|
|
86
|
+
area = _ref.area,
|
|
87
|
+
areaUnits = _ref.areaUnits,
|
|
88
|
+
pixelValueUnits = _ref.pixelValueUnits,
|
|
89
|
+
perimeter = _ref.perimeter,
|
|
90
|
+
mean = _ref.mean,
|
|
91
|
+
max = _ref.max,
|
|
92
|
+
stdDev = _ref.stdDev;
|
|
93
|
+
return {
|
|
94
|
+
/** From cachedStats */
|
|
95
|
+
points: points,
|
|
96
|
+
area: area,
|
|
97
|
+
areaUnits: areaUnits,
|
|
98
|
+
perimeter: perimeter,
|
|
99
|
+
pixelValueUnits: pixelValueUnits,
|
|
100
|
+
mean: mean,
|
|
101
|
+
max: max,
|
|
102
|
+
stdDev: stdDev,
|
|
103
|
+
/** Other */
|
|
104
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue,
|
|
105
|
+
finding: finding,
|
|
106
|
+
findingSites: findingSites || []
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}]);
|
|
110
|
+
}();
|
|
111
|
+
_defineProperty(PlanarFreehandROI, "toolType", PLANARFREEHANDROI);
|
|
112
|
+
_defineProperty(PlanarFreehandROI, "utilityToolType", PLANARFREEHANDROI);
|
|
113
|
+
_defineProperty(PlanarFreehandROI, "TID300Representation", TID300Polyline);
|
|
114
|
+
_defineProperty(PlanarFreehandROI, "isValidCornerstoneTrackingIdentifier", function (TrackingIdentifier) {
|
|
115
|
+
if (!TrackingIdentifier.includes(":")) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
var _TrackingIdentifier$s = TrackingIdentifier.split(":"),
|
|
119
|
+
_TrackingIdentifier$s2 = _slicedToArray(_TrackingIdentifier$s, 2),
|
|
120
|
+
cornerstone3DTag = _TrackingIdentifier$s2[0],
|
|
121
|
+
toolType = _TrackingIdentifier$s2[1];
|
|
122
|
+
if (cornerstone3DTag !== CORNERSTONE_3D_TAG) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
return toolType === PLANARFREEHANDROI;
|
|
126
|
+
});
|
|
127
|
+
MeasurementReport.registerTool(PlanarFreehandROI);
|
|
128
|
+
|
|
129
|
+
export { PlanarFreehandROI as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export default Probe;
|
|
2
|
+
declare class Probe {
|
|
3
|
+
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any): {
|
|
4
|
+
description: any;
|
|
5
|
+
sopInstanceUid: any;
|
|
6
|
+
annotation: {
|
|
7
|
+
annotationUID: any;
|
|
8
|
+
metadata: {
|
|
9
|
+
toolName: any;
|
|
10
|
+
referencedImageId: any;
|
|
11
|
+
FrameOfReferenceUID: any;
|
|
12
|
+
label: string;
|
|
13
|
+
};
|
|
14
|
+
data: any;
|
|
15
|
+
};
|
|
16
|
+
finding: any;
|
|
17
|
+
findingSites: any[];
|
|
18
|
+
};
|
|
19
|
+
static getTID300RepresentationArguments(tool: any, worldToImageCoords: any): {
|
|
20
|
+
points: any;
|
|
21
|
+
trackingIdentifierTextValue: string;
|
|
22
|
+
findingSites: any;
|
|
23
|
+
finding: any;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
declare namespace Probe {
|
|
27
|
+
export { PROBE as toolType };
|
|
28
|
+
export { PROBE as utilityToolType };
|
|
29
|
+
export { TID300Point as TID300Representation };
|
|
30
|
+
export function isValidCornerstoneTrackingIdentifier(TrackingIdentifier: any): boolean;
|
|
31
|
+
}
|
|
32
|
+
declare const PROBE: "Probe";
|
|
33
|
+
declare const TID300Point: any;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { slicedToArray as _slicedToArray, createClass as _createClass, classCallCheck as _classCallCheck } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { utilities } from 'dcmjs';
|
|
3
|
+
import CORNERSTONE_3D_TAG from './cornerstone3DTag.js';
|
|
4
|
+
import MeasurementReport from './MeasurementReport.js';
|
|
5
|
+
|
|
6
|
+
var TID300Point = utilities.TID300.Point;
|
|
7
|
+
var PROBE = "Probe";
|
|
8
|
+
var trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(PROBE);
|
|
9
|
+
var Probe = /*#__PURE__*/function () {
|
|
10
|
+
function Probe() {
|
|
11
|
+
_classCallCheck(this, Probe);
|
|
12
|
+
}
|
|
13
|
+
return _createClass(Probe, null, [{
|
|
14
|
+
key: "getMeasurementData",
|
|
15
|
+
value: function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
16
|
+
var _MeasurementReport$ge = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, Probe.toolType),
|
|
17
|
+
defaultState = _MeasurementReport$ge.defaultState,
|
|
18
|
+
SCOORDGroup = _MeasurementReport$ge.SCOORDGroup,
|
|
19
|
+
ReferencedFrameNumber = _MeasurementReport$ge.ReferencedFrameNumber;
|
|
20
|
+
var referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
21
|
+
var GraphicData = SCOORDGroup.GraphicData;
|
|
22
|
+
var worldCoords = [];
|
|
23
|
+
for (var i = 0; i < GraphicData.length; i += 2) {
|
|
24
|
+
var point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
|
|
25
|
+
worldCoords.push(point);
|
|
26
|
+
}
|
|
27
|
+
var state = defaultState;
|
|
28
|
+
state.annotation.data = {
|
|
29
|
+
handles: {
|
|
30
|
+
points: worldCoords,
|
|
31
|
+
activeHandleIndex: null,
|
|
32
|
+
textBox: {
|
|
33
|
+
hasMoved: false
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
frameNumber: ReferencedFrameNumber
|
|
37
|
+
};
|
|
38
|
+
return state;
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "getTID300RepresentationArguments",
|
|
42
|
+
value: function getTID300RepresentationArguments(tool, worldToImageCoords) {
|
|
43
|
+
var data = tool.data,
|
|
44
|
+
metadata = tool.metadata;
|
|
45
|
+
var finding = tool.finding,
|
|
46
|
+
findingSites = tool.findingSites;
|
|
47
|
+
var referencedImageId = metadata.referencedImageId;
|
|
48
|
+
if (!referencedImageId) {
|
|
49
|
+
throw new Error("Probe.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
50
|
+
}
|
|
51
|
+
var points = data.handles.points;
|
|
52
|
+
var pointsImage = points.map(function (point) {
|
|
53
|
+
var pointImage = worldToImageCoords(referencedImageId, point);
|
|
54
|
+
return {
|
|
55
|
+
x: pointImage[0],
|
|
56
|
+
y: pointImage[1]
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
var TID300RepresentationArguments = {
|
|
60
|
+
points: pointsImage,
|
|
61
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue,
|
|
62
|
+
findingSites: findingSites || [],
|
|
63
|
+
finding: finding
|
|
64
|
+
};
|
|
65
|
+
return TID300RepresentationArguments;
|
|
66
|
+
}
|
|
67
|
+
}]);
|
|
68
|
+
}();
|
|
69
|
+
Probe.toolType = PROBE;
|
|
70
|
+
Probe.utilityToolType = PROBE;
|
|
71
|
+
Probe.TID300Representation = TID300Point;
|
|
72
|
+
Probe.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
73
|
+
if (!TrackingIdentifier.includes(":")) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
var _TrackingIdentifier$s = TrackingIdentifier.split(":"),
|
|
77
|
+
_TrackingIdentifier$s2 = _slicedToArray(_TrackingIdentifier$s, 2),
|
|
78
|
+
cornerstone3DTag = _TrackingIdentifier$s2[0],
|
|
79
|
+
toolType = _TrackingIdentifier$s2[1];
|
|
80
|
+
if (cornerstone3DTag !== CORNERSTONE_3D_TAG) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
return toolType === PROBE;
|
|
84
|
+
};
|
|
85
|
+
MeasurementReport.registerTool(Probe);
|
|
86
|
+
|
|
87
|
+
export { Probe as default };
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
declare function generateRTSSFromSegmentations(segmentations: any, metadataProvider: any, DicomMetadataStore: any): {
|
|
15
|
+
StudyInstanceUID: any;
|
|
16
|
+
SOPClassUID: string;
|
|
17
|
+
SOPInstanceUID: any;
|
|
18
|
+
Manufacturer: string;
|
|
19
|
+
Modality: string;
|
|
20
|
+
FrameOfReferenceUID: any;
|
|
21
|
+
PositionReferenceIndicator: string;
|
|
22
|
+
StructureSetLabel: any;
|
|
23
|
+
StructureSetName: any;
|
|
24
|
+
ReferringPhysicianName: string;
|
|
25
|
+
OperatorsName: string;
|
|
26
|
+
StructureSetDate: any;
|
|
27
|
+
StructureSetTime: any;
|
|
28
|
+
_meta: any;
|
|
29
|
+
SeriesInstanceUID: any;
|
|
30
|
+
SeriesNumber: string;
|
|
31
|
+
PatientID: any;
|
|
32
|
+
PatientName: any;
|
|
33
|
+
PatientBirthDate: string;
|
|
34
|
+
PatientAge: any;
|
|
35
|
+
PatientSex: any;
|
|
36
|
+
PatientWeight: any;
|
|
37
|
+
StudyDate: any;
|
|
38
|
+
StudyTime: any;
|
|
39
|
+
StudyID: string;
|
|
40
|
+
AccessionNumber: any;
|
|
41
|
+
StructureSetROISequence: any[];
|
|
42
|
+
ROIContourSequence: any[];
|
|
43
|
+
RTROIObservationsSequence: any[];
|
|
44
|
+
ReferencedSeriesSequence: any[];
|
|
45
|
+
ReferencedFrameOfReferenceSequence: any[];
|
|
46
|
+
};
|
|
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
|
+
declare function generateRTSSFromAnnotations(annotations: any, metadataProvider: any, DicomMetadataStore: any): {
|
|
58
|
+
StudyInstanceUID: any;
|
|
59
|
+
SOPClassUID: string;
|
|
60
|
+
SOPInstanceUID: any;
|
|
61
|
+
Manufacturer: string;
|
|
62
|
+
Modality: string;
|
|
63
|
+
FrameOfReferenceUID: any;
|
|
64
|
+
PositionReferenceIndicator: string;
|
|
65
|
+
StructureSetLabel: any;
|
|
66
|
+
StructureSetName: any;
|
|
67
|
+
ReferringPhysicianName: string;
|
|
68
|
+
OperatorsName: string;
|
|
69
|
+
StructureSetDate: any;
|
|
70
|
+
StructureSetTime: any;
|
|
71
|
+
_meta: any;
|
|
72
|
+
SeriesInstanceUID: any;
|
|
73
|
+
SeriesNumber: string;
|
|
74
|
+
PatientID: any;
|
|
75
|
+
PatientName: any;
|
|
76
|
+
PatientBirthDate: string;
|
|
77
|
+
PatientAge: any;
|
|
78
|
+
PatientSex: any;
|
|
79
|
+
PatientWeight: any;
|
|
80
|
+
StudyDate: any;
|
|
81
|
+
StudyTime: any;
|
|
82
|
+
StudyID: string;
|
|
83
|
+
AccessionNumber: any;
|
|
84
|
+
StructureSetROISequence: any[];
|
|
85
|
+
ROIContourSequence: any[];
|
|
86
|
+
RTROIObservationsSequence: any[];
|
|
87
|
+
ReferencedSeriesSequence: any[];
|
|
88
|
+
ReferencedFrameOfReferenceSequence: any[];
|
|
89
|
+
};
|
|
90
|
+
export { generateRTSSFromSegmentations, generateRTSSFromAnnotations };
|