@cornerstonejs/adapters 2.0.0-beta.6 → 2.0.0-beta.8
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/adapters.es.js +643 -977
- package/dist/adapters.es.js.map +1 -1
- package/dist/types/adapters/Cornerstone3D/PlanarFreehandROI.d.ts +9 -2
- package/dist/types/adapters/Cornerstone3D/RTStruct/RTSS.d.ts +4 -5
- package/dist/types/adapters/Cornerstone3D/RTStruct/index.d.ts +2 -1
- package/dist/types/adapters/Cornerstone3D/UltrasoundDirectional.d.ts +36 -0
- package/dist/types/adapters/Cornerstone3D/index.d.ts +2 -0
- package/dist/types/adapters/index.d.ts +1 -0
- package/package.json +5 -5
package/dist/adapters.es.js
CHANGED
|
@@ -2,520 +2,498 @@ import dcmjs, { data, utilities, derivations, normalizers, log } from 'dcmjs';
|
|
|
2
2
|
import { Buffer } from 'buffer';
|
|
3
3
|
import ndarray from 'ndarray';
|
|
4
4
|
import { vec3 } from 'gl-matrix';
|
|
5
|
+
import { utilities as utilities$1 } from '@cornerstonejs/tools';
|
|
5
6
|
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
function _arrayLikeToArray(r, a) {
|
|
8
|
+
(null == a || a > r.length) && (a = r.length);
|
|
9
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
10
|
+
return n;
|
|
11
|
+
}
|
|
12
|
+
function _arrayWithHoles(r) {
|
|
13
|
+
if (Array.isArray(r)) return r;
|
|
14
|
+
}
|
|
15
|
+
function _arrayWithoutHoles(r) {
|
|
16
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
17
|
+
}
|
|
18
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
19
|
+
try {
|
|
20
|
+
var i = n[a](c),
|
|
21
|
+
u = i.value;
|
|
22
|
+
} catch (n) {
|
|
23
|
+
return void e(n);
|
|
24
|
+
}
|
|
25
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
26
|
+
}
|
|
27
|
+
function _asyncToGenerator(n) {
|
|
28
|
+
return function () {
|
|
29
|
+
var t = this,
|
|
30
|
+
e = arguments;
|
|
31
|
+
return new Promise(function (r, o) {
|
|
32
|
+
var a = n.apply(t, e);
|
|
33
|
+
function _next(n) {
|
|
34
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
35
|
+
}
|
|
36
|
+
function _throw(n) {
|
|
37
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
38
|
+
}
|
|
39
|
+
_next(void 0);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function _classCallCheck(a, n) {
|
|
44
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
45
|
+
}
|
|
46
|
+
function _defineProperties(e, r) {
|
|
47
|
+
for (var t = 0; t < r.length; t++) {
|
|
48
|
+
var o = r[t];
|
|
49
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function _createClass(e, r, t) {
|
|
53
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
54
|
+
writable: !1
|
|
55
|
+
}), e;
|
|
56
|
+
}
|
|
57
|
+
function _createForOfIteratorHelper(r, e) {
|
|
58
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
59
|
+
if (!t) {
|
|
60
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
61
|
+
t && (r = t);
|
|
62
|
+
var n = 0,
|
|
63
|
+
F = function () {};
|
|
64
|
+
return {
|
|
65
|
+
s: F,
|
|
66
|
+
n: function () {
|
|
67
|
+
return n >= r.length ? {
|
|
68
|
+
done: !0
|
|
69
|
+
} : {
|
|
70
|
+
done: !1,
|
|
71
|
+
value: r[n++]
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
e: function (r) {
|
|
75
|
+
throw r;
|
|
76
|
+
},
|
|
77
|
+
f: F
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
81
|
+
}
|
|
82
|
+
var o,
|
|
83
|
+
a = !0,
|
|
84
|
+
u = !1;
|
|
85
|
+
return {
|
|
86
|
+
s: function () {
|
|
87
|
+
t = t.call(r);
|
|
88
|
+
},
|
|
89
|
+
n: function () {
|
|
90
|
+
var r = t.next();
|
|
91
|
+
return a = r.done, r;
|
|
92
|
+
},
|
|
93
|
+
e: function (r) {
|
|
94
|
+
u = !0, o = r;
|
|
95
|
+
},
|
|
96
|
+
f: function () {
|
|
97
|
+
try {
|
|
98
|
+
a || null == t.return || t.return();
|
|
99
|
+
} finally {
|
|
100
|
+
if (u) throw o;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function _defineProperty(e, r, t) {
|
|
106
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
107
|
+
value: t,
|
|
108
|
+
enumerable: !0,
|
|
109
|
+
configurable: !0,
|
|
110
|
+
writable: !0
|
|
111
|
+
}) : e[r] = t, e;
|
|
112
|
+
}
|
|
113
|
+
function _iterableToArray(r) {
|
|
114
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
115
|
+
}
|
|
116
|
+
function _iterableToArrayLimit(r, l) {
|
|
117
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
118
|
+
if (null != t) {
|
|
119
|
+
var e,
|
|
120
|
+
n,
|
|
121
|
+
i,
|
|
122
|
+
u,
|
|
123
|
+
a = [],
|
|
124
|
+
f = !0,
|
|
125
|
+
o = !1;
|
|
16
126
|
try {
|
|
17
|
-
if (
|
|
18
|
-
if (Object(
|
|
19
|
-
|
|
20
|
-
} else for (; !(
|
|
21
|
-
} catch (
|
|
22
|
-
|
|
127
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
128
|
+
if (Object(t) !== t) return;
|
|
129
|
+
f = !1;
|
|
130
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
131
|
+
} catch (r) {
|
|
132
|
+
o = !0, n = r;
|
|
23
133
|
} finally {
|
|
24
134
|
try {
|
|
25
|
-
if (!
|
|
135
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
26
136
|
} finally {
|
|
27
|
-
if (
|
|
137
|
+
if (o) throw n;
|
|
28
138
|
}
|
|
29
139
|
}
|
|
30
|
-
return
|
|
140
|
+
return a;
|
|
31
141
|
}
|
|
32
142
|
}
|
|
33
|
-
function
|
|
34
|
-
|
|
143
|
+
function _nonIterableRest() {
|
|
144
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
145
|
+
}
|
|
146
|
+
function _nonIterableSpread() {
|
|
147
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
148
|
+
}
|
|
149
|
+
function ownKeys(e, r) {
|
|
150
|
+
var t = Object.keys(e);
|
|
35
151
|
if (Object.getOwnPropertySymbols) {
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
return Object.getOwnPropertyDescriptor(
|
|
39
|
-
})),
|
|
152
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
153
|
+
r && (o = o.filter(function (r) {
|
|
154
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
155
|
+
})), t.push.apply(t, o);
|
|
40
156
|
}
|
|
41
|
-
return
|
|
157
|
+
return t;
|
|
42
158
|
}
|
|
43
|
-
function _objectSpread2(
|
|
44
|
-
for (var
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
_defineProperty(
|
|
48
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
49
|
-
Object.defineProperty(
|
|
159
|
+
function _objectSpread2(e) {
|
|
160
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
161
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
162
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
163
|
+
_defineProperty(e, r, t[r]);
|
|
164
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
165
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
50
166
|
});
|
|
51
167
|
}
|
|
52
|
-
return
|
|
168
|
+
return e;
|
|
53
169
|
}
|
|
54
170
|
function _regeneratorRuntime() {
|
|
55
171
|
_regeneratorRuntime = function () {
|
|
56
|
-
return
|
|
172
|
+
return e;
|
|
57
173
|
};
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
174
|
+
var t,
|
|
175
|
+
e = {},
|
|
176
|
+
r = Object.prototype,
|
|
177
|
+
n = r.hasOwnProperty,
|
|
178
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
179
|
+
t[e] = r.value;
|
|
63
180
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
function define(
|
|
69
|
-
return Object.defineProperty(
|
|
70
|
-
value:
|
|
181
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
182
|
+
a = i.iterator || "@@iterator",
|
|
183
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
184
|
+
u = i.toStringTag || "@@toStringTag";
|
|
185
|
+
function define(t, e, r) {
|
|
186
|
+
return Object.defineProperty(t, e, {
|
|
187
|
+
value: r,
|
|
71
188
|
enumerable: !0,
|
|
72
189
|
configurable: !0,
|
|
73
190
|
writable: !0
|
|
74
|
-
}),
|
|
191
|
+
}), t[e];
|
|
75
192
|
}
|
|
76
193
|
try {
|
|
77
194
|
define({}, "");
|
|
78
|
-
} catch (
|
|
79
|
-
define = function (
|
|
80
|
-
return
|
|
195
|
+
} catch (t) {
|
|
196
|
+
define = function (t, e, r) {
|
|
197
|
+
return t[e] = r;
|
|
81
198
|
};
|
|
82
199
|
}
|
|
83
|
-
function wrap(
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return
|
|
88
|
-
value: makeInvokeMethod(
|
|
89
|
-
}),
|
|
200
|
+
function wrap(t, e, r, n) {
|
|
201
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
202
|
+
a = Object.create(i.prototype),
|
|
203
|
+
c = new Context(n || []);
|
|
204
|
+
return o(a, "_invoke", {
|
|
205
|
+
value: makeInvokeMethod(t, r, c)
|
|
206
|
+
}), a;
|
|
90
207
|
}
|
|
91
|
-
function tryCatch(
|
|
208
|
+
function tryCatch(t, e, r) {
|
|
92
209
|
try {
|
|
93
210
|
return {
|
|
94
211
|
type: "normal",
|
|
95
|
-
arg:
|
|
212
|
+
arg: t.call(e, r)
|
|
96
213
|
};
|
|
97
|
-
} catch (
|
|
214
|
+
} catch (t) {
|
|
98
215
|
return {
|
|
99
216
|
type: "throw",
|
|
100
|
-
arg:
|
|
217
|
+
arg: t
|
|
101
218
|
};
|
|
102
219
|
}
|
|
103
220
|
}
|
|
104
|
-
|
|
105
|
-
var
|
|
221
|
+
e.wrap = wrap;
|
|
222
|
+
var h = "suspendedStart",
|
|
223
|
+
l = "suspendedYield",
|
|
224
|
+
f = "executing",
|
|
225
|
+
s = "completed",
|
|
226
|
+
y = {};
|
|
106
227
|
function Generator() {}
|
|
107
228
|
function GeneratorFunction() {}
|
|
108
229
|
function GeneratorFunctionPrototype() {}
|
|
109
|
-
var
|
|
110
|
-
define(
|
|
230
|
+
var p = {};
|
|
231
|
+
define(p, a, function () {
|
|
111
232
|
return this;
|
|
112
233
|
});
|
|
113
|
-
var
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
var
|
|
117
|
-
function defineIteratorMethods(
|
|
118
|
-
["next", "throw", "return"].forEach(function (
|
|
119
|
-
define(
|
|
120
|
-
return this._invoke(
|
|
234
|
+
var d = Object.getPrototypeOf,
|
|
235
|
+
v = d && d(d(values([])));
|
|
236
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
237
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
238
|
+
function defineIteratorMethods(t) {
|
|
239
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
240
|
+
define(t, e, function (t) {
|
|
241
|
+
return this._invoke(e, t);
|
|
121
242
|
});
|
|
122
243
|
});
|
|
123
244
|
}
|
|
124
|
-
function AsyncIterator(
|
|
125
|
-
function invoke(
|
|
126
|
-
var
|
|
127
|
-
if ("throw" !==
|
|
128
|
-
var
|
|
129
|
-
|
|
130
|
-
return
|
|
131
|
-
invoke("next",
|
|
132
|
-
}, function (
|
|
133
|
-
invoke("throw",
|
|
134
|
-
}) :
|
|
135
|
-
|
|
136
|
-
}, function (
|
|
137
|
-
return invoke("throw",
|
|
245
|
+
function AsyncIterator(t, e) {
|
|
246
|
+
function invoke(r, o, i, a) {
|
|
247
|
+
var c = tryCatch(t[r], t, o);
|
|
248
|
+
if ("throw" !== c.type) {
|
|
249
|
+
var u = c.arg,
|
|
250
|
+
h = u.value;
|
|
251
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
252
|
+
invoke("next", t, i, a);
|
|
253
|
+
}, function (t) {
|
|
254
|
+
invoke("throw", t, i, a);
|
|
255
|
+
}) : e.resolve(h).then(function (t) {
|
|
256
|
+
u.value = t, i(u);
|
|
257
|
+
}, function (t) {
|
|
258
|
+
return invoke("throw", t, i, a);
|
|
138
259
|
});
|
|
139
260
|
}
|
|
140
|
-
|
|
261
|
+
a(c.arg);
|
|
141
262
|
}
|
|
142
|
-
var
|
|
143
|
-
|
|
144
|
-
value: function (
|
|
263
|
+
var r;
|
|
264
|
+
o(this, "_invoke", {
|
|
265
|
+
value: function (t, n) {
|
|
145
266
|
function callInvokeWithMethodAndArg() {
|
|
146
|
-
return new
|
|
147
|
-
invoke(
|
|
267
|
+
return new e(function (e, r) {
|
|
268
|
+
invoke(t, n, e, r);
|
|
148
269
|
});
|
|
149
270
|
}
|
|
150
|
-
return
|
|
271
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
151
272
|
}
|
|
152
273
|
});
|
|
153
274
|
}
|
|
154
|
-
function makeInvokeMethod(
|
|
155
|
-
var
|
|
156
|
-
return function (
|
|
157
|
-
if (
|
|
158
|
-
if (
|
|
159
|
-
if ("throw" ===
|
|
160
|
-
return
|
|
275
|
+
function makeInvokeMethod(e, r, n) {
|
|
276
|
+
var o = h;
|
|
277
|
+
return function (i, a) {
|
|
278
|
+
if (o === f) throw Error("Generator is already running");
|
|
279
|
+
if (o === s) {
|
|
280
|
+
if ("throw" === i) throw a;
|
|
281
|
+
return {
|
|
282
|
+
value: t,
|
|
283
|
+
done: !0
|
|
284
|
+
};
|
|
161
285
|
}
|
|
162
|
-
for (
|
|
163
|
-
var
|
|
164
|
-
if (
|
|
165
|
-
var
|
|
166
|
-
if (
|
|
167
|
-
if (
|
|
168
|
-
return
|
|
286
|
+
for (n.method = i, n.arg = a;;) {
|
|
287
|
+
var c = n.delegate;
|
|
288
|
+
if (c) {
|
|
289
|
+
var u = maybeInvokeDelegate(c, n);
|
|
290
|
+
if (u) {
|
|
291
|
+
if (u === y) continue;
|
|
292
|
+
return u;
|
|
169
293
|
}
|
|
170
294
|
}
|
|
171
|
-
if ("next" ===
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
-
} else "return" ===
|
|
175
|
-
|
|
176
|
-
var
|
|
177
|
-
if ("normal" ===
|
|
178
|
-
if (
|
|
295
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
296
|
+
if (o === h) throw o = s, n.arg;
|
|
297
|
+
n.dispatchException(n.arg);
|
|
298
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
299
|
+
o = f;
|
|
300
|
+
var p = tryCatch(e, r, n);
|
|
301
|
+
if ("normal" === p.type) {
|
|
302
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
179
303
|
return {
|
|
180
|
-
value:
|
|
181
|
-
done:
|
|
304
|
+
value: p.arg,
|
|
305
|
+
done: n.done
|
|
182
306
|
};
|
|
183
307
|
}
|
|
184
|
-
"throw" ===
|
|
308
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
185
309
|
}
|
|
186
310
|
};
|
|
187
311
|
}
|
|
188
|
-
function maybeInvokeDelegate(
|
|
189
|
-
var
|
|
190
|
-
|
|
191
|
-
if (
|
|
192
|
-
var
|
|
193
|
-
if ("throw" ===
|
|
194
|
-
var
|
|
195
|
-
return
|
|
196
|
-
}
|
|
197
|
-
function pushTryEntry(
|
|
198
|
-
var
|
|
199
|
-
tryLoc:
|
|
312
|
+
function maybeInvokeDelegate(e, r) {
|
|
313
|
+
var n = r.method,
|
|
314
|
+
o = e.iterator[n];
|
|
315
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
316
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
317
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
318
|
+
var a = i.arg;
|
|
319
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
320
|
+
}
|
|
321
|
+
function pushTryEntry(t) {
|
|
322
|
+
var e = {
|
|
323
|
+
tryLoc: t[0]
|
|
200
324
|
};
|
|
201
|
-
1 in
|
|
325
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
202
326
|
}
|
|
203
|
-
function resetTryEntry(
|
|
204
|
-
var
|
|
205
|
-
|
|
327
|
+
function resetTryEntry(t) {
|
|
328
|
+
var e = t.completion || {};
|
|
329
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
206
330
|
}
|
|
207
|
-
function Context(
|
|
331
|
+
function Context(t) {
|
|
208
332
|
this.tryEntries = [{
|
|
209
333
|
tryLoc: "root"
|
|
210
|
-
}],
|
|
211
|
-
}
|
|
212
|
-
function values(
|
|
213
|
-
if (
|
|
214
|
-
var
|
|
215
|
-
if (
|
|
216
|
-
if ("function" == typeof
|
|
217
|
-
if (!isNaN(
|
|
218
|
-
var
|
|
219
|
-
|
|
220
|
-
for (; ++
|
|
221
|
-
return next.value =
|
|
334
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
335
|
+
}
|
|
336
|
+
function values(e) {
|
|
337
|
+
if (e || "" === e) {
|
|
338
|
+
var r = e[a];
|
|
339
|
+
if (r) return r.call(e);
|
|
340
|
+
if ("function" == typeof e.next) return e;
|
|
341
|
+
if (!isNaN(e.length)) {
|
|
342
|
+
var o = -1,
|
|
343
|
+
i = function next() {
|
|
344
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
345
|
+
return next.value = t, next.done = !0, next;
|
|
222
346
|
};
|
|
223
|
-
return
|
|
347
|
+
return i.next = i;
|
|
224
348
|
}
|
|
225
349
|
}
|
|
226
|
-
|
|
227
|
-
next: doneResult
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
function doneResult() {
|
|
231
|
-
return {
|
|
232
|
-
value: undefined,
|
|
233
|
-
done: !0
|
|
234
|
-
};
|
|
350
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
235
351
|
}
|
|
236
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype,
|
|
352
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
237
353
|
value: GeneratorFunctionPrototype,
|
|
238
354
|
configurable: !0
|
|
239
|
-
}),
|
|
355
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
240
356
|
value: GeneratorFunction,
|
|
241
357
|
configurable: !0
|
|
242
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype,
|
|
243
|
-
var
|
|
244
|
-
return !!
|
|
245
|
-
},
|
|
246
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(
|
|
247
|
-
},
|
|
358
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
359
|
+
var e = "function" == typeof t && t.constructor;
|
|
360
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
361
|
+
}, e.mark = function (t) {
|
|
362
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
363
|
+
}, e.awrap = function (t) {
|
|
248
364
|
return {
|
|
249
|
-
__await:
|
|
365
|
+
__await: t
|
|
250
366
|
};
|
|
251
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype,
|
|
367
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
252
368
|
return this;
|
|
253
|
-
}),
|
|
254
|
-
void 0 ===
|
|
255
|
-
var
|
|
256
|
-
return
|
|
257
|
-
return
|
|
369
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
370
|
+
void 0 === i && (i = Promise);
|
|
371
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
372
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
373
|
+
return t.done ? t.value : a.next();
|
|
258
374
|
});
|
|
259
|
-
}, defineIteratorMethods(
|
|
375
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
260
376
|
return this;
|
|
261
|
-
}), define(
|
|
377
|
+
}), define(g, "toString", function () {
|
|
262
378
|
return "[object Generator]";
|
|
263
|
-
}),
|
|
264
|
-
var
|
|
265
|
-
|
|
266
|
-
for (var
|
|
267
|
-
return
|
|
268
|
-
for (;
|
|
269
|
-
var
|
|
270
|
-
if (
|
|
379
|
+
}), e.keys = function (t) {
|
|
380
|
+
var e = Object(t),
|
|
381
|
+
r = [];
|
|
382
|
+
for (var n in e) r.push(n);
|
|
383
|
+
return r.reverse(), function next() {
|
|
384
|
+
for (; r.length;) {
|
|
385
|
+
var t = r.pop();
|
|
386
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
271
387
|
}
|
|
272
388
|
return next.done = !0, next;
|
|
273
389
|
};
|
|
274
|
-
},
|
|
390
|
+
}, e.values = values, Context.prototype = {
|
|
275
391
|
constructor: Context,
|
|
276
|
-
reset: function (
|
|
277
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent =
|
|
392
|
+
reset: function (e) {
|
|
393
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
278
394
|
},
|
|
279
395
|
stop: function () {
|
|
280
396
|
this.done = !0;
|
|
281
|
-
var
|
|
282
|
-
if ("throw" ===
|
|
397
|
+
var t = this.tryEntries[0].completion;
|
|
398
|
+
if ("throw" === t.type) throw t.arg;
|
|
283
399
|
return this.rval;
|
|
284
400
|
},
|
|
285
|
-
dispatchException: function (
|
|
286
|
-
if (this.done) throw
|
|
287
|
-
var
|
|
288
|
-
function handle(
|
|
289
|
-
return
|
|
401
|
+
dispatchException: function (e) {
|
|
402
|
+
if (this.done) throw e;
|
|
403
|
+
var r = this;
|
|
404
|
+
function handle(n, o) {
|
|
405
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
290
406
|
}
|
|
291
|
-
for (var
|
|
292
|
-
var
|
|
293
|
-
|
|
294
|
-
if ("root" ===
|
|
295
|
-
if (
|
|
296
|
-
var
|
|
297
|
-
|
|
298
|
-
if (
|
|
299
|
-
if (this.prev <
|
|
300
|
-
if (this.prev <
|
|
301
|
-
} else if (
|
|
302
|
-
if (this.prev <
|
|
407
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
408
|
+
var i = this.tryEntries[o],
|
|
409
|
+
a = i.completion;
|
|
410
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
411
|
+
if (i.tryLoc <= this.prev) {
|
|
412
|
+
var c = n.call(i, "catchLoc"),
|
|
413
|
+
u = n.call(i, "finallyLoc");
|
|
414
|
+
if (c && u) {
|
|
415
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
416
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
417
|
+
} else if (c) {
|
|
418
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
303
419
|
} else {
|
|
304
|
-
if (!
|
|
305
|
-
if (this.prev <
|
|
420
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
421
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
306
422
|
}
|
|
307
423
|
}
|
|
308
424
|
}
|
|
309
425
|
},
|
|
310
|
-
abrupt: function (
|
|
311
|
-
for (var
|
|
312
|
-
var
|
|
313
|
-
if (
|
|
314
|
-
var
|
|
426
|
+
abrupt: function (t, e) {
|
|
427
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
428
|
+
var o = this.tryEntries[r];
|
|
429
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
430
|
+
var i = o;
|
|
315
431
|
break;
|
|
316
432
|
}
|
|
317
433
|
}
|
|
318
|
-
|
|
319
|
-
var
|
|
320
|
-
return
|
|
434
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
435
|
+
var a = i ? i.completion : {};
|
|
436
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
321
437
|
},
|
|
322
|
-
complete: function (
|
|
323
|
-
if ("throw" ===
|
|
324
|
-
return "break" ===
|
|
438
|
+
complete: function (t, e) {
|
|
439
|
+
if ("throw" === t.type) throw t.arg;
|
|
440
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
325
441
|
},
|
|
326
|
-
finish: function (
|
|
327
|
-
for (var
|
|
328
|
-
var
|
|
329
|
-
if (
|
|
442
|
+
finish: function (t) {
|
|
443
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
444
|
+
var r = this.tryEntries[e];
|
|
445
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
330
446
|
}
|
|
331
447
|
},
|
|
332
|
-
catch: function (
|
|
333
|
-
for (var
|
|
334
|
-
var
|
|
335
|
-
if (
|
|
336
|
-
var
|
|
337
|
-
if ("throw" ===
|
|
338
|
-
var
|
|
339
|
-
resetTryEntry(
|
|
448
|
+
catch: function (t) {
|
|
449
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
450
|
+
var r = this.tryEntries[e];
|
|
451
|
+
if (r.tryLoc === t) {
|
|
452
|
+
var n = r.completion;
|
|
453
|
+
if ("throw" === n.type) {
|
|
454
|
+
var o = n.arg;
|
|
455
|
+
resetTryEntry(r);
|
|
340
456
|
}
|
|
341
|
-
return
|
|
457
|
+
return o;
|
|
342
458
|
}
|
|
343
459
|
}
|
|
344
|
-
throw
|
|
460
|
+
throw Error("illegal catch attempt");
|
|
345
461
|
},
|
|
346
|
-
delegateYield: function (
|
|
462
|
+
delegateYield: function (e, r, n) {
|
|
347
463
|
return this.delegate = {
|
|
348
|
-
iterator: values(
|
|
349
|
-
resultName:
|
|
350
|
-
nextLoc:
|
|
351
|
-
}, "next" === this.method && (this.arg =
|
|
464
|
+
iterator: values(e),
|
|
465
|
+
resultName: r,
|
|
466
|
+
nextLoc: n
|
|
467
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
352
468
|
}
|
|
353
|
-
},
|
|
354
|
-
}
|
|
355
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
356
|
-
try {
|
|
357
|
-
var info = gen[key](arg);
|
|
358
|
-
var value = info.value;
|
|
359
|
-
} catch (error) {
|
|
360
|
-
reject(error);
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
363
|
-
if (info.done) {
|
|
364
|
-
resolve(value);
|
|
365
|
-
} else {
|
|
366
|
-
Promise.resolve(value).then(_next, _throw);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
function _asyncToGenerator(fn) {
|
|
370
|
-
return function () {
|
|
371
|
-
var self = this,
|
|
372
|
-
args = arguments;
|
|
373
|
-
return new Promise(function (resolve, reject) {
|
|
374
|
-
var gen = fn.apply(self, args);
|
|
375
|
-
function _next(value) {
|
|
376
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
377
|
-
}
|
|
378
|
-
function _throw(err) {
|
|
379
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
380
|
-
}
|
|
381
|
-
_next(undefined);
|
|
382
|
-
});
|
|
383
|
-
};
|
|
469
|
+
}, e;
|
|
384
470
|
}
|
|
385
|
-
function
|
|
386
|
-
|
|
387
|
-
throw new TypeError("Cannot call a class as a function");
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
function _defineProperties(target, props) {
|
|
391
|
-
for (var i = 0; i < props.length; i++) {
|
|
392
|
-
var descriptor = props[i];
|
|
393
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
394
|
-
descriptor.configurable = true;
|
|
395
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
396
|
-
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
397
|
-
}
|
|
471
|
+
function _slicedToArray(r, e) {
|
|
472
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
398
473
|
}
|
|
399
|
-
function
|
|
400
|
-
|
|
401
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
402
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
403
|
-
writable: false
|
|
404
|
-
});
|
|
405
|
-
return Constructor;
|
|
474
|
+
function _toConsumableArray(r) {
|
|
475
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
406
476
|
}
|
|
407
|
-
function
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
writable: true
|
|
415
|
-
});
|
|
416
|
-
} else {
|
|
417
|
-
obj[key] = value;
|
|
477
|
+
function _toPrimitive(t, r) {
|
|
478
|
+
if ("object" != typeof t || !t) return t;
|
|
479
|
+
var e = t[Symbol.toPrimitive];
|
|
480
|
+
if (void 0 !== e) {
|
|
481
|
+
var i = e.call(t, r || "default");
|
|
482
|
+
if ("object" != typeof i) return i;
|
|
483
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
418
484
|
}
|
|
419
|
-
return
|
|
420
|
-
}
|
|
421
|
-
function _slicedToArray(arr, i) {
|
|
422
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
423
|
-
}
|
|
424
|
-
function _toConsumableArray(arr) {
|
|
425
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
426
|
-
}
|
|
427
|
-
function _arrayWithoutHoles(arr) {
|
|
428
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
429
|
-
}
|
|
430
|
-
function _arrayWithHoles(arr) {
|
|
431
|
-
if (Array.isArray(arr)) return arr;
|
|
432
|
-
}
|
|
433
|
-
function _iterableToArray(iter) {
|
|
434
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
485
|
+
return ("string" === r ? String : Number)(t);
|
|
435
486
|
}
|
|
436
|
-
function
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
440
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
441
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
442
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
443
|
-
}
|
|
444
|
-
function _arrayLikeToArray(arr, len) {
|
|
445
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
446
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
447
|
-
return arr2;
|
|
448
|
-
}
|
|
449
|
-
function _nonIterableSpread() {
|
|
450
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
451
|
-
}
|
|
452
|
-
function _nonIterableRest() {
|
|
453
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
454
|
-
}
|
|
455
|
-
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
456
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
457
|
-
if (!it) {
|
|
458
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
459
|
-
if (it) o = it;
|
|
460
|
-
var i = 0;
|
|
461
|
-
var F = function () {};
|
|
462
|
-
return {
|
|
463
|
-
s: F,
|
|
464
|
-
n: function () {
|
|
465
|
-
if (i >= o.length) return {
|
|
466
|
-
done: true
|
|
467
|
-
};
|
|
468
|
-
return {
|
|
469
|
-
done: false,
|
|
470
|
-
value: o[i++]
|
|
471
|
-
};
|
|
472
|
-
},
|
|
473
|
-
e: function (e) {
|
|
474
|
-
throw e;
|
|
475
|
-
},
|
|
476
|
-
f: F
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
480
|
-
}
|
|
481
|
-
var normalCompletion = true,
|
|
482
|
-
didErr = false,
|
|
483
|
-
err;
|
|
484
|
-
return {
|
|
485
|
-
s: function () {
|
|
486
|
-
it = it.call(o);
|
|
487
|
-
},
|
|
488
|
-
n: function () {
|
|
489
|
-
var step = it.next();
|
|
490
|
-
normalCompletion = step.done;
|
|
491
|
-
return step;
|
|
492
|
-
},
|
|
493
|
-
e: function (e) {
|
|
494
|
-
didErr = true;
|
|
495
|
-
err = e;
|
|
496
|
-
},
|
|
497
|
-
f: function () {
|
|
498
|
-
try {
|
|
499
|
-
if (!normalCompletion && it.return != null) it.return();
|
|
500
|
-
} finally {
|
|
501
|
-
if (didErr) throw err;
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
};
|
|
487
|
+
function _toPropertyKey(t) {
|
|
488
|
+
var i = _toPrimitive(t, "string");
|
|
489
|
+
return "symbol" == typeof i ? i : i + "";
|
|
505
490
|
}
|
|
506
|
-
function
|
|
507
|
-
if (
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
if (typeof res !== "object") return res;
|
|
512
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
491
|
+
function _unsupportedIterableToArray(r, a) {
|
|
492
|
+
if (r) {
|
|
493
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
494
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
495
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
513
496
|
}
|
|
514
|
-
return (hint === "string" ? String : Number)(input);
|
|
515
|
-
}
|
|
516
|
-
function _toPropertyKey(arg) {
|
|
517
|
-
var key = _toPrimitive(arg, "string");
|
|
518
|
-
return typeof key === "symbol" ? key : String(key);
|
|
519
497
|
}
|
|
520
498
|
|
|
521
499
|
var toArray = function (x) { return (Array.isArray(x) ? x : [x]); };
|
|
@@ -626,7 +604,7 @@ var MeasurementReport$1 = /*#__PURE__*/function () {
|
|
|
626
604
|
function MeasurementReport() {
|
|
627
605
|
_classCallCheck(this, MeasurementReport);
|
|
628
606
|
}
|
|
629
|
-
_createClass(MeasurementReport, null, [{
|
|
607
|
+
return _createClass(MeasurementReport, null, [{
|
|
630
608
|
key: "getSetupMeasurementData",
|
|
631
609
|
value: function getSetupMeasurementData(MeasurementGroup) {
|
|
632
610
|
var ContentSequence = MeasurementGroup.ContentSequence;
|
|
@@ -740,7 +718,6 @@ var MeasurementReport$1 = /*#__PURE__*/function () {
|
|
|
740
718
|
//SOPInstanceUID: sopInstanceUID, // TODO: Necessary?
|
|
741
719
|
//SOPClassUID: sopClassUID,
|
|
742
720
|
};
|
|
743
|
-
|
|
744
721
|
var _meta = {
|
|
745
722
|
FileMetaInformationVersion: {
|
|
746
723
|
Value: [fileMetaInformationVersionArray.buffer],
|
|
@@ -773,6 +750,7 @@ var MeasurementReport$1 = /*#__PURE__*/function () {
|
|
|
773
750
|
// Merge the derived dataset with the content from the Measurement Report
|
|
774
751
|
report.dataset = Object.assign(report.dataset, contentItem);
|
|
775
752
|
report.dataset._meta = _meta;
|
|
753
|
+
report.dataset.SpecificCharacterSet = "ISO_IR 192";
|
|
776
754
|
return report;
|
|
777
755
|
}
|
|
778
756
|
|
|
@@ -838,7 +816,6 @@ var MeasurementReport$1 = /*#__PURE__*/function () {
|
|
|
838
816
|
MeasurementReport.MEASUREMENT_BY_TOOLTYPE[toolClass.toolType] = toolClass.utilityToolType;
|
|
839
817
|
}
|
|
840
818
|
}]);
|
|
841
|
-
return MeasurementReport;
|
|
842
819
|
}();
|
|
843
820
|
MeasurementReport$1.MEASUREMENT_BY_TOOLTYPE = {};
|
|
844
821
|
MeasurementReport$1.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE = {};
|
|
@@ -846,13 +823,13 @@ MeasurementReport$1.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE = {};
|
|
|
846
823
|
|
|
847
824
|
var CORNERSTONE_4_TAG = "cornerstoneTools@^4.0.0";
|
|
848
825
|
|
|
849
|
-
var TID300Length$
|
|
826
|
+
var TID300Length$2 = utilities.TID300.Length;
|
|
850
827
|
var LENGTH$1 = "Length";
|
|
851
828
|
var Length$1 = /*#__PURE__*/function () {
|
|
852
829
|
function Length() {
|
|
853
830
|
_classCallCheck(this, Length);
|
|
854
831
|
}
|
|
855
|
-
_createClass(Length, null, [{
|
|
832
|
+
return _createClass(Length, null, [{
|
|
856
833
|
key: "getMeasurementData",
|
|
857
834
|
value:
|
|
858
835
|
// TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport.
|
|
@@ -903,11 +880,10 @@ var Length$1 = /*#__PURE__*/function () {
|
|
|
903
880
|
};
|
|
904
881
|
}
|
|
905
882
|
}]);
|
|
906
|
-
return Length;
|
|
907
883
|
}();
|
|
908
884
|
Length$1.toolType = LENGTH$1;
|
|
909
885
|
Length$1.utilityToolType = LENGTH$1;
|
|
910
|
-
Length$1.TID300Representation = TID300Length$
|
|
886
|
+
Length$1.TID300Representation = TID300Length$2;
|
|
911
887
|
Length$1.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
912
888
|
if (!TrackingIdentifier.includes(":")) {
|
|
913
889
|
return false;
|
|
@@ -928,7 +904,7 @@ var FreehandRoi = /*#__PURE__*/function () {
|
|
|
928
904
|
function FreehandRoi() {
|
|
929
905
|
_classCallCheck(this, FreehandRoi);
|
|
930
906
|
}
|
|
931
|
-
_createClass(FreehandRoi, null, [{
|
|
907
|
+
return _createClass(FreehandRoi, null, [{
|
|
932
908
|
key: "getMeasurementData",
|
|
933
909
|
value: function getMeasurementData(MeasurementGroup) {
|
|
934
910
|
var _MeasurementReport$ge = MeasurementReport$1.getSetupMeasurementData(MeasurementGroup),
|
|
@@ -987,7 +963,6 @@ var FreehandRoi = /*#__PURE__*/function () {
|
|
|
987
963
|
};
|
|
988
964
|
}
|
|
989
965
|
}]);
|
|
990
|
-
return FreehandRoi;
|
|
991
966
|
}();
|
|
992
967
|
FreehandRoi.toolType = "FreehandRoi";
|
|
993
968
|
FreehandRoi.utilityToolType = "FreehandRoi";
|
|
@@ -1017,7 +992,7 @@ var Bidirectional$1 = /*#__PURE__*/function () {
|
|
|
1017
992
|
function Bidirectional() {
|
|
1018
993
|
_classCallCheck(this, Bidirectional);
|
|
1019
994
|
}
|
|
1020
|
-
_createClass(Bidirectional, null, [{
|
|
995
|
+
return _createClass(Bidirectional, null, [{
|
|
1021
996
|
key: "getMeasurementData",
|
|
1022
997
|
value:
|
|
1023
998
|
// TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport.
|
|
@@ -1150,7 +1125,6 @@ var Bidirectional$1 = /*#__PURE__*/function () {
|
|
|
1150
1125
|
};
|
|
1151
1126
|
}
|
|
1152
1127
|
}]);
|
|
1153
|
-
return Bidirectional;
|
|
1154
1128
|
}();
|
|
1155
1129
|
Bidirectional$1.toolType = BIDIRECTIONAL$1;
|
|
1156
1130
|
Bidirectional$1.utilityToolType = BIDIRECTIONAL$1;
|
|
@@ -1176,7 +1150,7 @@ var EllipticalRoi = /*#__PURE__*/function () {
|
|
|
1176
1150
|
function EllipticalRoi() {
|
|
1177
1151
|
_classCallCheck(this, EllipticalRoi);
|
|
1178
1152
|
}
|
|
1179
|
-
_createClass(EllipticalRoi, null, [{
|
|
1153
|
+
return _createClass(EllipticalRoi, null, [{
|
|
1180
1154
|
key: "getMeasurementData",
|
|
1181
1155
|
value:
|
|
1182
1156
|
// TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport.
|
|
@@ -1323,7 +1297,6 @@ var EllipticalRoi = /*#__PURE__*/function () {
|
|
|
1323
1297
|
};
|
|
1324
1298
|
}
|
|
1325
1299
|
}]);
|
|
1326
|
-
return EllipticalRoi;
|
|
1327
1300
|
}();
|
|
1328
1301
|
EllipticalRoi.toolType = ELLIPTICALROI$1;
|
|
1329
1302
|
EllipticalRoi.utilityToolType = ELLIPTICALROI$1;
|
|
@@ -1349,7 +1322,7 @@ var CircleRoi = /*#__PURE__*/function () {
|
|
|
1349
1322
|
function CircleRoi() {
|
|
1350
1323
|
_classCallCheck(this, CircleRoi);
|
|
1351
1324
|
}
|
|
1352
|
-
_createClass(CircleRoi, null, [{
|
|
1325
|
+
return _createClass(CircleRoi, null, [{
|
|
1353
1326
|
key: "getMeasurementData",
|
|
1354
1327
|
value: /** Gets the measurement data for cornerstone, given DICOM SR measurement data. */
|
|
1355
1328
|
function getMeasurementData(MeasurementGroup) {
|
|
@@ -1433,7 +1406,6 @@ var CircleRoi = /*#__PURE__*/function () {
|
|
|
1433
1406
|
};
|
|
1434
1407
|
}
|
|
1435
1408
|
}]);
|
|
1436
|
-
return CircleRoi;
|
|
1437
1409
|
}();
|
|
1438
1410
|
CircleRoi.toolType = CIRCLEROI$1;
|
|
1439
1411
|
CircleRoi.utilityToolType = CIRCLEROI$1;
|
|
@@ -1460,7 +1432,7 @@ var ArrowAnnotate$1 = /*#__PURE__*/function () {
|
|
|
1460
1432
|
function ArrowAnnotate() {
|
|
1461
1433
|
_classCallCheck(this, ArrowAnnotate);
|
|
1462
1434
|
}
|
|
1463
|
-
_createClass(ArrowAnnotate, null, [{
|
|
1435
|
+
return _createClass(ArrowAnnotate, null, [{
|
|
1464
1436
|
key: "getMeasurementData",
|
|
1465
1437
|
value: function getMeasurementData(MeasurementGroup) {
|
|
1466
1438
|
var _MeasurementReport$ge = MeasurementReport$1.getSetupMeasurementData(MeasurementGroup),
|
|
@@ -1525,7 +1497,6 @@ var ArrowAnnotate$1 = /*#__PURE__*/function () {
|
|
|
1525
1497
|
return TID300RepresentationArguments;
|
|
1526
1498
|
}
|
|
1527
1499
|
}]);
|
|
1528
|
-
return ArrowAnnotate;
|
|
1529
1500
|
}();
|
|
1530
1501
|
ArrowAnnotate$1.toolType = ARROW_ANNOTATE$1;
|
|
1531
1502
|
ArrowAnnotate$1.utilityToolType = ARROW_ANNOTATE$1;
|
|
@@ -1551,7 +1522,7 @@ var CobbAngle$1 = /*#__PURE__*/function () {
|
|
|
1551
1522
|
function CobbAngle() {
|
|
1552
1523
|
_classCallCheck(this, CobbAngle);
|
|
1553
1524
|
}
|
|
1554
|
-
_createClass(CobbAngle, null, [{
|
|
1525
|
+
return _createClass(CobbAngle, null, [{
|
|
1555
1526
|
key: "getMeasurementData",
|
|
1556
1527
|
value:
|
|
1557
1528
|
// TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport.
|
|
@@ -1618,7 +1589,6 @@ var CobbAngle$1 = /*#__PURE__*/function () {
|
|
|
1618
1589
|
};
|
|
1619
1590
|
}
|
|
1620
1591
|
}]);
|
|
1621
|
-
return CobbAngle;
|
|
1622
1592
|
}();
|
|
1623
1593
|
CobbAngle$1.toolType = COBB_ANGLE;
|
|
1624
1594
|
CobbAngle$1.utilityToolType = COBB_ANGLE;
|
|
@@ -1644,7 +1614,7 @@ var Angle$1 = /*#__PURE__*/function () {
|
|
|
1644
1614
|
function Angle() {
|
|
1645
1615
|
_classCallCheck(this, Angle);
|
|
1646
1616
|
}
|
|
1647
|
-
_createClass(Angle, null, [{
|
|
1617
|
+
return _createClass(Angle, null, [{
|
|
1648
1618
|
key: "getMeasurementData",
|
|
1649
1619
|
value:
|
|
1650
1620
|
/**
|
|
@@ -1706,7 +1676,6 @@ var Angle$1 = /*#__PURE__*/function () {
|
|
|
1706
1676
|
};
|
|
1707
1677
|
}
|
|
1708
1678
|
}]);
|
|
1709
|
-
return Angle;
|
|
1710
1679
|
}();
|
|
1711
1680
|
Angle$1.toolType = ANGLE;
|
|
1712
1681
|
Angle$1.utilityToolType = ANGLE;
|
|
@@ -1731,7 +1700,7 @@ var RectangleRoi = /*#__PURE__*/function () {
|
|
|
1731
1700
|
function RectangleRoi() {
|
|
1732
1701
|
_classCallCheck(this, RectangleRoi);
|
|
1733
1702
|
}
|
|
1734
|
-
_createClass(RectangleRoi, null, [{
|
|
1703
|
+
return _createClass(RectangleRoi, null, [{
|
|
1735
1704
|
key: "getMeasurementData",
|
|
1736
1705
|
value: function getMeasurementData(MeasurementGroup) {
|
|
1737
1706
|
var _MeasurementReport$ge = MeasurementReport$1.getSetupMeasurementData(MeasurementGroup),
|
|
@@ -1798,7 +1767,6 @@ var RectangleRoi = /*#__PURE__*/function () {
|
|
|
1798
1767
|
};
|
|
1799
1768
|
}
|
|
1800
1769
|
}]);
|
|
1801
|
-
return RectangleRoi;
|
|
1802
1770
|
}();
|
|
1803
1771
|
RectangleRoi.toolType = "RectangleRoi";
|
|
1804
1772
|
RectangleRoi.utilityToolType = "RectangleRoi";
|
|
@@ -2385,6 +2353,7 @@ function fillSegmentation$1(segmentation, inputLabelmaps3D) {
|
|
|
2385
2353
|
Value: ["1.2.840.10008.1.2.5"],
|
|
2386
2354
|
vr: "UI"
|
|
2387
2355
|
};
|
|
2356
|
+
segmentation.dataset.SpecificCharacterSet = "ISO_IR 192";
|
|
2388
2357
|
segmentation.dataset._vrMap.PixelData = "OB";
|
|
2389
2358
|
segmentation.dataset.PixelData = rleEncodedFrames;
|
|
2390
2359
|
} else {
|
|
@@ -2418,6 +2387,7 @@ function _createSegFromImages(images, isMultiframe, options) {
|
|
|
2418
2387
|
var dicomData = DicomMessage.readFile(arrayBuffer);
|
|
2419
2388
|
var dataset = DicomMetaDictionary$2.naturalizeDataset(dicomData.dict);
|
|
2420
2389
|
dataset._meta = DicomMetaDictionary$2.namifyDataset(dicomData.meta);
|
|
2390
|
+
dataset.SpecificCharacterSet = "ISO_IR 192";
|
|
2421
2391
|
datasets.push(dataset);
|
|
2422
2392
|
} else {
|
|
2423
2393
|
for (var i = 0; i < images.length; i++) {
|
|
@@ -2426,6 +2396,7 @@ function _createSegFromImages(images, isMultiframe, options) {
|
|
|
2426
2396
|
var _dicomData = DicomMessage.readFile(_arrayBuffer);
|
|
2427
2397
|
var _dataset = DicomMetaDictionary$2.naturalizeDataset(_dicomData.dict);
|
|
2428
2398
|
_dataset._meta = DicomMetaDictionary$2.namifyDataset(_dicomData.meta);
|
|
2399
|
+
_dataset.SpecificCharacterSet = "ISO_IR 192";
|
|
2429
2400
|
datasets.push(_dataset);
|
|
2430
2401
|
}
|
|
2431
2402
|
}
|
|
@@ -2603,7 +2574,7 @@ function generateToolState$2(_x, _x2, _x3, _x4) {
|
|
|
2603
2574
|
*/
|
|
2604
2575
|
function _generateToolState() {
|
|
2605
2576
|
_generateToolState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(imageIds, arrayBuffer, metadataProvider, options) {
|
|
2606
|
-
var _options$skipOverlapp, skipOverlapping, _options$tolerance, tolerance, _options$TypedArrayCo, TypedArrayConstructor, _options$maxBytesPerC, maxBytesPerChunk, eventTarget, triggerEvent, dicomData, dataset, multiframe, imagePlaneModule, generalSeriesModule, SeriesInstanceUID, ImageOrientationPatient, validOrientations, sliceLength, segMetadata, TransferSyntaxUID, pixelData, pixelDataChunks, rleEncodedFrames, orientation, sopUIDImageIdIndexMap, overlapping, insertFunction, segmentsOnFrameArray, segmentsOnFrame, arrayBufferLength, labelmapBufferArray, imageIdMaps, segmentsPixelIndices, centroidXYZ;
|
|
2577
|
+
var _options$skipOverlapp, skipOverlapping, _options$tolerance, tolerance, _options$TypedArrayCo, TypedArrayConstructor, _options$maxBytesPerC, maxBytesPerChunk, eventTarget, triggerEvent, dicomData, dataset, multiframe, imagePlaneModule, generalSeriesModule, SeriesInstanceUID, ImageOrientationPatient, validOrientations, sliceLength, segMetadata, TransferSyntaxUID, pixelData, pixelDataChunks, rleEncodedFrames, orientation, sopUIDImageIdIndexMap, overlapping, insertFunction, segmentsOnFrameArray, segmentsOnFrame, arrayBufferLength, labelmapBufferArray, imageIdMaps, segmentsPixelIndices, overlappingSegments, centroidXYZ;
|
|
2607
2578
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2608
2579
|
while (1) switch (_context.prev = _context.next) {
|
|
2609
2580
|
case 0:
|
|
@@ -2655,8 +2626,8 @@ function _generateToolState() {
|
|
|
2655
2626
|
// and over again.
|
|
2656
2627
|
sopUIDImageIdIndexMap = imageIds.reduce(function (acc, imageId) {
|
|
2657
2628
|
var _metadataProvider$get = metadataProvider.get("generalImageModule", imageId),
|
|
2658
|
-
|
|
2659
|
-
acc[
|
|
2629
|
+
sopInstanceUID = _metadataProvider$get.sopInstanceUID;
|
|
2630
|
+
acc[sopInstanceUID] = imageId;
|
|
2660
2631
|
return acc;
|
|
2661
2632
|
}, {});
|
|
2662
2633
|
overlapping = false;
|
|
@@ -2690,7 +2661,7 @@ function _generateToolState() {
|
|
|
2690
2661
|
labelmapBufferArray = [];
|
|
2691
2662
|
labelmapBufferArray[0] = new ArrayBuffer(arrayBufferLength);
|
|
2692
2663
|
|
|
2693
|
-
//
|
|
2664
|
+
// Pre-compute the indices and metadata so that we don't have to call
|
|
2694
2665
|
// a function for each imageId in the for loop.
|
|
2695
2666
|
imageIdMaps = imageIds.reduce(function (acc, curr, index) {
|
|
2696
2667
|
acc.indices[curr] = index;
|
|
@@ -2707,6 +2678,7 @@ function _generateToolState() {
|
|
|
2707
2678
|
_context.next = 47;
|
|
2708
2679
|
return insertFunction(segmentsOnFrame, segmentsOnFrameArray, labelmapBufferArray, pixelDataChunks, multiframe, imageIds, validOrientations, metadataProvider, tolerance, TypedArrayConstructor, segmentsPixelIndices, sopUIDImageIdIndexMap, imageIdMaps, eventTarget, triggerEvent);
|
|
2709
2680
|
case 47:
|
|
2681
|
+
overlappingSegments = _context.sent;
|
|
2710
2682
|
// calculate the centroid of each segment
|
|
2711
2683
|
centroidXYZ = new Map();
|
|
2712
2684
|
segmentsPixelIndices.forEach(function (imageIdIndexBufferIndex, segmentIndex) {
|
|
@@ -2726,9 +2698,10 @@ function _generateToolState() {
|
|
|
2726
2698
|
segMetadata: segMetadata,
|
|
2727
2699
|
segmentsOnFrame: segmentsOnFrame,
|
|
2728
2700
|
segmentsOnFrameArray: segmentsOnFrameArray,
|
|
2729
|
-
centroids: centroidXYZ
|
|
2701
|
+
centroids: centroidXYZ,
|
|
2702
|
+
overlappingSegments: overlappingSegments
|
|
2730
2703
|
});
|
|
2731
|
-
case
|
|
2704
|
+
case 51:
|
|
2732
2705
|
case "end":
|
|
2733
2706
|
return _context.stop();
|
|
2734
2707
|
}
|
|
@@ -2753,9 +2726,7 @@ function findReferenceSourceImageId(multiframe, frameSegment, imageIds, metadata
|
|
|
2753
2726
|
return imageId;
|
|
2754
2727
|
}
|
|
2755
2728
|
var frameSourceImageSequence = undefined;
|
|
2756
|
-
if (
|
|
2757
|
-
frameSourceImageSequence = SourceImageSequence[frameSegment];
|
|
2758
|
-
} else if (PerFrameFunctionalGroup.DerivationImageSequence) {
|
|
2729
|
+
if (PerFrameFunctionalGroup.DerivationImageSequence) {
|
|
2759
2730
|
var DerivationImageSequence = PerFrameFunctionalGroup.DerivationImageSequence;
|
|
2760
2731
|
if (Array.isArray(DerivationImageSequence)) {
|
|
2761
2732
|
if (DerivationImageSequence.length !== 0) {
|
|
@@ -2774,6 +2745,9 @@ function findReferenceSourceImageId(multiframe, frameSegment, imageIds, metadata
|
|
|
2774
2745
|
}
|
|
2775
2746
|
}
|
|
2776
2747
|
}
|
|
2748
|
+
} else if (SourceImageSequence && SourceImageSequence.length !== 0) {
|
|
2749
|
+
console.warn("DerivationImageSequence not present, using SourceImageSequence assuming SEG has the same geometry as the source image.");
|
|
2750
|
+
frameSourceImageSequence = SourceImageSequence[frameSegment];
|
|
2777
2751
|
}
|
|
2778
2752
|
if (frameSourceImageSequence) {
|
|
2779
2753
|
imageId = getImageIdOfSourceImageBySourceImageSequence(frameSourceImageSequence, sopUIDImageIdIndexMap);
|
|
@@ -2813,32 +2787,33 @@ function checkSEGsOverlapping(pixelData, multiframe, imageIds, validOrientations
|
|
|
2813
2787
|
|
|
2814
2788
|
var frameSegmentsMapping = new Map();
|
|
2815
2789
|
var _loop3 = function _loop3() {
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
}
|
|
2821
|
-
var imageId = findReferenceSourceImageId(multiframe, frameSegment, imageIds, metadataProvider, tolerance, sopUIDImageIdIndexMap);
|
|
2822
|
-
if (!imageId) {
|
|
2823
|
-
console.warn("Image not present in stack, can't import frame : " + frameSegment + ".");
|
|
2824
|
-
return "continue";
|
|
2825
|
-
}
|
|
2826
|
-
var imageIdIndex = imageIds.findIndex(function (element) {
|
|
2827
|
-
return element === imageId;
|
|
2828
|
-
});
|
|
2829
|
-
if (frameSegmentsMapping.has(imageIdIndex)) {
|
|
2830
|
-
var segmentArray = frameSegmentsMapping.get(imageIdIndex);
|
|
2831
|
-
if (!segmentArray.includes(frameSegment)) {
|
|
2832
|
-
segmentArray.push(frameSegment);
|
|
2833
|
-
frameSegmentsMapping.set(imageIdIndex, segmentArray);
|
|
2790
|
+
var segmentIndex = getSegmentIndex(multiframe, frameSegment);
|
|
2791
|
+
if (segmentIndex === undefined) {
|
|
2792
|
+
console.warn("Could not retrieve the segment index for frame segment " + frameSegment + ", skipping this frame.");
|
|
2793
|
+
return 0; // continue
|
|
2834
2794
|
}
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2795
|
+
var imageId = findReferenceSourceImageId(multiframe, frameSegment, imageIds, metadataProvider, tolerance, sopUIDImageIdIndexMap);
|
|
2796
|
+
if (!imageId) {
|
|
2797
|
+
console.warn("Image not present in stack, can't import frame : " + frameSegment + ".");
|
|
2798
|
+
return 0; // continue
|
|
2799
|
+
}
|
|
2800
|
+
var imageIdIndex = imageIds.findIndex(function (element) {
|
|
2801
|
+
return element === imageId;
|
|
2802
|
+
});
|
|
2803
|
+
if (frameSegmentsMapping.has(imageIdIndex)) {
|
|
2804
|
+
var segmentArray = frameSegmentsMapping.get(imageIdIndex);
|
|
2805
|
+
if (!segmentArray.includes(frameSegment)) {
|
|
2806
|
+
segmentArray.push(frameSegment);
|
|
2807
|
+
frameSegmentsMapping.set(imageIdIndex, segmentArray);
|
|
2808
|
+
}
|
|
2809
|
+
} else {
|
|
2810
|
+
frameSegmentsMapping.set(imageIdIndex, [frameSegment]);
|
|
2811
|
+
}
|
|
2812
|
+
},
|
|
2813
|
+
_ret;
|
|
2839
2814
|
for (var frameSegment = 0; frameSegment < groupsLen; ++frameSegment) {
|
|
2840
|
-
|
|
2841
|
-
if (_ret ===
|
|
2815
|
+
_ret = _loop3();
|
|
2816
|
+
if (_ret === 0) continue;
|
|
2842
2817
|
}
|
|
2843
2818
|
var _iterator = _createForOfIteratorHelper(frameSegmentsMapping.entries()),
|
|
2844
2819
|
_step;
|
|
@@ -2906,77 +2881,78 @@ function insertOverlappingPixelDataPlanar(segmentsOnFrame, segmentsOnFrameArray,
|
|
|
2906
2881
|
var numberOfSegs = multiframe.SegmentSequence.length;
|
|
2907
2882
|
for (var segmentIndexToProcess = 1; segmentIndexToProcess <= numberOfSegs; ++segmentIndexToProcess) {
|
|
2908
2883
|
var _loop4 = function _loop4(_i2) {
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2884
|
+
var PerFrameFunctionalGroups = PerFrameFunctionalGroupsSequence[_i2];
|
|
2885
|
+
var segmentIndex = getSegmentIndex(multiframe, _i2);
|
|
2886
|
+
if (segmentIndex === undefined) {
|
|
2887
|
+
throw new Error("Could not retrieve the segment index. Aborting segmentation loading.");
|
|
2888
|
+
}
|
|
2889
|
+
if (segmentIndex !== segmentIndexToProcess) {
|
|
2890
|
+
i = _i2;
|
|
2891
|
+
return 0; // continue
|
|
2892
|
+
}
|
|
2893
|
+
var ImageOrientationPatientI = sharedImageOrientationPatient || PerFrameFunctionalGroups.PlaneOrientationSequence.ImageOrientationPatient;
|
|
2894
|
+
|
|
2895
|
+
// Since we moved to the chunks approach, we need to read the data
|
|
2896
|
+
// and handle scenarios where the portion of data is in one chunk
|
|
2897
|
+
// and the other portion is in another chunk
|
|
2898
|
+
var view = readFromUnpackedChunks(pixelData, _i2 * sliceLength, sliceLength);
|
|
2899
|
+
var pixelDataI2D = ndarray(view, [Rows, Columns]);
|
|
2900
|
+
var alignedPixelDataI = alignPixelDataWithSourceData(pixelDataI2D, ImageOrientationPatientI, validOrientations, tolerance);
|
|
2901
|
+
if (!alignedPixelDataI) {
|
|
2902
|
+
throw new Error("Individual SEG frames are out of plane with respect to the first SEG frame. " + "This is not yet supported. Aborting segmentation loading.");
|
|
2903
|
+
}
|
|
2904
|
+
var imageId = findReferenceSourceImageId(multiframe, _i2, imageIds, metadataProvider, tolerance, sopUIDImageIdIndexMap);
|
|
2905
|
+
if (!imageId) {
|
|
2906
|
+
console.warn("Image not present in stack, can't import frame : " + _i2 + ".");
|
|
2907
|
+
i = _i2;
|
|
2908
|
+
return 0; // continue
|
|
2909
|
+
}
|
|
2910
|
+
var sourceImageMetadata = metadataProvider.get("instance", imageId);
|
|
2911
|
+
if (Rows !== sourceImageMetadata.Rows || Columns !== sourceImageMetadata.Columns) {
|
|
2912
|
+
throw new Error("Individual SEG frames have different geometry dimensions (Rows and Columns) " + "respect to the source image reference frame. This is not yet supported. " + "Aborting segmentation loading. ");
|
|
2913
|
+
}
|
|
2914
|
+
var imageIdIndex = imageIds.findIndex(function (element) {
|
|
2915
|
+
return element === imageId;
|
|
2916
|
+
});
|
|
2917
|
+
var byteOffset = sliceLength * imageIdIndex * TypedArrayConstructor.BYTES_PER_ELEMENT;
|
|
2918
|
+
var labelmap2DView = new TypedArrayConstructor(tempBuffer, byteOffset, sliceLength);
|
|
2919
|
+
var data = alignedPixelDataI.data;
|
|
2920
|
+
var segmentOnFrame = false;
|
|
2921
|
+
for (var j = 0, len = alignedPixelDataI.data.length; j < len; ++j) {
|
|
2922
|
+
if (data[j]) {
|
|
2923
|
+
if (labelmap2DView[j] !== 0) {
|
|
2924
|
+
m++;
|
|
2925
|
+
if (m >= M) {
|
|
2926
|
+
labelmapBufferArray[m] = new ArrayBuffer(arrayBufferLength);
|
|
2927
|
+
segmentsOnFrameArray[m] = [];
|
|
2928
|
+
M++;
|
|
2929
|
+
}
|
|
2930
|
+
tempBuffer = labelmapBufferArray[m].slice(0);
|
|
2931
|
+
tempSegmentsOnFrame = structuredClone(segmentsOnFrameArray[m]);
|
|
2932
|
+
_i2 = 0;
|
|
2933
|
+
break;
|
|
2934
|
+
} else {
|
|
2935
|
+
labelmap2DView[j] = segmentIndex;
|
|
2936
|
+
segmentOnFrame = true;
|
|
2954
2937
|
}
|
|
2955
|
-
tempBuffer = labelmapBufferArray[m].slice(0);
|
|
2956
|
-
tempSegmentsOnFrame = structuredClone(segmentsOnFrameArray[m]);
|
|
2957
|
-
_i2 = 0;
|
|
2958
|
-
break;
|
|
2959
|
-
} else {
|
|
2960
|
-
labelmap2DView[j] = segmentIndex;
|
|
2961
|
-
segmentOnFrame = true;
|
|
2962
2938
|
}
|
|
2963
2939
|
}
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2940
|
+
if (segmentOnFrame) {
|
|
2941
|
+
if (!tempSegmentsOnFrame[imageIdIndex]) {
|
|
2942
|
+
tempSegmentsOnFrame[imageIdIndex] = [];
|
|
2943
|
+
}
|
|
2944
|
+
tempSegmentsOnFrame[imageIdIndex].push(segmentIndex);
|
|
2945
|
+
if (!segmentsOnFrame[imageIdIndex]) {
|
|
2946
|
+
segmentsOnFrame[imageIdIndex] = [];
|
|
2947
|
+
}
|
|
2948
|
+
segmentsOnFrame[imageIdIndex].push(segmentIndex);
|
|
2972
2949
|
}
|
|
2973
|
-
|
|
2974
|
-
}
|
|
2975
|
-
|
|
2976
|
-
};
|
|
2950
|
+
i = _i2;
|
|
2951
|
+
},
|
|
2952
|
+
_ret2;
|
|
2977
2953
|
for (var i = 0, groupsLen = PerFrameFunctionalGroupsSequence.length; i < groupsLen; ++i) {
|
|
2978
|
-
|
|
2979
|
-
if (_ret2 ===
|
|
2954
|
+
_ret2 = _loop4(i);
|
|
2955
|
+
if (_ret2 === 0) continue;
|
|
2980
2956
|
}
|
|
2981
2957
|
labelmapBufferArray[m] = tempBuffer.slice(0);
|
|
2982
2958
|
segmentsOnFrameArray[m] = structuredClone(tempSegmentsOnFrame);
|
|
@@ -3005,7 +2981,7 @@ function insertPixelDataPlanar(segmentsOnFrame, segmentsOnFrameArray, labelmapBu
|
|
|
3005
2981
|
var chunkSize = Math.ceil(groupsLen / 10); // 10% of total length
|
|
3006
2982
|
|
|
3007
2983
|
var shouldTriggerEvent = triggerEvent && eventTarget;
|
|
3008
|
-
|
|
2984
|
+
var overlapping = false;
|
|
3009
2985
|
// Below, we chunk the processing of the frames to avoid blocking the main thread
|
|
3010
2986
|
// if the segmentation is large. We also use a promise to allow the caller to
|
|
3011
2987
|
// wait for the processing to finish.
|
|
@@ -3046,6 +3022,9 @@ function insertPixelDataPlanar(segmentsOnFrame, segmentsOnFrameArray, labelmapBu
|
|
|
3046
3022
|
if (data[j]) {
|
|
3047
3023
|
for (var x = j; x < len; ++x) {
|
|
3048
3024
|
if (data[x]) {
|
|
3025
|
+
if (!overlapping && labelmap2DView[x] !== 0) {
|
|
3026
|
+
overlapping = true;
|
|
3027
|
+
}
|
|
3049
3028
|
labelmap2DView[x] = segmentIndex;
|
|
3050
3029
|
indexCache.push(x);
|
|
3051
3030
|
}
|
|
@@ -3075,7 +3054,7 @@ function insertPixelDataPlanar(segmentsOnFrame, segmentsOnFrameArray, labelmapBu
|
|
|
3075
3054
|
setTimeout(processInChunks, 0);
|
|
3076
3055
|
} else {
|
|
3077
3056
|
// resolve the Promise when all chunks have been processed
|
|
3078
|
-
resolve();
|
|
3057
|
+
resolve(overlapping);
|
|
3079
3058
|
}
|
|
3080
3059
|
}
|
|
3081
3060
|
processInChunks();
|
|
@@ -3546,6 +3525,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
3546
3525
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
3547
3526
|
PERFORMANCE OF THIS SOFTWARE.
|
|
3548
3527
|
***************************************************************************** */
|
|
3528
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
3529
|
+
|
|
3549
3530
|
var __assign = function () {
|
|
3550
3531
|
__assign = Object.assign || function __assign(t) {
|
|
3551
3532
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -3565,6 +3546,10 @@ function __spreadArray(to, from, pack) {
|
|
|
3565
3546
|
}
|
|
3566
3547
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
3567
3548
|
}
|
|
3549
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
3550
|
+
var e = new Error(message);
|
|
3551
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
3552
|
+
};
|
|
3568
3553
|
|
|
3569
3554
|
var CORNERSTONE_3D_TAG = "Cornerstone3DTools@^0.1.0";
|
|
3570
3555
|
|
|
@@ -3655,7 +3640,7 @@ var MeasurementReport = /** @class */ (function () {
|
|
|
3655
3640
|
vr: "UI"
|
|
3656
3641
|
},
|
|
3657
3642
|
ImplementationClassUID: {
|
|
3658
|
-
Value: [DicomMetaDictionary$1.uid()],
|
|
3643
|
+
Value: [DicomMetaDictionary$1.uid()], // TODO: could be git hash or other valid id
|
|
3659
3644
|
vr: "UI"
|
|
3660
3645
|
},
|
|
3661
3646
|
ImplementationVersionName: {
|
|
@@ -3773,6 +3758,7 @@ var MeasurementReport = /** @class */ (function () {
|
|
|
3773
3758
|
// Merge the derived dataset with the content from the Measurement Report
|
|
3774
3759
|
report.dataset = Object.assign(report.dataset, contentItem);
|
|
3775
3760
|
report.dataset._meta = _meta;
|
|
3761
|
+
report.SpecificCharacterSet = "ISO_IR 192";
|
|
3776
3762
|
return report;
|
|
3777
3763
|
};
|
|
3778
3764
|
/**
|
|
@@ -3786,6 +3772,7 @@ var MeasurementReport = /** @class */ (function () {
|
|
|
3786
3772
|
var REPORT = "Imaging Measurements";
|
|
3787
3773
|
var GROUP = "Measurement Group";
|
|
3788
3774
|
var TRACKING_IDENTIFIER = "Tracking Identifier";
|
|
3775
|
+
var TRACKING_UNIQUE_IDENTIFIER = "Tracking Unique Identifier";
|
|
3789
3776
|
// Identify the Imaging Measurements
|
|
3790
3777
|
var imagingMeasurementContent = toArray(dataset.ContentSequence).find(codeMeaningEquals(REPORT));
|
|
3791
3778
|
// Retrieve the Measurements themselves
|
|
@@ -3807,12 +3794,19 @@ var MeasurementReport = /** @class */ (function () {
|
|
|
3807
3794
|
TRACKING_IDENTIFIER;
|
|
3808
3795
|
});
|
|
3809
3796
|
var TrackingIdentifierValue_1 = TrackingIdentifierGroup.TextValue;
|
|
3797
|
+
var TrackingUniqueIdentifierGroup = measurementGroupContentSequence.find(function (contentItem) {
|
|
3798
|
+
return contentItem.ConceptNameCodeSequence.CodeMeaning ===
|
|
3799
|
+
TRACKING_UNIQUE_IDENTIFIER;
|
|
3800
|
+
});
|
|
3801
|
+
var TrackingUniqueIdentifierValue = TrackingUniqueIdentifierGroup === null || TrackingUniqueIdentifierGroup === void 0 ? void 0 : TrackingUniqueIdentifierGroup.UID;
|
|
3810
3802
|
var toolClass = ((_a = hooks === null || hooks === void 0 ? void 0 : hooks.getToolClass) === null || _a === void 0 ? void 0 : _a.call(hooks, measurementGroup, dataset, registeredToolClasses)) ||
|
|
3811
3803
|
registeredToolClasses.find(function (tc) {
|
|
3812
3804
|
return tc.isValidCornerstoneTrackingIdentifier(TrackingIdentifierValue_1);
|
|
3813
3805
|
});
|
|
3814
3806
|
if (toolClass) {
|
|
3815
3807
|
var measurement = toolClass.getMeasurementData(measurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata);
|
|
3808
|
+
measurement.TrackingUniqueIdentifier =
|
|
3809
|
+
TrackingUniqueIdentifierValue;
|
|
3816
3810
|
console.log("=== ".concat(toolClass.toolType, " ==="));
|
|
3817
3811
|
console.log(measurement);
|
|
3818
3812
|
measurementData[toolClass.toolType].push(measurement);
|
|
@@ -3853,14 +3847,14 @@ var MeasurementReport = /** @class */ (function () {
|
|
|
3853
3847
|
|
|
3854
3848
|
var TID300Point$1 = utilities.TID300.Point;
|
|
3855
3849
|
var ARROW_ANNOTATE = "ArrowAnnotate";
|
|
3856
|
-
var trackingIdentifierTextValue$
|
|
3850
|
+
var trackingIdentifierTextValue$8 = "".concat(CORNERSTONE_3D_TAG, ":").concat(ARROW_ANNOTATE);
|
|
3857
3851
|
var codeValues = CodingScheme.codeValues,
|
|
3858
3852
|
CodingSchemeDesignator = CodingScheme.CodingSchemeDesignator;
|
|
3859
3853
|
var ArrowAnnotate = /*#__PURE__*/function () {
|
|
3860
3854
|
function ArrowAnnotate() {
|
|
3861
3855
|
_classCallCheck(this, ArrowAnnotate);
|
|
3862
3856
|
}
|
|
3863
|
-
_createClass(ArrowAnnotate, null, [{
|
|
3857
|
+
return _createClass(ArrowAnnotate, null, [{
|
|
3864
3858
|
key: "getMeasurementData",
|
|
3865
3859
|
value: function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
3866
3860
|
var _MeasurementReport$ge = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, ArrowAnnotate.toolType),
|
|
@@ -3932,7 +3926,7 @@ var ArrowAnnotate = /*#__PURE__*/function () {
|
|
|
3932
3926
|
x: pointImage[0],
|
|
3933
3927
|
y: pointImage[1]
|
|
3934
3928
|
}],
|
|
3935
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue$
|
|
3929
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$8,
|
|
3936
3930
|
findingSites: findingSites || []
|
|
3937
3931
|
};
|
|
3938
3932
|
|
|
@@ -3948,7 +3942,6 @@ var ArrowAnnotate = /*#__PURE__*/function () {
|
|
|
3948
3942
|
return TID300RepresentationArguments;
|
|
3949
3943
|
}
|
|
3950
3944
|
}]);
|
|
3951
|
-
return ArrowAnnotate;
|
|
3952
3945
|
}();
|
|
3953
3946
|
ArrowAnnotate.toolType = ARROW_ANNOTATE;
|
|
3954
3947
|
ArrowAnnotate.utilityToolType = ARROW_ANNOTATE;
|
|
@@ -3972,7 +3965,7 @@ var TID300Bidirectional = utilities.TID300.Bidirectional;
|
|
|
3972
3965
|
var BIDIRECTIONAL = "Bidirectional";
|
|
3973
3966
|
var LONG_AXIS = "Long Axis";
|
|
3974
3967
|
var SHORT_AXIS = "Short Axis";
|
|
3975
|
-
var trackingIdentifierTextValue$
|
|
3968
|
+
var trackingIdentifierTextValue$7 = "".concat(CORNERSTONE_3D_TAG, ":").concat(BIDIRECTIONAL);
|
|
3976
3969
|
var Bidirectional = /** @class */ (function () {
|
|
3977
3970
|
function Bidirectional() {
|
|
3978
3971
|
}
|
|
@@ -4075,7 +4068,7 @@ var Bidirectional = /** @class */ (function () {
|
|
|
4075
4068
|
},
|
|
4076
4069
|
longAxisLength: length,
|
|
4077
4070
|
shortAxisLength: width,
|
|
4078
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue$
|
|
4071
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$7,
|
|
4079
4072
|
finding: finding,
|
|
4080
4073
|
findingSites: findingSites || []
|
|
4081
4074
|
};
|
|
@@ -4099,7 +4092,7 @@ MeasurementReport.registerTool(Bidirectional);
|
|
|
4099
4092
|
|
|
4100
4093
|
var TID300CobbAngle$1 = utilities.TID300.CobbAngle;
|
|
4101
4094
|
var MEASUREMENT_TYPE$1 = "Angle";
|
|
4102
|
-
var trackingIdentifierTextValue$
|
|
4095
|
+
var trackingIdentifierTextValue$6 = "".concat(CORNERSTONE_3D_TAG, ":").concat(MEASUREMENT_TYPE$1);
|
|
4103
4096
|
var Angle = /** @class */ (function () {
|
|
4104
4097
|
function Angle() {
|
|
4105
4098
|
}
|
|
@@ -4159,7 +4152,7 @@ var Angle = /** @class */ (function () {
|
|
|
4159
4152
|
point3: point3,
|
|
4160
4153
|
point4: point4,
|
|
4161
4154
|
rAngle: angle,
|
|
4162
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue$
|
|
4155
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$6,
|
|
4163
4156
|
finding: finding,
|
|
4164
4157
|
findingSites: findingSites || []
|
|
4165
4158
|
};
|
|
@@ -4183,7 +4176,7 @@ MeasurementReport.registerTool(Angle);
|
|
|
4183
4176
|
|
|
4184
4177
|
var TID300CobbAngle = utilities.TID300.CobbAngle;
|
|
4185
4178
|
var MEASUREMENT_TYPE = "CobbAngle";
|
|
4186
|
-
var trackingIdentifierTextValue$
|
|
4179
|
+
var trackingIdentifierTextValue$5 = "".concat(CORNERSTONE_3D_TAG, ":").concat(MEASUREMENT_TYPE);
|
|
4187
4180
|
var CobbAngle = /** @class */ (function () {
|
|
4188
4181
|
function CobbAngle() {
|
|
4189
4182
|
}
|
|
@@ -4248,7 +4241,7 @@ var CobbAngle = /** @class */ (function () {
|
|
|
4248
4241
|
point3: point3,
|
|
4249
4242
|
point4: point4,
|
|
4250
4243
|
rAngle: angle,
|
|
4251
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue$
|
|
4244
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$5,
|
|
4252
4245
|
finding: finding,
|
|
4253
4246
|
findingSites: findingSites || []
|
|
4254
4247
|
};
|
|
@@ -4512,7 +4505,7 @@ MeasurementReport.registerTool(EllipticalROI);
|
|
|
4512
4505
|
|
|
4513
4506
|
var TID300Polyline$1 = utilities.TID300.Polyline;
|
|
4514
4507
|
var TOOLTYPE = "RectangleROI";
|
|
4515
|
-
var trackingIdentifierTextValue$
|
|
4508
|
+
var trackingIdentifierTextValue$4 = "".concat(CORNERSTONE_3D_TAG, ":").concat(TOOLTYPE);
|
|
4516
4509
|
var RectangleROI = /** @class */ (function () {
|
|
4517
4510
|
function RectangleROI() {
|
|
4518
4511
|
}
|
|
@@ -4575,7 +4568,7 @@ var RectangleROI = /** @class */ (function () {
|
|
|
4575
4568
|
],
|
|
4576
4569
|
area: area,
|
|
4577
4570
|
perimeter: perimeter,
|
|
4578
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue$
|
|
4571
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$4,
|
|
4579
4572
|
finding: finding,
|
|
4580
4573
|
findingSites: findingSites || []
|
|
4581
4574
|
};
|
|
@@ -4597,14 +4590,14 @@ var RectangleROI = /** @class */ (function () {
|
|
|
4597
4590
|
}());
|
|
4598
4591
|
MeasurementReport.registerTool(RectangleROI);
|
|
4599
4592
|
|
|
4600
|
-
var TID300Length = utilities.TID300.Length;
|
|
4593
|
+
var TID300Length$1 = utilities.TID300.Length;
|
|
4601
4594
|
var LENGTH = "Length";
|
|
4602
|
-
var trackingIdentifierTextValue$
|
|
4595
|
+
var trackingIdentifierTextValue$3 = "".concat(CORNERSTONE_3D_TAG, ":").concat(LENGTH);
|
|
4603
4596
|
var Length = /*#__PURE__*/function () {
|
|
4604
4597
|
function Length() {
|
|
4605
4598
|
_classCallCheck(this, Length);
|
|
4606
4599
|
}
|
|
4607
|
-
_createClass(Length, null, [{
|
|
4600
|
+
return _createClass(Length, null, [{
|
|
4608
4601
|
key: "getMeasurementData",
|
|
4609
4602
|
value:
|
|
4610
4603
|
// TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport.
|
|
@@ -4667,17 +4660,16 @@ var Length = /*#__PURE__*/function () {
|
|
|
4667
4660
|
point1: point1,
|
|
4668
4661
|
point2: point2,
|
|
4669
4662
|
distance: distance,
|
|
4670
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue$
|
|
4663
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$3,
|
|
4671
4664
|
finding: finding,
|
|
4672
4665
|
findingSites: findingSites || []
|
|
4673
4666
|
};
|
|
4674
4667
|
}
|
|
4675
4668
|
}]);
|
|
4676
|
-
return Length;
|
|
4677
4669
|
}();
|
|
4678
4670
|
Length.toolType = LENGTH;
|
|
4679
4671
|
Length.utilityToolType = LENGTH;
|
|
4680
|
-
Length.TID300Representation = TID300Length;
|
|
4672
|
+
Length.TID300Representation = TID300Length$1;
|
|
4681
4673
|
Length.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
4682
4674
|
if (!TrackingIdentifier.includes(":")) {
|
|
4683
4675
|
return false;
|
|
@@ -4695,13 +4687,14 @@ MeasurementReport.registerTool(Length);
|
|
|
4695
4687
|
|
|
4696
4688
|
var TID300Polyline = utilities.TID300.Polyline;
|
|
4697
4689
|
var PLANARFREEHANDROI = "PlanarFreehandROI";
|
|
4698
|
-
var trackingIdentifierTextValue$
|
|
4690
|
+
var trackingIdentifierTextValue$2 = "".concat(CORNERSTONE_3D_TAG, ":").concat(PLANARFREEHANDROI);
|
|
4699
4691
|
var closedContourThreshold = 1e-5;
|
|
4700
4692
|
var PlanarFreehandROI = /** @class */ (function () {
|
|
4701
4693
|
function PlanarFreehandROI() {
|
|
4702
4694
|
}
|
|
4703
4695
|
PlanarFreehandROI.getMeasurementData = function (MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
4704
|
-
var _a
|
|
4696
|
+
var _a;
|
|
4697
|
+
var _b = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, PlanarFreehandROI.toolType), defaultState = _b.defaultState, NUMGroup = _b.NUMGroup, SCOORDGroup = _b.SCOORDGroup, ReferencedFrameNumber = _b.ReferencedFrameNumber;
|
|
4705
4698
|
var referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
4706
4699
|
var GraphicData = SCOORDGroup.GraphicData;
|
|
4707
4700
|
var worldCoords = [];
|
|
@@ -4725,8 +4718,7 @@ var PlanarFreehandROI = /** @class */ (function () {
|
|
|
4725
4718
|
}
|
|
4726
4719
|
var state = defaultState;
|
|
4727
4720
|
state.annotation.data = {
|
|
4728
|
-
polyline: worldCoords,
|
|
4729
|
-
isOpenContour: isOpenContour,
|
|
4721
|
+
contour: { polyline: worldCoords, closed: !isOpenContour },
|
|
4730
4722
|
handles: {
|
|
4731
4723
|
points: points,
|
|
4732
4724
|
activeHandleIndex: null,
|
|
@@ -4734,13 +4726,21 @@ var PlanarFreehandROI = /** @class */ (function () {
|
|
|
4734
4726
|
hasMoved: false
|
|
4735
4727
|
}
|
|
4736
4728
|
},
|
|
4729
|
+
cachedStats: (_a = {},
|
|
4730
|
+
_a["imageId:".concat(referencedImageId)] = {
|
|
4731
|
+
area: NUMGroup
|
|
4732
|
+
? NUMGroup.MeasuredValueSequence.NumericValue
|
|
4733
|
+
: null
|
|
4734
|
+
},
|
|
4735
|
+
_a),
|
|
4737
4736
|
frameNumber: ReferencedFrameNumber
|
|
4738
4737
|
};
|
|
4739
4738
|
return state;
|
|
4740
4739
|
};
|
|
4741
4740
|
PlanarFreehandROI.getTID300RepresentationArguments = function (tool, worldToImageCoords) {
|
|
4742
4741
|
var data = tool.data, finding = tool.finding, findingSites = tool.findingSites, metadata = tool.metadata;
|
|
4743
|
-
var
|
|
4742
|
+
var _a = data.contour, polyline = _a.polyline, closed = _a.closed;
|
|
4743
|
+
var isOpenContour = closed !== true;
|
|
4744
4744
|
var referencedImageId = metadata.referencedImageId;
|
|
4745
4745
|
if (!referencedImageId) {
|
|
4746
4746
|
throw new Error("PlanarFreehandROI.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
@@ -4754,13 +4754,19 @@ var PlanarFreehandROI = /** @class */ (function () {
|
|
|
4754
4754
|
// Explicitly expand to avoid ciruclar references.
|
|
4755
4755
|
points.push([firstPoint[0], firstPoint[1]]);
|
|
4756
4756
|
}
|
|
4757
|
-
var area =
|
|
4758
|
-
var perimeter = 0;
|
|
4757
|
+
var _b = data.cachedStats["imageId:".concat(referencedImageId)] || {}, area = _b.area, areaUnit = _b.areaUnit, modalityUnit = _b.modalityUnit, perimeter = _b.perimeter, mean = _b.mean, max = _b.max, stdDev = _b.stdDev;
|
|
4759
4758
|
return {
|
|
4759
|
+
/** From cachedStats */
|
|
4760
4760
|
points: points,
|
|
4761
4761
|
area: area,
|
|
4762
|
+
areaUnit: areaUnit,
|
|
4762
4763
|
perimeter: perimeter,
|
|
4763
|
-
|
|
4764
|
+
modalityUnit: modalityUnit,
|
|
4765
|
+
mean: mean,
|
|
4766
|
+
max: max,
|
|
4767
|
+
stdDev: stdDev,
|
|
4768
|
+
/** Other */
|
|
4769
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$2,
|
|
4764
4770
|
finding: finding,
|
|
4765
4771
|
findingSites: findingSites || []
|
|
4766
4772
|
};
|
|
@@ -4784,12 +4790,12 @@ MeasurementReport.registerTool(PlanarFreehandROI);
|
|
|
4784
4790
|
|
|
4785
4791
|
var TID300Point = utilities.TID300.Point;
|
|
4786
4792
|
var PROBE = "Probe";
|
|
4787
|
-
var trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(PROBE);
|
|
4793
|
+
var trackingIdentifierTextValue$1 = "".concat(CORNERSTONE_3D_TAG, ":").concat(PROBE);
|
|
4788
4794
|
var Probe = /*#__PURE__*/function () {
|
|
4789
4795
|
function Probe() {
|
|
4790
4796
|
_classCallCheck(this, Probe);
|
|
4791
4797
|
}
|
|
4792
|
-
_createClass(Probe, null, [{
|
|
4798
|
+
return _createClass(Probe, null, [{
|
|
4793
4799
|
key: "getMeasurementData",
|
|
4794
4800
|
value: function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
4795
4801
|
var _MeasurementReport$ge = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, Probe.toolType),
|
|
@@ -4837,14 +4843,13 @@ var Probe = /*#__PURE__*/function () {
|
|
|
4837
4843
|
});
|
|
4838
4844
|
var TID300RepresentationArguments = {
|
|
4839
4845
|
points: pointsImage,
|
|
4840
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue,
|
|
4846
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$1,
|
|
4841
4847
|
findingSites: findingSites || [],
|
|
4842
4848
|
finding: finding
|
|
4843
4849
|
};
|
|
4844
4850
|
return TID300RepresentationArguments;
|
|
4845
4851
|
}
|
|
4846
4852
|
}]);
|
|
4847
|
-
return Probe;
|
|
4848
4853
|
}();
|
|
4849
4854
|
Probe.toolType = PROBE;
|
|
4850
4855
|
Probe.utilityToolType = PROBE;
|
|
@@ -4864,6 +4869,75 @@ Probe.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
|
4864
4869
|
};
|
|
4865
4870
|
MeasurementReport.registerTool(Probe);
|
|
4866
4871
|
|
|
4872
|
+
var TID300Length = utilities.TID300.Length;
|
|
4873
|
+
var ULTRASOUND_DIRECTIONAL = "UltrasoundDirectionalTool";
|
|
4874
|
+
var trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(ULTRASOUND_DIRECTIONAL);
|
|
4875
|
+
var UltrasoundDirectional = /** @class */ (function () {
|
|
4876
|
+
function UltrasoundDirectional() {
|
|
4877
|
+
}
|
|
4878
|
+
// TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport.
|
|
4879
|
+
UltrasoundDirectional.getMeasurementData = function (MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
4880
|
+
var _a = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, UltrasoundDirectional.toolType), defaultState = _a.defaultState, SCOORDGroup = _a.SCOORDGroup, ReferencedFrameNumber = _a.ReferencedFrameNumber;
|
|
4881
|
+
var referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
4882
|
+
var GraphicData = SCOORDGroup.GraphicData;
|
|
4883
|
+
var worldCoords = [];
|
|
4884
|
+
for (var i = 0; i < GraphicData.length; i += 2) {
|
|
4885
|
+
var point = imageToWorldCoords(referencedImageId, [
|
|
4886
|
+
GraphicData[i],
|
|
4887
|
+
GraphicData[i + 1]
|
|
4888
|
+
]);
|
|
4889
|
+
worldCoords.push(point);
|
|
4890
|
+
}
|
|
4891
|
+
var state = defaultState;
|
|
4892
|
+
state.annotation.data = {
|
|
4893
|
+
handles: {
|
|
4894
|
+
points: [worldCoords[0], worldCoords[1]],
|
|
4895
|
+
activeHandleIndex: 0,
|
|
4896
|
+
textBox: {
|
|
4897
|
+
hasMoved: false
|
|
4898
|
+
}
|
|
4899
|
+
},
|
|
4900
|
+
cachedStats: {},
|
|
4901
|
+
frameNumber: ReferencedFrameNumber
|
|
4902
|
+
};
|
|
4903
|
+
return state;
|
|
4904
|
+
};
|
|
4905
|
+
UltrasoundDirectional.getTID300RepresentationArguments = function (tool, worldToImageCoords) {
|
|
4906
|
+
var data = tool.data, finding = tool.finding, findingSites = tool.findingSites, metadata = tool.metadata;
|
|
4907
|
+
var handles = data.handles;
|
|
4908
|
+
var referencedImageId = metadata.referencedImageId;
|
|
4909
|
+
if (!referencedImageId) {
|
|
4910
|
+
throw new Error("UltrasoundDirectionalTool.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
4911
|
+
}
|
|
4912
|
+
var start = worldToImageCoords(referencedImageId, handles.points[0]);
|
|
4913
|
+
var end = worldToImageCoords(referencedImageId, handles.points[1]);
|
|
4914
|
+
var point1 = { x: start[0], y: start[1] };
|
|
4915
|
+
var point2 = { x: end[0], y: end[1] };
|
|
4916
|
+
return {
|
|
4917
|
+
point1: point1,
|
|
4918
|
+
point2: point2,
|
|
4919
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue,
|
|
4920
|
+
finding: finding,
|
|
4921
|
+
findingSites: findingSites || []
|
|
4922
|
+
};
|
|
4923
|
+
};
|
|
4924
|
+
UltrasoundDirectional.toolType = ULTRASOUND_DIRECTIONAL;
|
|
4925
|
+
UltrasoundDirectional.utilityToolType = ULTRASOUND_DIRECTIONAL;
|
|
4926
|
+
UltrasoundDirectional.TID300Representation = TID300Length;
|
|
4927
|
+
UltrasoundDirectional.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
4928
|
+
if (!TrackingIdentifier.includes(":")) {
|
|
4929
|
+
return false;
|
|
4930
|
+
}
|
|
4931
|
+
var _a = TrackingIdentifier.split(":"), cornerstone3DTag = _a[0], toolType = _a[1];
|
|
4932
|
+
if (cornerstone3DTag !== CORNERSTONE_3D_TAG) {
|
|
4933
|
+
return false;
|
|
4934
|
+
}
|
|
4935
|
+
return toolType === ULTRASOUND_DIRECTIONAL;
|
|
4936
|
+
};
|
|
4937
|
+
return UltrasoundDirectional;
|
|
4938
|
+
}());
|
|
4939
|
+
MeasurementReport.registerTool(UltrasoundDirectional);
|
|
4940
|
+
|
|
4867
4941
|
var Normalizer = normalizers.Normalizer;
|
|
4868
4942
|
var SegmentationDerivation = derivations.Segmentation;
|
|
4869
4943
|
/**
|
|
@@ -4973,415 +5047,6 @@ var Segmentation$1 = /*#__PURE__*/Object.freeze({
|
|
|
4973
5047
|
generateToolState: generateToolState
|
|
4974
5048
|
});
|
|
4975
5049
|
|
|
4976
|
-
/**
|
|
4977
|
-
* Checks if point is within array
|
|
4978
|
-
* @param {*} array
|
|
4979
|
-
* @param {*} pt
|
|
4980
|
-
* @returns
|
|
4981
|
-
*/
|
|
4982
|
-
function ptInArray(array, pt) {
|
|
4983
|
-
var index = -1;
|
|
4984
|
-
for (var i = 0; i < array.length; i++) {
|
|
4985
|
-
if (isSamePoint(pt, array[i])) {
|
|
4986
|
-
index = i;
|
|
4987
|
-
}
|
|
4988
|
-
}
|
|
4989
|
-
return index;
|
|
4990
|
-
}
|
|
4991
|
-
|
|
4992
|
-
/**
|
|
4993
|
-
* Checks if point A and point B contain same values
|
|
4994
|
-
* @param {*} ptA
|
|
4995
|
-
* @param {*} ptB
|
|
4996
|
-
* @returns
|
|
4997
|
-
*/
|
|
4998
|
-
function isSamePoint(ptA, ptB) {
|
|
4999
|
-
if (ptA[0] == ptB[0] && ptA[1] == ptB[1] && ptA[2] == ptB[2]) {
|
|
5000
|
-
return true;
|
|
5001
|
-
} else {
|
|
5002
|
-
return false;
|
|
5003
|
-
}
|
|
5004
|
-
}
|
|
5005
|
-
|
|
5006
|
-
/**
|
|
5007
|
-
* Goes through linesArray and replaces all references of old index with new index
|
|
5008
|
-
* @param {*} linesArray
|
|
5009
|
-
* @param {*} oldIndex
|
|
5010
|
-
* @param {*} newIndex
|
|
5011
|
-
*/
|
|
5012
|
-
function replacePointIndexReferences(linesArray, oldIndex, newIndex) {
|
|
5013
|
-
for (var i = 0; i < linesArray.length; i++) {
|
|
5014
|
-
var line = linesArray[i];
|
|
5015
|
-
if (line.a == oldIndex) {
|
|
5016
|
-
line.a = newIndex;
|
|
5017
|
-
} else if (line.b == oldIndex) {
|
|
5018
|
-
line.b = newIndex;
|
|
5019
|
-
}
|
|
5020
|
-
}
|
|
5021
|
-
}
|
|
5022
|
-
|
|
5023
|
-
/**
|
|
5024
|
-
* Iterate through polyData from vtkjs and merge any points that are the same
|
|
5025
|
-
* then update merged point references within lines array
|
|
5026
|
-
* @param {*} polyData
|
|
5027
|
-
* @param {*} bypass
|
|
5028
|
-
* @returns
|
|
5029
|
-
*/
|
|
5030
|
-
function removeDuplicatePoints(polyData, bypass) {
|
|
5031
|
-
var points = polyData.getPoints();
|
|
5032
|
-
var lines = polyData.getLines();
|
|
5033
|
-
var pointsArray = [];
|
|
5034
|
-
for (var i = 0; i < points.getNumberOfPoints(); i++) {
|
|
5035
|
-
var pt = points.getPoint(i).slice();
|
|
5036
|
-
pointsArray.push(pt);
|
|
5037
|
-
}
|
|
5038
|
-
var linesArray = [];
|
|
5039
|
-
for (var _i = 0; _i < lines.getNumberOfCells(); _i++) {
|
|
5040
|
-
var cell = lines.getCell(_i * 3).slice();
|
|
5041
|
-
//console.log(JSON.stringify(cell));
|
|
5042
|
-
var a = cell[0];
|
|
5043
|
-
var b = cell[1];
|
|
5044
|
-
var line = {
|
|
5045
|
-
a: a,
|
|
5046
|
-
b: b
|
|
5047
|
-
};
|
|
5048
|
-
linesArray.push(line);
|
|
5049
|
-
}
|
|
5050
|
-
if (bypass) {
|
|
5051
|
-
return {
|
|
5052
|
-
points: pointsArray,
|
|
5053
|
-
lines: linesArray
|
|
5054
|
-
};
|
|
5055
|
-
}
|
|
5056
|
-
|
|
5057
|
-
// Iterate through points and replace any duplicates
|
|
5058
|
-
var newPoints = [];
|
|
5059
|
-
for (var _i2 = 0; _i2 < pointsArray.length; _i2++) {
|
|
5060
|
-
var _pt = pointsArray[_i2];
|
|
5061
|
-
var index = ptInArray(newPoints, _pt);
|
|
5062
|
-
if (index >= 0) {
|
|
5063
|
-
// Duplicate Point -> replace references in lines
|
|
5064
|
-
replacePointIndexReferences(linesArray, _i2, index);
|
|
5065
|
-
} else {
|
|
5066
|
-
index = newPoints.length;
|
|
5067
|
-
newPoints.push(_pt);
|
|
5068
|
-
replacePointIndexReferences(linesArray, _i2, index);
|
|
5069
|
-
}
|
|
5070
|
-
}
|
|
5071
|
-
|
|
5072
|
-
// Final pass through lines, remove any that refer to exact same point
|
|
5073
|
-
var newLines = [];
|
|
5074
|
-
linesArray.forEach(function (line) {
|
|
5075
|
-
if (line.a != line.b) {
|
|
5076
|
-
newLines.push(line);
|
|
5077
|
-
}
|
|
5078
|
-
});
|
|
5079
|
-
return {
|
|
5080
|
-
points: newPoints,
|
|
5081
|
-
lines: newLines
|
|
5082
|
-
};
|
|
5083
|
-
}
|
|
5084
|
-
|
|
5085
|
-
function findNextLink(line, lines, contourPoints) {
|
|
5086
|
-
var index = -1;
|
|
5087
|
-
lines.forEach(function (cell, i) {
|
|
5088
|
-
if (index >= 0) {
|
|
5089
|
-
return;
|
|
5090
|
-
}
|
|
5091
|
-
if (cell.a == line.b) {
|
|
5092
|
-
index = i;
|
|
5093
|
-
}
|
|
5094
|
-
});
|
|
5095
|
-
if (index >= 0) {
|
|
5096
|
-
var nextLine = lines[index];
|
|
5097
|
-
lines.splice(index, 1);
|
|
5098
|
-
contourPoints.push(nextLine.b);
|
|
5099
|
-
if (contourPoints[0] == nextLine.b) {
|
|
5100
|
-
return {
|
|
5101
|
-
remainingLines: lines,
|
|
5102
|
-
contourPoints: contourPoints,
|
|
5103
|
-
type: "CLOSED_PLANAR"
|
|
5104
|
-
//type: 'CLOSEDPLANAR_XOR',
|
|
5105
|
-
};
|
|
5106
|
-
}
|
|
5107
|
-
|
|
5108
|
-
return findNextLink(nextLine, lines, contourPoints);
|
|
5109
|
-
}
|
|
5110
|
-
return {
|
|
5111
|
-
remainingLines: lines,
|
|
5112
|
-
contourPoints: contourPoints,
|
|
5113
|
-
type: "OPEN_PLANAR"
|
|
5114
|
-
};
|
|
5115
|
-
}
|
|
5116
|
-
|
|
5117
|
-
/**
|
|
5118
|
-
*
|
|
5119
|
-
* @param {*} lines
|
|
5120
|
-
*/
|
|
5121
|
-
function findContours(lines) {
|
|
5122
|
-
if (lines.length == 0) {
|
|
5123
|
-
return [];
|
|
5124
|
-
}
|
|
5125
|
-
var contourPoints = [];
|
|
5126
|
-
var firstCell = lines.shift();
|
|
5127
|
-
contourPoints.push(firstCell.a);
|
|
5128
|
-
contourPoints.push(firstCell.b);
|
|
5129
|
-
var result = findNextLink(firstCell, lines, contourPoints);
|
|
5130
|
-
if (result.remainingLines.length == 0) {
|
|
5131
|
-
return [{
|
|
5132
|
-
type: result.type,
|
|
5133
|
-
contourPoints: result.contourPoints
|
|
5134
|
-
}];
|
|
5135
|
-
} else {
|
|
5136
|
-
var extraContours = findContours(result.remainingLines);
|
|
5137
|
-
extraContours.push({
|
|
5138
|
-
type: result.type,
|
|
5139
|
-
contourPoints: result.contourPoints
|
|
5140
|
-
});
|
|
5141
|
-
return extraContours;
|
|
5142
|
-
}
|
|
5143
|
-
}
|
|
5144
|
-
function findContoursFromReducedSet(lines, points) {
|
|
5145
|
-
return findContours(lines);
|
|
5146
|
-
}
|
|
5147
|
-
|
|
5148
|
-
function generateContourSetsFromLabelmap(_ref) {
|
|
5149
|
-
var segmentations = _ref.segmentations,
|
|
5150
|
-
cornerstoneCache = _ref.cornerstoneCache,
|
|
5151
|
-
cornerstoneToolsEnums = _ref.cornerstoneToolsEnums,
|
|
5152
|
-
vtkUtils = _ref.vtkUtils;
|
|
5153
|
-
var LABELMAP = cornerstoneToolsEnums.SegmentationRepresentations.Labelmap;
|
|
5154
|
-
var representationData = segmentations.representationData,
|
|
5155
|
-
segments = segmentations.segments;
|
|
5156
|
-
var segVolumeId = representationData[LABELMAP].volumeId;
|
|
5157
|
-
|
|
5158
|
-
// Get segmentation volume
|
|
5159
|
-
var vol = cornerstoneCache.getVolume(segVolumeId);
|
|
5160
|
-
if (!vol) {
|
|
5161
|
-
console.warn("No volume found for ".concat(segVolumeId));
|
|
5162
|
-
return;
|
|
5163
|
-
}
|
|
5164
|
-
var numSlices = vol.dimensions[2];
|
|
5165
|
-
|
|
5166
|
-
// Get image volume segmentation references
|
|
5167
|
-
var imageVol = cornerstoneCache.getVolume(vol.referencedVolumeId);
|
|
5168
|
-
if (!imageVol) {
|
|
5169
|
-
console.warn("No volume found for ".concat(vol.referencedVolumeId));
|
|
5170
|
-
return;
|
|
5171
|
-
}
|
|
5172
|
-
|
|
5173
|
-
// NOTE: Workaround for marching squares not finding closed contours at
|
|
5174
|
-
// boundary of image volume, clear pixels along x-y border of volume
|
|
5175
|
-
var segData = vol.imageData.getPointData().getScalars().getData();
|
|
5176
|
-
var pixelsPerSlice = vol.dimensions[0] * vol.dimensions[1];
|
|
5177
|
-
for (var z = 0; z < numSlices; z++) {
|
|
5178
|
-
for (var y = 0; y < vol.dimensions[1]; y++) {
|
|
5179
|
-
for (var x = 0; x < vol.dimensions[0]; x++) {
|
|
5180
|
-
var index = x + y * vol.dimensions[0] + z * pixelsPerSlice;
|
|
5181
|
-
if (x === 0 || y === 0 || x === vol.dimensions[0] - 1 || y === vol.dimensions[1] - 1) {
|
|
5182
|
-
segData[index] = 0;
|
|
5183
|
-
}
|
|
5184
|
-
}
|
|
5185
|
-
}
|
|
5186
|
-
}
|
|
5187
|
-
|
|
5188
|
-
// end workaround
|
|
5189
|
-
//
|
|
5190
|
-
//
|
|
5191
|
-
var ContourSets = [];
|
|
5192
|
-
|
|
5193
|
-
// Iterate through all segments in current segmentation set
|
|
5194
|
-
var numSegments = segments.length;
|
|
5195
|
-
for (var segIndex = 0; segIndex < numSegments; segIndex++) {
|
|
5196
|
-
var segment = segments[segIndex];
|
|
5197
|
-
|
|
5198
|
-
// Skip empty segments
|
|
5199
|
-
if (!segment) {
|
|
5200
|
-
continue;
|
|
5201
|
-
}
|
|
5202
|
-
var contourSequence = [];
|
|
5203
|
-
for (var sliceIndex = 0; sliceIndex < numSlices; sliceIndex++) {
|
|
5204
|
-
// Check if the slice is empty before running marching cube
|
|
5205
|
-
if (isSliceEmptyForSegment(sliceIndex, segData, pixelsPerSlice, segIndex)) {
|
|
5206
|
-
continue;
|
|
5207
|
-
}
|
|
5208
|
-
try {
|
|
5209
|
-
var _reducedSet$points;
|
|
5210
|
-
var scalars = vtkUtils.vtkDataArray.newInstance({
|
|
5211
|
-
name: "Scalars",
|
|
5212
|
-
values: Array.from(segData),
|
|
5213
|
-
numberOfComponents: 1
|
|
5214
|
-
});
|
|
5215
|
-
|
|
5216
|
-
// Modify segData for this specific segment directly
|
|
5217
|
-
var segmentIndexFound = false;
|
|
5218
|
-
for (var i = 0; i < segData.length; i++) {
|
|
5219
|
-
var value = segData[i];
|
|
5220
|
-
if (value === segIndex) {
|
|
5221
|
-
segmentIndexFound = true;
|
|
5222
|
-
scalars.setValue(i, 1);
|
|
5223
|
-
} else {
|
|
5224
|
-
scalars.setValue(i, 0);
|
|
5225
|
-
}
|
|
5226
|
-
}
|
|
5227
|
-
if (!segmentIndexFound) {
|
|
5228
|
-
continue;
|
|
5229
|
-
}
|
|
5230
|
-
var mSquares = vtkUtils.vtkImageMarchingSquares.newInstance({
|
|
5231
|
-
slice: sliceIndex
|
|
5232
|
-
});
|
|
5233
|
-
|
|
5234
|
-
// filter out the scalar data so that only it has background and
|
|
5235
|
-
// the current segment index
|
|
5236
|
-
var imageDataCopy = vtkUtils.vtkImageData.newInstance();
|
|
5237
|
-
imageDataCopy.shallowCopy(vol.imageData);
|
|
5238
|
-
imageDataCopy.getPointData().setScalars(scalars);
|
|
5239
|
-
|
|
5240
|
-
// Connect pipeline
|
|
5241
|
-
mSquares.setInputData(imageDataCopy);
|
|
5242
|
-
var cValues = [];
|
|
5243
|
-
cValues[0] = 1;
|
|
5244
|
-
mSquares.setContourValues(cValues);
|
|
5245
|
-
mSquares.setMergePoints(false);
|
|
5246
|
-
|
|
5247
|
-
// Perform marching squares
|
|
5248
|
-
var msOutput = mSquares.getOutputData();
|
|
5249
|
-
|
|
5250
|
-
// Clean up output from marching squares
|
|
5251
|
-
var reducedSet = removeDuplicatePoints(msOutput);
|
|
5252
|
-
if ((_reducedSet$points = reducedSet.points) !== null && _reducedSet$points !== void 0 && _reducedSet$points.length) {
|
|
5253
|
-
var contours = findContoursFromReducedSet(reducedSet.lines, reducedSet.points);
|
|
5254
|
-
contourSequence.push({
|
|
5255
|
-
referencedImageId: imageVol.imageIds[sliceIndex],
|
|
5256
|
-
contours: contours,
|
|
5257
|
-
polyData: reducedSet
|
|
5258
|
-
});
|
|
5259
|
-
}
|
|
5260
|
-
} catch (e) {
|
|
5261
|
-
console.warn(sliceIndex);
|
|
5262
|
-
console.warn(e);
|
|
5263
|
-
}
|
|
5264
|
-
}
|
|
5265
|
-
var metadata = {
|
|
5266
|
-
referencedImageId: imageVol.imageIds[0],
|
|
5267
|
-
// just use 0
|
|
5268
|
-
FrameOfReferenceUID: imageVol.metadata.FrameOfReferenceUID
|
|
5269
|
-
};
|
|
5270
|
-
var ContourSet = {
|
|
5271
|
-
label: segment.label,
|
|
5272
|
-
color: segment.color,
|
|
5273
|
-
metadata: metadata,
|
|
5274
|
-
sliceContours: contourSequence
|
|
5275
|
-
};
|
|
5276
|
-
ContourSets.push(ContourSet);
|
|
5277
|
-
}
|
|
5278
|
-
return ContourSets;
|
|
5279
|
-
}
|
|
5280
|
-
function isSliceEmptyForSegment(sliceIndex, segData, pixelsPerSlice, segIndex) {
|
|
5281
|
-
var startIdx = sliceIndex * pixelsPerSlice;
|
|
5282
|
-
var endIdx = startIdx + pixelsPerSlice;
|
|
5283
|
-
for (var i = startIdx; i < endIdx; i++) {
|
|
5284
|
-
if (segData[i] === segIndex) {
|
|
5285
|
-
return false;
|
|
5286
|
-
}
|
|
5287
|
-
}
|
|
5288
|
-
return true;
|
|
5289
|
-
}
|
|
5290
|
-
|
|
5291
|
-
// comment
|
|
5292
|
-
var RectangleROIStartEndThreshold = /*#__PURE__*/function () {
|
|
5293
|
-
function RectangleROIStartEndThreshold() {
|
|
5294
|
-
_classCallCheck(this, RectangleROIStartEndThreshold);
|
|
5295
|
-
} // empty
|
|
5296
|
-
_createClass(RectangleROIStartEndThreshold, null, [{
|
|
5297
|
-
key: "getContourSequence",
|
|
5298
|
-
value: function getContourSequence(toolData, metadataProvider) {
|
|
5299
|
-
var data = toolData.data;
|
|
5300
|
-
var _data$cachedStats = data.cachedStats,
|
|
5301
|
-
projectionPoints = _data$cachedStats.projectionPoints,
|
|
5302
|
-
projectionPointsImageIds = _data$cachedStats.projectionPointsImageIds;
|
|
5303
|
-
return projectionPoints.map(function (point, index) {
|
|
5304
|
-
var ContourData = getPointData(point);
|
|
5305
|
-
var ContourImageSequence = getContourImageSequence(projectionPointsImageIds[index], metadataProvider);
|
|
5306
|
-
return {
|
|
5307
|
-
NumberOfContourPoints: ContourData.length / 3,
|
|
5308
|
-
ContourImageSequence: ContourImageSequence,
|
|
5309
|
-
ContourGeometricType: "CLOSED_PLANAR",
|
|
5310
|
-
ContourData: ContourData
|
|
5311
|
-
};
|
|
5312
|
-
});
|
|
5313
|
-
}
|
|
5314
|
-
}]);
|
|
5315
|
-
return RectangleROIStartEndThreshold;
|
|
5316
|
-
}();
|
|
5317
|
-
RectangleROIStartEndThreshold.toolName = "RectangleROIStartEndThreshold";
|
|
5318
|
-
function getPointData(points) {
|
|
5319
|
-
// Since this is a closed contour, the order of the points is important.
|
|
5320
|
-
// re-order the points to be in the correct order clockwise
|
|
5321
|
-
// Spread to make sure Float32Arrays are converted to arrays
|
|
5322
|
-
var orderedPoints = [].concat(_toConsumableArray(points[0]), _toConsumableArray(points[1]), _toConsumableArray(points[3]), _toConsumableArray(points[2]));
|
|
5323
|
-
var pointsArray = orderedPoints.flat();
|
|
5324
|
-
|
|
5325
|
-
// reduce the precision of the points to 2 decimal places
|
|
5326
|
-
var pointsArrayWithPrecision = pointsArray.map(function (point) {
|
|
5327
|
-
return point.toFixed(2);
|
|
5328
|
-
});
|
|
5329
|
-
return pointsArrayWithPrecision;
|
|
5330
|
-
}
|
|
5331
|
-
function getContourImageSequence(imageId, metadataProvider) {
|
|
5332
|
-
var sopCommon = metadataProvider.get("sopCommonModule", imageId);
|
|
5333
|
-
return {
|
|
5334
|
-
ReferencedSOPClassUID: sopCommon.sopClassUID,
|
|
5335
|
-
ReferencedSOPInstanceUID: sopCommon.sopInstanceUID
|
|
5336
|
-
};
|
|
5337
|
-
}
|
|
5338
|
-
|
|
5339
|
-
function validateAnnotation(annotation) {
|
|
5340
|
-
if (!(annotation !== null && annotation !== void 0 && annotation.data)) {
|
|
5341
|
-
throw new Error("Tool data is empty");
|
|
5342
|
-
}
|
|
5343
|
-
if (!annotation.metadata || annotation.metadata.referenceImageId) {
|
|
5344
|
-
throw new Error("Tool data is not associated with any imageId");
|
|
5345
|
-
}
|
|
5346
|
-
}
|
|
5347
|
-
var AnnotationToPointData = /*#__PURE__*/function () {
|
|
5348
|
-
function AnnotationToPointData() {
|
|
5349
|
-
_classCallCheck(this, AnnotationToPointData);
|
|
5350
|
-
} // empty
|
|
5351
|
-
_createClass(AnnotationToPointData, null, [{
|
|
5352
|
-
key: "convert",
|
|
5353
|
-
value: function convert(annotation, index, metadataProvider) {
|
|
5354
|
-
validateAnnotation(annotation);
|
|
5355
|
-
var toolName = annotation.metadata.toolName;
|
|
5356
|
-
var toolClass = AnnotationToPointData.TOOL_NAMES[toolName];
|
|
5357
|
-
if (!toolClass) {
|
|
5358
|
-
throw new Error("Unknown tool type: ".concat(toolName, ", cannot convert to RTSSReport"));
|
|
5359
|
-
}
|
|
5360
|
-
|
|
5361
|
-
// Each toolData should become a list of contours, ContourSequence
|
|
5362
|
-
// contains a list of contours with their pointData, their geometry
|
|
5363
|
-
// type and their length.
|
|
5364
|
-
var ContourSequence = toolClass.getContourSequence(annotation, metadataProvider);
|
|
5365
|
-
|
|
5366
|
-
// Todo: random rgb color for now, options should be passed in
|
|
5367
|
-
var color = [Math.floor(Math.random() * 255), Math.floor(Math.random() * 255), Math.floor(Math.random() * 255)];
|
|
5368
|
-
return {
|
|
5369
|
-
ReferencedROINumber: index + 1,
|
|
5370
|
-
ROIDisplayColor: color,
|
|
5371
|
-
ContourSequence: ContourSequence
|
|
5372
|
-
};
|
|
5373
|
-
}
|
|
5374
|
-
}, {
|
|
5375
|
-
key: "register",
|
|
5376
|
-
value: function register(toolClass) {
|
|
5377
|
-
AnnotationToPointData.TOOL_NAMES[toolClass.toolName] = toolClass;
|
|
5378
|
-
}
|
|
5379
|
-
}]);
|
|
5380
|
-
return AnnotationToPointData;
|
|
5381
|
-
}();
|
|
5382
|
-
AnnotationToPointData.TOOL_NAMES = {};
|
|
5383
|
-
AnnotationToPointData.register(RectangleROIStartEndThreshold);
|
|
5384
|
-
|
|
5385
5050
|
function getPatientModule(imageId, metadataProvider) {
|
|
5386
5051
|
var generalSeriesModule = metadataProvider.get("generalSeriesModule", imageId);
|
|
5387
5052
|
var generalStudyModule = metadataProvider.get("generalStudyModule", imageId);
|
|
@@ -5476,6 +5141,7 @@ function getStructureSetModule(contour, index) {
|
|
|
5476
5141
|
};
|
|
5477
5142
|
}
|
|
5478
5143
|
|
|
5144
|
+
var _a = utilities$1.contours, generateContourSetsFromLabelmap$1 = _a.generateContourSetsFromLabelmap, AnnotationToPointData = _a.AnnotationToPointData;
|
|
5479
5145
|
var DicomMetaDictionary = dcmjs.data.DicomMetaDictionary;
|
|
5480
5146
|
/**
|
|
5481
5147
|
* Convert handles to RTSS report containing the dcmjs dicom dataset.
|
|
@@ -5490,14 +5156,11 @@ var DicomMetaDictionary = dcmjs.data.DicomMetaDictionary;
|
|
|
5490
5156
|
* @param csTools - cornerstone tool instance
|
|
5491
5157
|
* @returns Report object containing the dataset
|
|
5492
5158
|
*/
|
|
5493
|
-
function generateRTSSFromSegmentations(segmentations, metadataProvider, DicomMetadataStore
|
|
5159
|
+
function generateRTSSFromSegmentations(segmentations, metadataProvider, DicomMetadataStore) {
|
|
5494
5160
|
// Convert segmentations to ROIContours
|
|
5495
5161
|
var roiContours = [];
|
|
5496
|
-
var contourSets = generateContourSetsFromLabelmap({
|
|
5497
|
-
segmentations: segmentations
|
|
5498
|
-
cornerstoneCache: cornerstoneCache,
|
|
5499
|
-
cornerstoneToolsEnums: cornerstoneToolsEnums,
|
|
5500
|
-
vtkUtils: vtkUtils
|
|
5162
|
+
var contourSets = generateContourSetsFromLabelmap$1({
|
|
5163
|
+
segmentations: segmentations
|
|
5501
5164
|
});
|
|
5502
5165
|
contourSets.forEach(function (contourSet, segIndex) {
|
|
5503
5166
|
// Check contour set isn't undefined
|
|
@@ -5601,7 +5264,7 @@ function generateRTSSFromSegmentations(segmentations, metadataProvider, DicomMet
|
|
|
5601
5264
|
vr: "UI"
|
|
5602
5265
|
},
|
|
5603
5266
|
ImplementationClassUID: {
|
|
5604
|
-
Value: [DicomMetaDictionary.uid()],
|
|
5267
|
+
Value: [DicomMetaDictionary.uid()], // TODO: could be git hash or other valid id
|
|
5605
5268
|
vr: "UI"
|
|
5606
5269
|
},
|
|
5607
5270
|
ImplementationVersionName: {
|
|
@@ -5610,6 +5273,7 @@ function generateRTSSFromSegmentations(segmentations, metadataProvider, DicomMet
|
|
|
5610
5273
|
}
|
|
5611
5274
|
};
|
|
5612
5275
|
dataset._meta = _meta;
|
|
5276
|
+
dataset.SpecificCharacterSet = "ISO_IR 192";
|
|
5613
5277
|
return dataset;
|
|
5614
5278
|
}
|
|
5615
5279
|
/**
|
|
@@ -5618,19 +5282,18 @@ function generateRTSSFromSegmentations(segmentations, metadataProvider, DicomMet
|
|
|
5618
5282
|
* Note: The tool data needs to be formatted in a specific way, and currently
|
|
5619
5283
|
* it is limited to the RectangleROIStartEndTool in the Cornerstone.
|
|
5620
5284
|
*
|
|
5621
|
-
* @param annotations Array of Cornerstone tool annotation data
|
|
5622
|
-
* @param metadataProvider Metadata provider
|
|
5623
|
-
* @param options report generation options
|
|
5285
|
+
* @param annotations - Array of Cornerstone tool annotation data
|
|
5286
|
+
* @param metadataProvider - Metadata provider
|
|
5624
5287
|
* @returns Report object containing the dataset
|
|
5625
5288
|
*/
|
|
5626
|
-
function generateRTSSFromAnnotations(annotations, metadataProvider, DicomMetadataStore
|
|
5289
|
+
function generateRTSSFromAnnotations(annotations, metadataProvider, DicomMetadataStore) {
|
|
5627
5290
|
var rtMetadata = {
|
|
5628
5291
|
name: "RTSS from Annotations",
|
|
5629
5292
|
label: "RTSS from Annotations"
|
|
5630
5293
|
};
|
|
5631
5294
|
var dataset = _initializeDataset(rtMetadata, annotations[0].metadata, metadataProvider);
|
|
5632
5295
|
annotations.forEach(function (annotation, index) {
|
|
5633
|
-
var ContourSequence = AnnotationToPointData.convert(annotation, index, metadataProvider
|
|
5296
|
+
var ContourSequence = AnnotationToPointData.convert(annotation, index, metadataProvider);
|
|
5634
5297
|
dataset.StructureSetROISequence.push(getStructureSetModule(annotation, index));
|
|
5635
5298
|
dataset.ROIContourSequence.push(ContourSequence);
|
|
5636
5299
|
dataset.RTROIObservationsSequence.push(getRTROIObservationsSequence(annotation, index));
|
|
@@ -5653,7 +5316,7 @@ function generateRTSSFromAnnotations(annotations, metadataProvider, DicomMetadat
|
|
|
5653
5316
|
vr: "UI"
|
|
5654
5317
|
},
|
|
5655
5318
|
ImplementationClassUID: {
|
|
5656
|
-
Value: [DicomMetaDictionary.uid()],
|
|
5319
|
+
Value: [DicomMetaDictionary.uid()], // TODO: could be git hash or other valid id
|
|
5657
5320
|
vr: "UI"
|
|
5658
5321
|
},
|
|
5659
5322
|
ImplementationVersionName: {
|
|
@@ -5662,6 +5325,7 @@ function generateRTSSFromAnnotations(annotations, metadataProvider, DicomMetadat
|
|
|
5662
5325
|
}
|
|
5663
5326
|
};
|
|
5664
5327
|
dataset._meta = _meta;
|
|
5328
|
+
dataset.SpecificCharacterSet = "ISO_IR 192";
|
|
5665
5329
|
return dataset;
|
|
5666
5330
|
}
|
|
5667
5331
|
// /**
|
|
@@ -5683,9 +5347,11 @@ function _initializeDataset(rtMetadata, imgMetadata, metadataProvider) {
|
|
|
5683
5347
|
var studyInstanceUID = metadataProvider.get("generalSeriesModule", imageId).studyInstanceUID;
|
|
5684
5348
|
var patientModule = getPatientModule(imageId, metadataProvider);
|
|
5685
5349
|
var rtSeriesModule = getRTSeriesModule(DicomMetaDictionary);
|
|
5686
|
-
return __assign(__assign(__assign({ StructureSetROISequence: [], ROIContourSequence: [], RTROIObservationsSequence: [], ReferencedSeriesSequence: [], ReferencedFrameOfReferenceSequence: [] }, patientModule), rtSeriesModule), { StudyInstanceUID: studyInstanceUID, SOPClassUID: "1.2.840.10008.5.1.4.1.1.481.3", SOPInstanceUID: rtSOPInstanceUID, Manufacturer: "dcmjs", Modality: "RTSTRUCT", FrameOfReferenceUID: FrameOfReferenceUID, PositionReferenceIndicator: "", StructureSetLabel: rtMetadata.label || "", StructureSetName: rtMetadata.name || "", ReferringPhysicianName: "", OperatorsName: "", StructureSetDate: DicomMetaDictionary.date(), StructureSetTime: DicomMetaDictionary.time() });
|
|
5350
|
+
return __assign(__assign(__assign({ StructureSetROISequence: [], ROIContourSequence: [], RTROIObservationsSequence: [], ReferencedSeriesSequence: [], ReferencedFrameOfReferenceSequence: [] }, patientModule), rtSeriesModule), { StudyInstanceUID: studyInstanceUID, SOPClassUID: "1.2.840.10008.5.1.4.1.1.481.3", SOPInstanceUID: rtSOPInstanceUID, Manufacturer: "dcmjs", Modality: "RTSTRUCT", FrameOfReferenceUID: FrameOfReferenceUID, PositionReferenceIndicator: "", StructureSetLabel: rtMetadata.label || "", StructureSetName: rtMetadata.name || "", ReferringPhysicianName: "", OperatorsName: "", StructureSetDate: DicomMetaDictionary.date(), StructureSetTime: DicomMetaDictionary.time(), _meta: null });
|
|
5687
5351
|
}
|
|
5688
5352
|
|
|
5353
|
+
var generateContourSetsFromLabelmap = utilities$1.contours.generateContourSetsFromLabelmap;
|
|
5354
|
+
|
|
5689
5355
|
var RTSS = /*#__PURE__*/Object.freeze({
|
|
5690
5356
|
__proto__: null,
|
|
5691
5357
|
generateContourSetsFromLabelmap: generateContourSetsFromLabelmap,
|
|
@@ -5704,6 +5370,7 @@ var Cornerstone3DSR = {
|
|
|
5704
5370
|
ArrowAnnotate: ArrowAnnotate,
|
|
5705
5371
|
Probe: Probe,
|
|
5706
5372
|
PlanarFreehandROI: PlanarFreehandROI,
|
|
5373
|
+
UltrasoundDirectional: UltrasoundDirectional,
|
|
5707
5374
|
MeasurementReport: MeasurementReport,
|
|
5708
5375
|
CodeScheme: CodingScheme,
|
|
5709
5376
|
CORNERSTONE_3D_TAG: CORNERSTONE_3D_TAG
|
|
@@ -5848,7 +5515,7 @@ var Segmentation = /*#__PURE__*/function () {
|
|
|
5848
5515
|
* @param dataset
|
|
5849
5516
|
* @return {{}}
|
|
5850
5517
|
*/
|
|
5851
|
-
_createClass(Segmentation, null, [{
|
|
5518
|
+
return _createClass(Segmentation, null, [{
|
|
5852
5519
|
key: "generateSegments",
|
|
5853
5520
|
value: function generateSegments(dataset) {
|
|
5854
5521
|
if (dataset.SegmentSequence.constructor.name !== "Array") {
|
|
@@ -5895,7 +5562,6 @@ var Segmentation = /*#__PURE__*/function () {
|
|
|
5895
5562
|
return segments;
|
|
5896
5563
|
}
|
|
5897
5564
|
}]);
|
|
5898
|
-
return Segmentation;
|
|
5899
5565
|
}();
|
|
5900
5566
|
|
|
5901
5567
|
var VTKjsSEG = {
|