@cornerstonejs/adapters 2.0.0-beta.5 → 2.0.0-beta.7
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 +491 -787
- 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,355 +2,356 @@ 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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
import { utilities as utilities$1 } from '@cornerstonejs/tools';
|
|
6
|
+
|
|
7
|
+
function _iterableToArrayLimit(r, l) {
|
|
8
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
9
|
+
if (null != t) {
|
|
10
|
+
var e,
|
|
11
|
+
n,
|
|
12
|
+
i,
|
|
13
|
+
u,
|
|
14
|
+
a = [],
|
|
15
|
+
f = !0,
|
|
16
|
+
o = !1;
|
|
16
17
|
try {
|
|
17
|
-
if (
|
|
18
|
-
if (Object(
|
|
19
|
-
|
|
20
|
-
} else for (; !(
|
|
21
|
-
} catch (
|
|
22
|
-
|
|
18
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
19
|
+
if (Object(t) !== t) return;
|
|
20
|
+
f = !1;
|
|
21
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
22
|
+
} catch (r) {
|
|
23
|
+
o = !0, n = r;
|
|
23
24
|
} finally {
|
|
24
25
|
try {
|
|
25
|
-
if (!
|
|
26
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
26
27
|
} finally {
|
|
27
|
-
if (
|
|
28
|
+
if (o) throw n;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
|
-
return
|
|
31
|
+
return a;
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
function ownKeys(
|
|
34
|
-
var
|
|
34
|
+
function ownKeys(e, r) {
|
|
35
|
+
var t = Object.keys(e);
|
|
35
36
|
if (Object.getOwnPropertySymbols) {
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
return Object.getOwnPropertyDescriptor(
|
|
39
|
-
})),
|
|
37
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
38
|
+
r && (o = o.filter(function (r) {
|
|
39
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
40
|
+
})), t.push.apply(t, o);
|
|
40
41
|
}
|
|
41
|
-
return
|
|
42
|
+
return t;
|
|
42
43
|
}
|
|
43
|
-
function _objectSpread2(
|
|
44
|
-
for (var
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
_defineProperty(
|
|
48
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
49
|
-
Object.defineProperty(
|
|
44
|
+
function _objectSpread2(e) {
|
|
45
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
46
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
47
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
48
|
+
_defineProperty(e, r, t[r]);
|
|
49
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
50
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
|
-
return
|
|
53
|
+
return e;
|
|
53
54
|
}
|
|
54
55
|
function _regeneratorRuntime() {
|
|
55
56
|
_regeneratorRuntime = function () {
|
|
56
|
-
return
|
|
57
|
+
return e;
|
|
57
58
|
};
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
var t,
|
|
60
|
+
e = {},
|
|
61
|
+
r = Object.prototype,
|
|
62
|
+
n = r.hasOwnProperty,
|
|
63
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
64
|
+
t[e] = r.value;
|
|
63
65
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
function define(
|
|
69
|
-
return Object.defineProperty(
|
|
70
|
-
value:
|
|
66
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
67
|
+
a = i.iterator || "@@iterator",
|
|
68
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
69
|
+
u = i.toStringTag || "@@toStringTag";
|
|
70
|
+
function define(t, e, r) {
|
|
71
|
+
return Object.defineProperty(t, e, {
|
|
72
|
+
value: r,
|
|
71
73
|
enumerable: !0,
|
|
72
74
|
configurable: !0,
|
|
73
75
|
writable: !0
|
|
74
|
-
}),
|
|
76
|
+
}), t[e];
|
|
75
77
|
}
|
|
76
78
|
try {
|
|
77
79
|
define({}, "");
|
|
78
|
-
} catch (
|
|
79
|
-
define = function (
|
|
80
|
-
return
|
|
80
|
+
} catch (t) {
|
|
81
|
+
define = function (t, e, r) {
|
|
82
|
+
return t[e] = r;
|
|
81
83
|
};
|
|
82
84
|
}
|
|
83
|
-
function wrap(
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return
|
|
88
|
-
value: makeInvokeMethod(
|
|
89
|
-
}),
|
|
85
|
+
function wrap(t, e, r, n) {
|
|
86
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
87
|
+
a = Object.create(i.prototype),
|
|
88
|
+
c = new Context(n || []);
|
|
89
|
+
return o(a, "_invoke", {
|
|
90
|
+
value: makeInvokeMethod(t, r, c)
|
|
91
|
+
}), a;
|
|
90
92
|
}
|
|
91
|
-
function tryCatch(
|
|
93
|
+
function tryCatch(t, e, r) {
|
|
92
94
|
try {
|
|
93
95
|
return {
|
|
94
96
|
type: "normal",
|
|
95
|
-
arg:
|
|
97
|
+
arg: t.call(e, r)
|
|
96
98
|
};
|
|
97
|
-
} catch (
|
|
99
|
+
} catch (t) {
|
|
98
100
|
return {
|
|
99
101
|
type: "throw",
|
|
100
|
-
arg:
|
|
102
|
+
arg: t
|
|
101
103
|
};
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
|
-
|
|
105
|
-
var
|
|
106
|
+
e.wrap = wrap;
|
|
107
|
+
var h = "suspendedStart",
|
|
108
|
+
l = "suspendedYield",
|
|
109
|
+
f = "executing",
|
|
110
|
+
s = "completed",
|
|
111
|
+
y = {};
|
|
106
112
|
function Generator() {}
|
|
107
113
|
function GeneratorFunction() {}
|
|
108
114
|
function GeneratorFunctionPrototype() {}
|
|
109
|
-
var
|
|
110
|
-
define(
|
|
115
|
+
var p = {};
|
|
116
|
+
define(p, a, function () {
|
|
111
117
|
return this;
|
|
112
118
|
});
|
|
113
|
-
var
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
var
|
|
117
|
-
function defineIteratorMethods(
|
|
118
|
-
["next", "throw", "return"].forEach(function (
|
|
119
|
-
define(
|
|
120
|
-
return this._invoke(
|
|
119
|
+
var d = Object.getPrototypeOf,
|
|
120
|
+
v = d && d(d(values([])));
|
|
121
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
122
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
123
|
+
function defineIteratorMethods(t) {
|
|
124
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
125
|
+
define(t, e, function (t) {
|
|
126
|
+
return this._invoke(e, t);
|
|
121
127
|
});
|
|
122
128
|
});
|
|
123
129
|
}
|
|
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",
|
|
130
|
+
function AsyncIterator(t, e) {
|
|
131
|
+
function invoke(r, o, i, a) {
|
|
132
|
+
var c = tryCatch(t[r], t, o);
|
|
133
|
+
if ("throw" !== c.type) {
|
|
134
|
+
var u = c.arg,
|
|
135
|
+
h = u.value;
|
|
136
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
137
|
+
invoke("next", t, i, a);
|
|
138
|
+
}, function (t) {
|
|
139
|
+
invoke("throw", t, i, a);
|
|
140
|
+
}) : e.resolve(h).then(function (t) {
|
|
141
|
+
u.value = t, i(u);
|
|
142
|
+
}, function (t) {
|
|
143
|
+
return invoke("throw", t, i, a);
|
|
138
144
|
});
|
|
139
145
|
}
|
|
140
|
-
|
|
146
|
+
a(c.arg);
|
|
141
147
|
}
|
|
142
|
-
var
|
|
143
|
-
|
|
144
|
-
value: function (
|
|
148
|
+
var r;
|
|
149
|
+
o(this, "_invoke", {
|
|
150
|
+
value: function (t, n) {
|
|
145
151
|
function callInvokeWithMethodAndArg() {
|
|
146
|
-
return new
|
|
147
|
-
invoke(
|
|
152
|
+
return new e(function (e, r) {
|
|
153
|
+
invoke(t, n, e, r);
|
|
148
154
|
});
|
|
149
155
|
}
|
|
150
|
-
return
|
|
156
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
151
157
|
}
|
|
152
158
|
});
|
|
153
159
|
}
|
|
154
|
-
function makeInvokeMethod(
|
|
155
|
-
var
|
|
156
|
-
return function (
|
|
157
|
-
if (
|
|
158
|
-
if (
|
|
159
|
-
if ("throw" ===
|
|
160
|
-
return
|
|
160
|
+
function makeInvokeMethod(e, r, n) {
|
|
161
|
+
var o = h;
|
|
162
|
+
return function (i, a) {
|
|
163
|
+
if (o === f) throw new Error("Generator is already running");
|
|
164
|
+
if (o === s) {
|
|
165
|
+
if ("throw" === i) throw a;
|
|
166
|
+
return {
|
|
167
|
+
value: t,
|
|
168
|
+
done: !0
|
|
169
|
+
};
|
|
161
170
|
}
|
|
162
|
-
for (
|
|
163
|
-
var
|
|
164
|
-
if (
|
|
165
|
-
var
|
|
166
|
-
if (
|
|
167
|
-
if (
|
|
168
|
-
return
|
|
171
|
+
for (n.method = i, n.arg = a;;) {
|
|
172
|
+
var c = n.delegate;
|
|
173
|
+
if (c) {
|
|
174
|
+
var u = maybeInvokeDelegate(c, n);
|
|
175
|
+
if (u) {
|
|
176
|
+
if (u === y) continue;
|
|
177
|
+
return u;
|
|
169
178
|
}
|
|
170
179
|
}
|
|
171
|
-
if ("next" ===
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
-
} else "return" ===
|
|
175
|
-
|
|
176
|
-
var
|
|
177
|
-
if ("normal" ===
|
|
178
|
-
if (
|
|
180
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
181
|
+
if (o === h) throw o = s, n.arg;
|
|
182
|
+
n.dispatchException(n.arg);
|
|
183
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
184
|
+
o = f;
|
|
185
|
+
var p = tryCatch(e, r, n);
|
|
186
|
+
if ("normal" === p.type) {
|
|
187
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
179
188
|
return {
|
|
180
|
-
value:
|
|
181
|
-
done:
|
|
189
|
+
value: p.arg,
|
|
190
|
+
done: n.done
|
|
182
191
|
};
|
|
183
192
|
}
|
|
184
|
-
"throw" ===
|
|
193
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
185
194
|
}
|
|
186
195
|
};
|
|
187
196
|
}
|
|
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:
|
|
197
|
+
function maybeInvokeDelegate(e, r) {
|
|
198
|
+
var n = r.method,
|
|
199
|
+
o = e.iterator[n];
|
|
200
|
+
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;
|
|
201
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
202
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
203
|
+
var a = i.arg;
|
|
204
|
+
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);
|
|
205
|
+
}
|
|
206
|
+
function pushTryEntry(t) {
|
|
207
|
+
var e = {
|
|
208
|
+
tryLoc: t[0]
|
|
200
209
|
};
|
|
201
|
-
1 in
|
|
210
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
202
211
|
}
|
|
203
|
-
function resetTryEntry(
|
|
204
|
-
var
|
|
205
|
-
|
|
212
|
+
function resetTryEntry(t) {
|
|
213
|
+
var e = t.completion || {};
|
|
214
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
206
215
|
}
|
|
207
|
-
function Context(
|
|
216
|
+
function Context(t) {
|
|
208
217
|
this.tryEntries = [{
|
|
209
218
|
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 =
|
|
219
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
220
|
+
}
|
|
221
|
+
function values(e) {
|
|
222
|
+
if (e || "" === e) {
|
|
223
|
+
var r = e[a];
|
|
224
|
+
if (r) return r.call(e);
|
|
225
|
+
if ("function" == typeof e.next) return e;
|
|
226
|
+
if (!isNaN(e.length)) {
|
|
227
|
+
var o = -1,
|
|
228
|
+
i = function next() {
|
|
229
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
230
|
+
return next.value = t, next.done = !0, next;
|
|
222
231
|
};
|
|
223
|
-
return
|
|
232
|
+
return i.next = i;
|
|
224
233
|
}
|
|
225
234
|
}
|
|
226
|
-
|
|
227
|
-
next: doneResult
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
function doneResult() {
|
|
231
|
-
return {
|
|
232
|
-
value: undefined,
|
|
233
|
-
done: !0
|
|
234
|
-
};
|
|
235
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
235
236
|
}
|
|
236
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype,
|
|
237
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
237
238
|
value: GeneratorFunctionPrototype,
|
|
238
239
|
configurable: !0
|
|
239
|
-
}),
|
|
240
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
240
241
|
value: GeneratorFunction,
|
|
241
242
|
configurable: !0
|
|
242
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype,
|
|
243
|
-
var
|
|
244
|
-
return !!
|
|
245
|
-
},
|
|
246
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(
|
|
247
|
-
},
|
|
243
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
244
|
+
var e = "function" == typeof t && t.constructor;
|
|
245
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
246
|
+
}, e.mark = function (t) {
|
|
247
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
248
|
+
}, e.awrap = function (t) {
|
|
248
249
|
return {
|
|
249
|
-
__await:
|
|
250
|
+
__await: t
|
|
250
251
|
};
|
|
251
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype,
|
|
252
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
252
253
|
return this;
|
|
253
|
-
}),
|
|
254
|
-
void 0 ===
|
|
255
|
-
var
|
|
256
|
-
return
|
|
257
|
-
return
|
|
254
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
255
|
+
void 0 === i && (i = Promise);
|
|
256
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
257
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
258
|
+
return t.done ? t.value : a.next();
|
|
258
259
|
});
|
|
259
|
-
}, defineIteratorMethods(
|
|
260
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
260
261
|
return this;
|
|
261
|
-
}), define(
|
|
262
|
+
}), define(g, "toString", function () {
|
|
262
263
|
return "[object Generator]";
|
|
263
|
-
}),
|
|
264
|
-
var
|
|
265
|
-
|
|
266
|
-
for (var
|
|
267
|
-
return
|
|
268
|
-
for (;
|
|
269
|
-
var
|
|
270
|
-
if (
|
|
264
|
+
}), e.keys = function (t) {
|
|
265
|
+
var e = Object(t),
|
|
266
|
+
r = [];
|
|
267
|
+
for (var n in e) r.push(n);
|
|
268
|
+
return r.reverse(), function next() {
|
|
269
|
+
for (; r.length;) {
|
|
270
|
+
var t = r.pop();
|
|
271
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
271
272
|
}
|
|
272
273
|
return next.done = !0, next;
|
|
273
274
|
};
|
|
274
|
-
},
|
|
275
|
+
}, e.values = values, Context.prototype = {
|
|
275
276
|
constructor: Context,
|
|
276
|
-
reset: function (
|
|
277
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent =
|
|
277
|
+
reset: function (e) {
|
|
278
|
+
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
279
|
},
|
|
279
280
|
stop: function () {
|
|
280
281
|
this.done = !0;
|
|
281
|
-
var
|
|
282
|
-
if ("throw" ===
|
|
282
|
+
var t = this.tryEntries[0].completion;
|
|
283
|
+
if ("throw" === t.type) throw t.arg;
|
|
283
284
|
return this.rval;
|
|
284
285
|
},
|
|
285
|
-
dispatchException: function (
|
|
286
|
-
if (this.done) throw
|
|
287
|
-
var
|
|
288
|
-
function handle(
|
|
289
|
-
return
|
|
286
|
+
dispatchException: function (e) {
|
|
287
|
+
if (this.done) throw e;
|
|
288
|
+
var r = this;
|
|
289
|
+
function handle(n, o) {
|
|
290
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
290
291
|
}
|
|
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 <
|
|
292
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
293
|
+
var i = this.tryEntries[o],
|
|
294
|
+
a = i.completion;
|
|
295
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
296
|
+
if (i.tryLoc <= this.prev) {
|
|
297
|
+
var c = n.call(i, "catchLoc"),
|
|
298
|
+
u = n.call(i, "finallyLoc");
|
|
299
|
+
if (c && u) {
|
|
300
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
301
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
302
|
+
} else if (c) {
|
|
303
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
303
304
|
} else {
|
|
304
|
-
if (!
|
|
305
|
-
if (this.prev <
|
|
305
|
+
if (!u) throw new Error("try statement without catch or finally");
|
|
306
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
306
307
|
}
|
|
307
308
|
}
|
|
308
309
|
}
|
|
309
310
|
},
|
|
310
|
-
abrupt: function (
|
|
311
|
-
for (var
|
|
312
|
-
var
|
|
313
|
-
if (
|
|
314
|
-
var
|
|
311
|
+
abrupt: function (t, e) {
|
|
312
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
313
|
+
var o = this.tryEntries[r];
|
|
314
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
315
|
+
var i = o;
|
|
315
316
|
break;
|
|
316
317
|
}
|
|
317
318
|
}
|
|
318
|
-
|
|
319
|
-
var
|
|
320
|
-
return
|
|
319
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
320
|
+
var a = i ? i.completion : {};
|
|
321
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
321
322
|
},
|
|
322
|
-
complete: function (
|
|
323
|
-
if ("throw" ===
|
|
324
|
-
return "break" ===
|
|
323
|
+
complete: function (t, e) {
|
|
324
|
+
if ("throw" === t.type) throw t.arg;
|
|
325
|
+
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
326
|
},
|
|
326
|
-
finish: function (
|
|
327
|
-
for (var
|
|
328
|
-
var
|
|
329
|
-
if (
|
|
327
|
+
finish: function (t) {
|
|
328
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
329
|
+
var r = this.tryEntries[e];
|
|
330
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
330
331
|
}
|
|
331
332
|
},
|
|
332
|
-
catch: function (
|
|
333
|
-
for (var
|
|
334
|
-
var
|
|
335
|
-
if (
|
|
336
|
-
var
|
|
337
|
-
if ("throw" ===
|
|
338
|
-
var
|
|
339
|
-
resetTryEntry(
|
|
333
|
+
catch: function (t) {
|
|
334
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
335
|
+
var r = this.tryEntries[e];
|
|
336
|
+
if (r.tryLoc === t) {
|
|
337
|
+
var n = r.completion;
|
|
338
|
+
if ("throw" === n.type) {
|
|
339
|
+
var o = n.arg;
|
|
340
|
+
resetTryEntry(r);
|
|
340
341
|
}
|
|
341
|
-
return
|
|
342
|
+
return o;
|
|
342
343
|
}
|
|
343
344
|
}
|
|
344
345
|
throw new Error("illegal catch attempt");
|
|
345
346
|
},
|
|
346
|
-
delegateYield: function (
|
|
347
|
+
delegateYield: function (e, r, n) {
|
|
347
348
|
return this.delegate = {
|
|
348
|
-
iterator: values(
|
|
349
|
-
resultName:
|
|
350
|
-
nextLoc:
|
|
351
|
-
}, "next" === this.method && (this.arg =
|
|
349
|
+
iterator: values(e),
|
|
350
|
+
resultName: r,
|
|
351
|
+
nextLoc: n
|
|
352
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
352
353
|
}
|
|
353
|
-
},
|
|
354
|
+
}, e;
|
|
354
355
|
}
|
|
355
356
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
356
357
|
try {
|
|
@@ -773,6 +774,7 @@ var MeasurementReport$1 = /*#__PURE__*/function () {
|
|
|
773
774
|
// Merge the derived dataset with the content from the Measurement Report
|
|
774
775
|
report.dataset = Object.assign(report.dataset, contentItem);
|
|
775
776
|
report.dataset._meta = _meta;
|
|
777
|
+
report.dataset.SpecificCharacterSet = "ISO_IR 192";
|
|
776
778
|
return report;
|
|
777
779
|
}
|
|
778
780
|
|
|
@@ -846,7 +848,7 @@ MeasurementReport$1.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE = {};
|
|
|
846
848
|
|
|
847
849
|
var CORNERSTONE_4_TAG = "cornerstoneTools@^4.0.0";
|
|
848
850
|
|
|
849
|
-
var TID300Length$
|
|
851
|
+
var TID300Length$2 = utilities.TID300.Length;
|
|
850
852
|
var LENGTH$1 = "Length";
|
|
851
853
|
var Length$1 = /*#__PURE__*/function () {
|
|
852
854
|
function Length() {
|
|
@@ -907,7 +909,7 @@ var Length$1 = /*#__PURE__*/function () {
|
|
|
907
909
|
}();
|
|
908
910
|
Length$1.toolType = LENGTH$1;
|
|
909
911
|
Length$1.utilityToolType = LENGTH$1;
|
|
910
|
-
Length$1.TID300Representation = TID300Length$
|
|
912
|
+
Length$1.TID300Representation = TID300Length$2;
|
|
911
913
|
Length$1.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
912
914
|
if (!TrackingIdentifier.includes(":")) {
|
|
913
915
|
return false;
|
|
@@ -2385,6 +2387,7 @@ function fillSegmentation$1(segmentation, inputLabelmaps3D) {
|
|
|
2385
2387
|
Value: ["1.2.840.10008.1.2.5"],
|
|
2386
2388
|
vr: "UI"
|
|
2387
2389
|
};
|
|
2390
|
+
segmentation.dataset.SpecificCharacterSet = "ISO_IR 192";
|
|
2388
2391
|
segmentation.dataset._vrMap.PixelData = "OB";
|
|
2389
2392
|
segmentation.dataset.PixelData = rleEncodedFrames;
|
|
2390
2393
|
} else {
|
|
@@ -2418,6 +2421,7 @@ function _createSegFromImages(images, isMultiframe, options) {
|
|
|
2418
2421
|
var dicomData = DicomMessage.readFile(arrayBuffer);
|
|
2419
2422
|
var dataset = DicomMetaDictionary$2.naturalizeDataset(dicomData.dict);
|
|
2420
2423
|
dataset._meta = DicomMetaDictionary$2.namifyDataset(dicomData.meta);
|
|
2424
|
+
dataset.SpecificCharacterSet = "ISO_IR 192";
|
|
2421
2425
|
datasets.push(dataset);
|
|
2422
2426
|
} else {
|
|
2423
2427
|
for (var i = 0; i < images.length; i++) {
|
|
@@ -2426,6 +2430,7 @@ function _createSegFromImages(images, isMultiframe, options) {
|
|
|
2426
2430
|
var _dicomData = DicomMessage.readFile(_arrayBuffer);
|
|
2427
2431
|
var _dataset = DicomMetaDictionary$2.naturalizeDataset(_dicomData.dict);
|
|
2428
2432
|
_dataset._meta = DicomMetaDictionary$2.namifyDataset(_dicomData.meta);
|
|
2433
|
+
_dataset.SpecificCharacterSet = "ISO_IR 192";
|
|
2429
2434
|
datasets.push(_dataset);
|
|
2430
2435
|
}
|
|
2431
2436
|
}
|
|
@@ -2603,7 +2608,7 @@ function generateToolState$2(_x, _x2, _x3, _x4) {
|
|
|
2603
2608
|
*/
|
|
2604
2609
|
function _generateToolState() {
|
|
2605
2610
|
_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;
|
|
2611
|
+
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
2612
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2608
2613
|
while (1) switch (_context.prev = _context.next) {
|
|
2609
2614
|
case 0:
|
|
@@ -2655,8 +2660,8 @@ function _generateToolState() {
|
|
|
2655
2660
|
// and over again.
|
|
2656
2661
|
sopUIDImageIdIndexMap = imageIds.reduce(function (acc, imageId) {
|
|
2657
2662
|
var _metadataProvider$get = metadataProvider.get("generalImageModule", imageId),
|
|
2658
|
-
|
|
2659
|
-
acc[
|
|
2663
|
+
sopInstanceUID = _metadataProvider$get.sopInstanceUID;
|
|
2664
|
+
acc[sopInstanceUID] = imageId;
|
|
2660
2665
|
return acc;
|
|
2661
2666
|
}, {});
|
|
2662
2667
|
overlapping = false;
|
|
@@ -2690,7 +2695,7 @@ function _generateToolState() {
|
|
|
2690
2695
|
labelmapBufferArray = [];
|
|
2691
2696
|
labelmapBufferArray[0] = new ArrayBuffer(arrayBufferLength);
|
|
2692
2697
|
|
|
2693
|
-
//
|
|
2698
|
+
// Pre-compute the indices and metadata so that we don't have to call
|
|
2694
2699
|
// a function for each imageId in the for loop.
|
|
2695
2700
|
imageIdMaps = imageIds.reduce(function (acc, curr, index) {
|
|
2696
2701
|
acc.indices[curr] = index;
|
|
@@ -2707,6 +2712,7 @@ function _generateToolState() {
|
|
|
2707
2712
|
_context.next = 47;
|
|
2708
2713
|
return insertFunction(segmentsOnFrame, segmentsOnFrameArray, labelmapBufferArray, pixelDataChunks, multiframe, imageIds, validOrientations, metadataProvider, tolerance, TypedArrayConstructor, segmentsPixelIndices, sopUIDImageIdIndexMap, imageIdMaps, eventTarget, triggerEvent);
|
|
2709
2714
|
case 47:
|
|
2715
|
+
overlappingSegments = _context.sent;
|
|
2710
2716
|
// calculate the centroid of each segment
|
|
2711
2717
|
centroidXYZ = new Map();
|
|
2712
2718
|
segmentsPixelIndices.forEach(function (imageIdIndexBufferIndex, segmentIndex) {
|
|
@@ -2726,9 +2732,10 @@ function _generateToolState() {
|
|
|
2726
2732
|
segMetadata: segMetadata,
|
|
2727
2733
|
segmentsOnFrame: segmentsOnFrame,
|
|
2728
2734
|
segmentsOnFrameArray: segmentsOnFrameArray,
|
|
2729
|
-
centroids: centroidXYZ
|
|
2735
|
+
centroids: centroidXYZ,
|
|
2736
|
+
overlappingSegments: overlappingSegments
|
|
2730
2737
|
});
|
|
2731
|
-
case
|
|
2738
|
+
case 51:
|
|
2732
2739
|
case "end":
|
|
2733
2740
|
return _context.stop();
|
|
2734
2741
|
}
|
|
@@ -2753,9 +2760,7 @@ function findReferenceSourceImageId(multiframe, frameSegment, imageIds, metadata
|
|
|
2753
2760
|
return imageId;
|
|
2754
2761
|
}
|
|
2755
2762
|
var frameSourceImageSequence = undefined;
|
|
2756
|
-
if (
|
|
2757
|
-
frameSourceImageSequence = SourceImageSequence[frameSegment];
|
|
2758
|
-
} else if (PerFrameFunctionalGroup.DerivationImageSequence) {
|
|
2763
|
+
if (PerFrameFunctionalGroup.DerivationImageSequence) {
|
|
2759
2764
|
var DerivationImageSequence = PerFrameFunctionalGroup.DerivationImageSequence;
|
|
2760
2765
|
if (Array.isArray(DerivationImageSequence)) {
|
|
2761
2766
|
if (DerivationImageSequence.length !== 0) {
|
|
@@ -2774,6 +2779,9 @@ function findReferenceSourceImageId(multiframe, frameSegment, imageIds, metadata
|
|
|
2774
2779
|
}
|
|
2775
2780
|
}
|
|
2776
2781
|
}
|
|
2782
|
+
} else if (SourceImageSequence && SourceImageSequence.length !== 0) {
|
|
2783
|
+
console.warn("DerivationImageSequence not present, using SourceImageSequence assuming SEG has the same geometry as the source image.");
|
|
2784
|
+
frameSourceImageSequence = SourceImageSequence[frameSegment];
|
|
2777
2785
|
}
|
|
2778
2786
|
if (frameSourceImageSequence) {
|
|
2779
2787
|
imageId = getImageIdOfSourceImageBySourceImageSequence(frameSourceImageSequence, sopUIDImageIdIndexMap);
|
|
@@ -2813,32 +2821,33 @@ function checkSEGsOverlapping(pixelData, multiframe, imageIds, validOrientations
|
|
|
2813
2821
|
|
|
2814
2822
|
var frameSegmentsMapping = new Map();
|
|
2815
2823
|
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);
|
|
2824
|
+
var segmentIndex = getSegmentIndex(multiframe, frameSegment);
|
|
2825
|
+
if (segmentIndex === undefined) {
|
|
2826
|
+
console.warn("Could not retrieve the segment index for frame segment " + frameSegment + ", skipping this frame.");
|
|
2827
|
+
return 0; // continue
|
|
2834
2828
|
}
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2829
|
+
var imageId = findReferenceSourceImageId(multiframe, frameSegment, imageIds, metadataProvider, tolerance, sopUIDImageIdIndexMap);
|
|
2830
|
+
if (!imageId) {
|
|
2831
|
+
console.warn("Image not present in stack, can't import frame : " + frameSegment + ".");
|
|
2832
|
+
return 0; // continue
|
|
2833
|
+
}
|
|
2834
|
+
var imageIdIndex = imageIds.findIndex(function (element) {
|
|
2835
|
+
return element === imageId;
|
|
2836
|
+
});
|
|
2837
|
+
if (frameSegmentsMapping.has(imageIdIndex)) {
|
|
2838
|
+
var segmentArray = frameSegmentsMapping.get(imageIdIndex);
|
|
2839
|
+
if (!segmentArray.includes(frameSegment)) {
|
|
2840
|
+
segmentArray.push(frameSegment);
|
|
2841
|
+
frameSegmentsMapping.set(imageIdIndex, segmentArray);
|
|
2842
|
+
}
|
|
2843
|
+
} else {
|
|
2844
|
+
frameSegmentsMapping.set(imageIdIndex, [frameSegment]);
|
|
2845
|
+
}
|
|
2846
|
+
},
|
|
2847
|
+
_ret;
|
|
2839
2848
|
for (var frameSegment = 0; frameSegment < groupsLen; ++frameSegment) {
|
|
2840
|
-
|
|
2841
|
-
if (_ret ===
|
|
2849
|
+
_ret = _loop3();
|
|
2850
|
+
if (_ret === 0) continue;
|
|
2842
2851
|
}
|
|
2843
2852
|
var _iterator = _createForOfIteratorHelper(frameSegmentsMapping.entries()),
|
|
2844
2853
|
_step;
|
|
@@ -2906,77 +2915,78 @@ function insertOverlappingPixelDataPlanar(segmentsOnFrame, segmentsOnFrameArray,
|
|
|
2906
2915
|
var numberOfSegs = multiframe.SegmentSequence.length;
|
|
2907
2916
|
for (var segmentIndexToProcess = 1; segmentIndexToProcess <= numberOfSegs; ++segmentIndexToProcess) {
|
|
2908
2917
|
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
|
-
|
|
2918
|
+
var PerFrameFunctionalGroups = PerFrameFunctionalGroupsSequence[_i2];
|
|
2919
|
+
var segmentIndex = getSegmentIndex(multiframe, _i2);
|
|
2920
|
+
if (segmentIndex === undefined) {
|
|
2921
|
+
throw new Error("Could not retrieve the segment index. Aborting segmentation loading.");
|
|
2922
|
+
}
|
|
2923
|
+
if (segmentIndex !== segmentIndexToProcess) {
|
|
2924
|
+
i = _i2;
|
|
2925
|
+
return 0; // continue
|
|
2926
|
+
}
|
|
2927
|
+
var ImageOrientationPatientI = sharedImageOrientationPatient || PerFrameFunctionalGroups.PlaneOrientationSequence.ImageOrientationPatient;
|
|
2928
|
+
|
|
2929
|
+
// Since we moved to the chunks approach, we need to read the data
|
|
2930
|
+
// and handle scenarios where the portion of data is in one chunk
|
|
2931
|
+
// and the other portion is in another chunk
|
|
2932
|
+
var view = readFromUnpackedChunks(pixelData, _i2 * sliceLength, sliceLength);
|
|
2933
|
+
var pixelDataI2D = ndarray(view, [Rows, Columns]);
|
|
2934
|
+
var alignedPixelDataI = alignPixelDataWithSourceData(pixelDataI2D, ImageOrientationPatientI, validOrientations, tolerance);
|
|
2935
|
+
if (!alignedPixelDataI) {
|
|
2936
|
+
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.");
|
|
2937
|
+
}
|
|
2938
|
+
var imageId = findReferenceSourceImageId(multiframe, _i2, imageIds, metadataProvider, tolerance, sopUIDImageIdIndexMap);
|
|
2939
|
+
if (!imageId) {
|
|
2940
|
+
console.warn("Image not present in stack, can't import frame : " + _i2 + ".");
|
|
2941
|
+
i = _i2;
|
|
2942
|
+
return 0; // continue
|
|
2943
|
+
}
|
|
2944
|
+
var sourceImageMetadata = metadataProvider.get("instance", imageId);
|
|
2945
|
+
if (Rows !== sourceImageMetadata.Rows || Columns !== sourceImageMetadata.Columns) {
|
|
2946
|
+
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. ");
|
|
2947
|
+
}
|
|
2948
|
+
var imageIdIndex = imageIds.findIndex(function (element) {
|
|
2949
|
+
return element === imageId;
|
|
2950
|
+
});
|
|
2951
|
+
var byteOffset = sliceLength * imageIdIndex * TypedArrayConstructor.BYTES_PER_ELEMENT;
|
|
2952
|
+
var labelmap2DView = new TypedArrayConstructor(tempBuffer, byteOffset, sliceLength);
|
|
2953
|
+
var data = alignedPixelDataI.data;
|
|
2954
|
+
var segmentOnFrame = false;
|
|
2955
|
+
for (var j = 0, len = alignedPixelDataI.data.length; j < len; ++j) {
|
|
2956
|
+
if (data[j]) {
|
|
2957
|
+
if (labelmap2DView[j] !== 0) {
|
|
2958
|
+
m++;
|
|
2959
|
+
if (m >= M) {
|
|
2960
|
+
labelmapBufferArray[m] = new ArrayBuffer(arrayBufferLength);
|
|
2961
|
+
segmentsOnFrameArray[m] = [];
|
|
2962
|
+
M++;
|
|
2963
|
+
}
|
|
2964
|
+
tempBuffer = labelmapBufferArray[m].slice(0);
|
|
2965
|
+
tempSegmentsOnFrame = structuredClone(segmentsOnFrameArray[m]);
|
|
2966
|
+
_i2 = 0;
|
|
2967
|
+
break;
|
|
2968
|
+
} else {
|
|
2969
|
+
labelmap2DView[j] = segmentIndex;
|
|
2970
|
+
segmentOnFrame = true;
|
|
2954
2971
|
}
|
|
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
2972
|
}
|
|
2963
2973
|
}
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2974
|
+
if (segmentOnFrame) {
|
|
2975
|
+
if (!tempSegmentsOnFrame[imageIdIndex]) {
|
|
2976
|
+
tempSegmentsOnFrame[imageIdIndex] = [];
|
|
2977
|
+
}
|
|
2978
|
+
tempSegmentsOnFrame[imageIdIndex].push(segmentIndex);
|
|
2979
|
+
if (!segmentsOnFrame[imageIdIndex]) {
|
|
2980
|
+
segmentsOnFrame[imageIdIndex] = [];
|
|
2981
|
+
}
|
|
2982
|
+
segmentsOnFrame[imageIdIndex].push(segmentIndex);
|
|
2972
2983
|
}
|
|
2973
|
-
|
|
2974
|
-
}
|
|
2975
|
-
|
|
2976
|
-
};
|
|
2984
|
+
i = _i2;
|
|
2985
|
+
},
|
|
2986
|
+
_ret2;
|
|
2977
2987
|
for (var i = 0, groupsLen = PerFrameFunctionalGroupsSequence.length; i < groupsLen; ++i) {
|
|
2978
|
-
|
|
2979
|
-
if (_ret2 ===
|
|
2988
|
+
_ret2 = _loop4(i);
|
|
2989
|
+
if (_ret2 === 0) continue;
|
|
2980
2990
|
}
|
|
2981
2991
|
labelmapBufferArray[m] = tempBuffer.slice(0);
|
|
2982
2992
|
segmentsOnFrameArray[m] = structuredClone(tempSegmentsOnFrame);
|
|
@@ -3005,7 +3015,7 @@ function insertPixelDataPlanar(segmentsOnFrame, segmentsOnFrameArray, labelmapBu
|
|
|
3005
3015
|
var chunkSize = Math.ceil(groupsLen / 10); // 10% of total length
|
|
3006
3016
|
|
|
3007
3017
|
var shouldTriggerEvent = triggerEvent && eventTarget;
|
|
3008
|
-
|
|
3018
|
+
var overlapping = false;
|
|
3009
3019
|
// Below, we chunk the processing of the frames to avoid blocking the main thread
|
|
3010
3020
|
// if the segmentation is large. We also use a promise to allow the caller to
|
|
3011
3021
|
// wait for the processing to finish.
|
|
@@ -3046,6 +3056,9 @@ function insertPixelDataPlanar(segmentsOnFrame, segmentsOnFrameArray, labelmapBu
|
|
|
3046
3056
|
if (data[j]) {
|
|
3047
3057
|
for (var x = j; x < len; ++x) {
|
|
3048
3058
|
if (data[x]) {
|
|
3059
|
+
if (!overlapping && labelmap2DView[x] !== 0) {
|
|
3060
|
+
overlapping = true;
|
|
3061
|
+
}
|
|
3049
3062
|
labelmap2DView[x] = segmentIndex;
|
|
3050
3063
|
indexCache.push(x);
|
|
3051
3064
|
}
|
|
@@ -3075,7 +3088,7 @@ function insertPixelDataPlanar(segmentsOnFrame, segmentsOnFrameArray, labelmapBu
|
|
|
3075
3088
|
setTimeout(processInChunks, 0);
|
|
3076
3089
|
} else {
|
|
3077
3090
|
// resolve the Promise when all chunks have been processed
|
|
3078
|
-
resolve();
|
|
3091
|
+
resolve(overlapping);
|
|
3079
3092
|
}
|
|
3080
3093
|
}
|
|
3081
3094
|
processInChunks();
|
|
@@ -3546,6 +3559,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
3546
3559
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
3547
3560
|
PERFORMANCE OF THIS SOFTWARE.
|
|
3548
3561
|
***************************************************************************** */
|
|
3562
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
3563
|
+
|
|
3549
3564
|
var __assign = function () {
|
|
3550
3565
|
__assign = Object.assign || function __assign(t) {
|
|
3551
3566
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -3565,6 +3580,10 @@ function __spreadArray(to, from, pack) {
|
|
|
3565
3580
|
}
|
|
3566
3581
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
3567
3582
|
}
|
|
3583
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
3584
|
+
var e = new Error(message);
|
|
3585
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
3586
|
+
};
|
|
3568
3587
|
|
|
3569
3588
|
var CORNERSTONE_3D_TAG = "Cornerstone3DTools@^0.1.0";
|
|
3570
3589
|
|
|
@@ -3773,6 +3792,7 @@ var MeasurementReport = /** @class */ (function () {
|
|
|
3773
3792
|
// Merge the derived dataset with the content from the Measurement Report
|
|
3774
3793
|
report.dataset = Object.assign(report.dataset, contentItem);
|
|
3775
3794
|
report.dataset._meta = _meta;
|
|
3795
|
+
report.SpecificCharacterSet = "ISO_IR 192";
|
|
3776
3796
|
return report;
|
|
3777
3797
|
};
|
|
3778
3798
|
/**
|
|
@@ -3786,6 +3806,7 @@ var MeasurementReport = /** @class */ (function () {
|
|
|
3786
3806
|
var REPORT = "Imaging Measurements";
|
|
3787
3807
|
var GROUP = "Measurement Group";
|
|
3788
3808
|
var TRACKING_IDENTIFIER = "Tracking Identifier";
|
|
3809
|
+
var TRACKING_UNIQUE_IDENTIFIER = "Tracking Unique Identifier";
|
|
3789
3810
|
// Identify the Imaging Measurements
|
|
3790
3811
|
var imagingMeasurementContent = toArray(dataset.ContentSequence).find(codeMeaningEquals(REPORT));
|
|
3791
3812
|
// Retrieve the Measurements themselves
|
|
@@ -3807,12 +3828,19 @@ var MeasurementReport = /** @class */ (function () {
|
|
|
3807
3828
|
TRACKING_IDENTIFIER;
|
|
3808
3829
|
});
|
|
3809
3830
|
var TrackingIdentifierValue_1 = TrackingIdentifierGroup.TextValue;
|
|
3831
|
+
var TrackingUniqueIdentifierGroup = measurementGroupContentSequence.find(function (contentItem) {
|
|
3832
|
+
return contentItem.ConceptNameCodeSequence.CodeMeaning ===
|
|
3833
|
+
TRACKING_UNIQUE_IDENTIFIER;
|
|
3834
|
+
});
|
|
3835
|
+
var TrackingUniqueIdentifierValue = TrackingUniqueIdentifierGroup === null || TrackingUniqueIdentifierGroup === void 0 ? void 0 : TrackingUniqueIdentifierGroup.UID;
|
|
3810
3836
|
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
3837
|
registeredToolClasses.find(function (tc) {
|
|
3812
3838
|
return tc.isValidCornerstoneTrackingIdentifier(TrackingIdentifierValue_1);
|
|
3813
3839
|
});
|
|
3814
3840
|
if (toolClass) {
|
|
3815
3841
|
var measurement = toolClass.getMeasurementData(measurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata);
|
|
3842
|
+
measurement.TrackingUniqueIdentifier =
|
|
3843
|
+
TrackingUniqueIdentifierValue;
|
|
3816
3844
|
console.log("=== ".concat(toolClass.toolType, " ==="));
|
|
3817
3845
|
console.log(measurement);
|
|
3818
3846
|
measurementData[toolClass.toolType].push(measurement);
|
|
@@ -3853,7 +3881,7 @@ var MeasurementReport = /** @class */ (function () {
|
|
|
3853
3881
|
|
|
3854
3882
|
var TID300Point$1 = utilities.TID300.Point;
|
|
3855
3883
|
var ARROW_ANNOTATE = "ArrowAnnotate";
|
|
3856
|
-
var trackingIdentifierTextValue$
|
|
3884
|
+
var trackingIdentifierTextValue$8 = "".concat(CORNERSTONE_3D_TAG, ":").concat(ARROW_ANNOTATE);
|
|
3857
3885
|
var codeValues = CodingScheme.codeValues,
|
|
3858
3886
|
CodingSchemeDesignator = CodingScheme.CodingSchemeDesignator;
|
|
3859
3887
|
var ArrowAnnotate = /*#__PURE__*/function () {
|
|
@@ -3932,7 +3960,7 @@ var ArrowAnnotate = /*#__PURE__*/function () {
|
|
|
3932
3960
|
x: pointImage[0],
|
|
3933
3961
|
y: pointImage[1]
|
|
3934
3962
|
}],
|
|
3935
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue$
|
|
3963
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$8,
|
|
3936
3964
|
findingSites: findingSites || []
|
|
3937
3965
|
};
|
|
3938
3966
|
|
|
@@ -3972,7 +4000,7 @@ var TID300Bidirectional = utilities.TID300.Bidirectional;
|
|
|
3972
4000
|
var BIDIRECTIONAL = "Bidirectional";
|
|
3973
4001
|
var LONG_AXIS = "Long Axis";
|
|
3974
4002
|
var SHORT_AXIS = "Short Axis";
|
|
3975
|
-
var trackingIdentifierTextValue$
|
|
4003
|
+
var trackingIdentifierTextValue$7 = "".concat(CORNERSTONE_3D_TAG, ":").concat(BIDIRECTIONAL);
|
|
3976
4004
|
var Bidirectional = /** @class */ (function () {
|
|
3977
4005
|
function Bidirectional() {
|
|
3978
4006
|
}
|
|
@@ -4075,7 +4103,7 @@ var Bidirectional = /** @class */ (function () {
|
|
|
4075
4103
|
},
|
|
4076
4104
|
longAxisLength: length,
|
|
4077
4105
|
shortAxisLength: width,
|
|
4078
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue$
|
|
4106
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$7,
|
|
4079
4107
|
finding: finding,
|
|
4080
4108
|
findingSites: findingSites || []
|
|
4081
4109
|
};
|
|
@@ -4099,7 +4127,7 @@ MeasurementReport.registerTool(Bidirectional);
|
|
|
4099
4127
|
|
|
4100
4128
|
var TID300CobbAngle$1 = utilities.TID300.CobbAngle;
|
|
4101
4129
|
var MEASUREMENT_TYPE$1 = "Angle";
|
|
4102
|
-
var trackingIdentifierTextValue$
|
|
4130
|
+
var trackingIdentifierTextValue$6 = "".concat(CORNERSTONE_3D_TAG, ":").concat(MEASUREMENT_TYPE$1);
|
|
4103
4131
|
var Angle = /** @class */ (function () {
|
|
4104
4132
|
function Angle() {
|
|
4105
4133
|
}
|
|
@@ -4159,7 +4187,7 @@ var Angle = /** @class */ (function () {
|
|
|
4159
4187
|
point3: point3,
|
|
4160
4188
|
point4: point4,
|
|
4161
4189
|
rAngle: angle,
|
|
4162
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue$
|
|
4190
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$6,
|
|
4163
4191
|
finding: finding,
|
|
4164
4192
|
findingSites: findingSites || []
|
|
4165
4193
|
};
|
|
@@ -4183,7 +4211,7 @@ MeasurementReport.registerTool(Angle);
|
|
|
4183
4211
|
|
|
4184
4212
|
var TID300CobbAngle = utilities.TID300.CobbAngle;
|
|
4185
4213
|
var MEASUREMENT_TYPE = "CobbAngle";
|
|
4186
|
-
var trackingIdentifierTextValue$
|
|
4214
|
+
var trackingIdentifierTextValue$5 = "".concat(CORNERSTONE_3D_TAG, ":").concat(MEASUREMENT_TYPE);
|
|
4187
4215
|
var CobbAngle = /** @class */ (function () {
|
|
4188
4216
|
function CobbAngle() {
|
|
4189
4217
|
}
|
|
@@ -4248,7 +4276,7 @@ var CobbAngle = /** @class */ (function () {
|
|
|
4248
4276
|
point3: point3,
|
|
4249
4277
|
point4: point4,
|
|
4250
4278
|
rAngle: angle,
|
|
4251
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue$
|
|
4279
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$5,
|
|
4252
4280
|
finding: finding,
|
|
4253
4281
|
findingSites: findingSites || []
|
|
4254
4282
|
};
|
|
@@ -4512,7 +4540,7 @@ MeasurementReport.registerTool(EllipticalROI);
|
|
|
4512
4540
|
|
|
4513
4541
|
var TID300Polyline$1 = utilities.TID300.Polyline;
|
|
4514
4542
|
var TOOLTYPE = "RectangleROI";
|
|
4515
|
-
var trackingIdentifierTextValue$
|
|
4543
|
+
var trackingIdentifierTextValue$4 = "".concat(CORNERSTONE_3D_TAG, ":").concat(TOOLTYPE);
|
|
4516
4544
|
var RectangleROI = /** @class */ (function () {
|
|
4517
4545
|
function RectangleROI() {
|
|
4518
4546
|
}
|
|
@@ -4575,7 +4603,7 @@ var RectangleROI = /** @class */ (function () {
|
|
|
4575
4603
|
],
|
|
4576
4604
|
area: area,
|
|
4577
4605
|
perimeter: perimeter,
|
|
4578
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue$
|
|
4606
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$4,
|
|
4579
4607
|
finding: finding,
|
|
4580
4608
|
findingSites: findingSites || []
|
|
4581
4609
|
};
|
|
@@ -4597,9 +4625,9 @@ var RectangleROI = /** @class */ (function () {
|
|
|
4597
4625
|
}());
|
|
4598
4626
|
MeasurementReport.registerTool(RectangleROI);
|
|
4599
4627
|
|
|
4600
|
-
var TID300Length = utilities.TID300.Length;
|
|
4628
|
+
var TID300Length$1 = utilities.TID300.Length;
|
|
4601
4629
|
var LENGTH = "Length";
|
|
4602
|
-
var trackingIdentifierTextValue$
|
|
4630
|
+
var trackingIdentifierTextValue$3 = "".concat(CORNERSTONE_3D_TAG, ":").concat(LENGTH);
|
|
4603
4631
|
var Length = /*#__PURE__*/function () {
|
|
4604
4632
|
function Length() {
|
|
4605
4633
|
_classCallCheck(this, Length);
|
|
@@ -4667,7 +4695,7 @@ var Length = /*#__PURE__*/function () {
|
|
|
4667
4695
|
point1: point1,
|
|
4668
4696
|
point2: point2,
|
|
4669
4697
|
distance: distance,
|
|
4670
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue$
|
|
4698
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$3,
|
|
4671
4699
|
finding: finding,
|
|
4672
4700
|
findingSites: findingSites || []
|
|
4673
4701
|
};
|
|
@@ -4677,7 +4705,7 @@ var Length = /*#__PURE__*/function () {
|
|
|
4677
4705
|
}();
|
|
4678
4706
|
Length.toolType = LENGTH;
|
|
4679
4707
|
Length.utilityToolType = LENGTH;
|
|
4680
|
-
Length.TID300Representation = TID300Length;
|
|
4708
|
+
Length.TID300Representation = TID300Length$1;
|
|
4681
4709
|
Length.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
4682
4710
|
if (!TrackingIdentifier.includes(":")) {
|
|
4683
4711
|
return false;
|
|
@@ -4695,13 +4723,14 @@ MeasurementReport.registerTool(Length);
|
|
|
4695
4723
|
|
|
4696
4724
|
var TID300Polyline = utilities.TID300.Polyline;
|
|
4697
4725
|
var PLANARFREEHANDROI = "PlanarFreehandROI";
|
|
4698
|
-
var trackingIdentifierTextValue$
|
|
4726
|
+
var trackingIdentifierTextValue$2 = "".concat(CORNERSTONE_3D_TAG, ":").concat(PLANARFREEHANDROI);
|
|
4699
4727
|
var closedContourThreshold = 1e-5;
|
|
4700
4728
|
var PlanarFreehandROI = /** @class */ (function () {
|
|
4701
4729
|
function PlanarFreehandROI() {
|
|
4702
4730
|
}
|
|
4703
4731
|
PlanarFreehandROI.getMeasurementData = function (MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
4704
|
-
var _a
|
|
4732
|
+
var _a;
|
|
4733
|
+
var _b = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, PlanarFreehandROI.toolType), defaultState = _b.defaultState, NUMGroup = _b.NUMGroup, SCOORDGroup = _b.SCOORDGroup, ReferencedFrameNumber = _b.ReferencedFrameNumber;
|
|
4705
4734
|
var referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
4706
4735
|
var GraphicData = SCOORDGroup.GraphicData;
|
|
4707
4736
|
var worldCoords = [];
|
|
@@ -4725,8 +4754,7 @@ var PlanarFreehandROI = /** @class */ (function () {
|
|
|
4725
4754
|
}
|
|
4726
4755
|
var state = defaultState;
|
|
4727
4756
|
state.annotation.data = {
|
|
4728
|
-
polyline: worldCoords,
|
|
4729
|
-
isOpenContour: isOpenContour,
|
|
4757
|
+
contour: { polyline: worldCoords, closed: !isOpenContour },
|
|
4730
4758
|
handles: {
|
|
4731
4759
|
points: points,
|
|
4732
4760
|
activeHandleIndex: null,
|
|
@@ -4734,13 +4762,21 @@ var PlanarFreehandROI = /** @class */ (function () {
|
|
|
4734
4762
|
hasMoved: false
|
|
4735
4763
|
}
|
|
4736
4764
|
},
|
|
4765
|
+
cachedStats: (_a = {},
|
|
4766
|
+
_a["imageId:".concat(referencedImageId)] = {
|
|
4767
|
+
area: NUMGroup
|
|
4768
|
+
? NUMGroup.MeasuredValueSequence.NumericValue
|
|
4769
|
+
: null
|
|
4770
|
+
},
|
|
4771
|
+
_a),
|
|
4737
4772
|
frameNumber: ReferencedFrameNumber
|
|
4738
4773
|
};
|
|
4739
4774
|
return state;
|
|
4740
4775
|
};
|
|
4741
4776
|
PlanarFreehandROI.getTID300RepresentationArguments = function (tool, worldToImageCoords) {
|
|
4742
4777
|
var data = tool.data, finding = tool.finding, findingSites = tool.findingSites, metadata = tool.metadata;
|
|
4743
|
-
var
|
|
4778
|
+
var _a = data.contour, polyline = _a.polyline, closed = _a.closed;
|
|
4779
|
+
var isOpenContour = closed !== true;
|
|
4744
4780
|
var referencedImageId = metadata.referencedImageId;
|
|
4745
4781
|
if (!referencedImageId) {
|
|
4746
4782
|
throw new Error("PlanarFreehandROI.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
@@ -4754,13 +4790,19 @@ var PlanarFreehandROI = /** @class */ (function () {
|
|
|
4754
4790
|
// Explicitly expand to avoid ciruclar references.
|
|
4755
4791
|
points.push([firstPoint[0], firstPoint[1]]);
|
|
4756
4792
|
}
|
|
4757
|
-
var area =
|
|
4758
|
-
var perimeter = 0;
|
|
4793
|
+
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
4794
|
return {
|
|
4795
|
+
/** From cachedStats */
|
|
4760
4796
|
points: points,
|
|
4761
4797
|
area: area,
|
|
4798
|
+
areaUnit: areaUnit,
|
|
4762
4799
|
perimeter: perimeter,
|
|
4763
|
-
|
|
4800
|
+
modalityUnit: modalityUnit,
|
|
4801
|
+
mean: mean,
|
|
4802
|
+
max: max,
|
|
4803
|
+
stdDev: stdDev,
|
|
4804
|
+
/** Other */
|
|
4805
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$2,
|
|
4764
4806
|
finding: finding,
|
|
4765
4807
|
findingSites: findingSites || []
|
|
4766
4808
|
};
|
|
@@ -4784,7 +4826,7 @@ MeasurementReport.registerTool(PlanarFreehandROI);
|
|
|
4784
4826
|
|
|
4785
4827
|
var TID300Point = utilities.TID300.Point;
|
|
4786
4828
|
var PROBE = "Probe";
|
|
4787
|
-
var trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(PROBE);
|
|
4829
|
+
var trackingIdentifierTextValue$1 = "".concat(CORNERSTONE_3D_TAG, ":").concat(PROBE);
|
|
4788
4830
|
var Probe = /*#__PURE__*/function () {
|
|
4789
4831
|
function Probe() {
|
|
4790
4832
|
_classCallCheck(this, Probe);
|
|
@@ -4837,7 +4879,7 @@ var Probe = /*#__PURE__*/function () {
|
|
|
4837
4879
|
});
|
|
4838
4880
|
var TID300RepresentationArguments = {
|
|
4839
4881
|
points: pointsImage,
|
|
4840
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue,
|
|
4882
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$1,
|
|
4841
4883
|
findingSites: findingSites || [],
|
|
4842
4884
|
finding: finding
|
|
4843
4885
|
};
|
|
@@ -4864,6 +4906,75 @@ Probe.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
|
4864
4906
|
};
|
|
4865
4907
|
MeasurementReport.registerTool(Probe);
|
|
4866
4908
|
|
|
4909
|
+
var TID300Length = utilities.TID300.Length;
|
|
4910
|
+
var ULTRASOUND_DIRECTIONAL = "UltrasoundDirectionalTool";
|
|
4911
|
+
var trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(ULTRASOUND_DIRECTIONAL);
|
|
4912
|
+
var UltrasoundDirectional = /** @class */ (function () {
|
|
4913
|
+
function UltrasoundDirectional() {
|
|
4914
|
+
}
|
|
4915
|
+
// TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport.
|
|
4916
|
+
UltrasoundDirectional.getMeasurementData = function (MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
4917
|
+
var _a = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, UltrasoundDirectional.toolType), defaultState = _a.defaultState, SCOORDGroup = _a.SCOORDGroup, ReferencedFrameNumber = _a.ReferencedFrameNumber;
|
|
4918
|
+
var referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
4919
|
+
var GraphicData = SCOORDGroup.GraphicData;
|
|
4920
|
+
var worldCoords = [];
|
|
4921
|
+
for (var i = 0; i < GraphicData.length; i += 2) {
|
|
4922
|
+
var point = imageToWorldCoords(referencedImageId, [
|
|
4923
|
+
GraphicData[i],
|
|
4924
|
+
GraphicData[i + 1]
|
|
4925
|
+
]);
|
|
4926
|
+
worldCoords.push(point);
|
|
4927
|
+
}
|
|
4928
|
+
var state = defaultState;
|
|
4929
|
+
state.annotation.data = {
|
|
4930
|
+
handles: {
|
|
4931
|
+
points: [worldCoords[0], worldCoords[1]],
|
|
4932
|
+
activeHandleIndex: 0,
|
|
4933
|
+
textBox: {
|
|
4934
|
+
hasMoved: false
|
|
4935
|
+
}
|
|
4936
|
+
},
|
|
4937
|
+
cachedStats: {},
|
|
4938
|
+
frameNumber: ReferencedFrameNumber
|
|
4939
|
+
};
|
|
4940
|
+
return state;
|
|
4941
|
+
};
|
|
4942
|
+
UltrasoundDirectional.getTID300RepresentationArguments = function (tool, worldToImageCoords) {
|
|
4943
|
+
var data = tool.data, finding = tool.finding, findingSites = tool.findingSites, metadata = tool.metadata;
|
|
4944
|
+
var handles = data.handles;
|
|
4945
|
+
var referencedImageId = metadata.referencedImageId;
|
|
4946
|
+
if (!referencedImageId) {
|
|
4947
|
+
throw new Error("UltrasoundDirectionalTool.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
4948
|
+
}
|
|
4949
|
+
var start = worldToImageCoords(referencedImageId, handles.points[0]);
|
|
4950
|
+
var end = worldToImageCoords(referencedImageId, handles.points[1]);
|
|
4951
|
+
var point1 = { x: start[0], y: start[1] };
|
|
4952
|
+
var point2 = { x: end[0], y: end[1] };
|
|
4953
|
+
return {
|
|
4954
|
+
point1: point1,
|
|
4955
|
+
point2: point2,
|
|
4956
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue,
|
|
4957
|
+
finding: finding,
|
|
4958
|
+
findingSites: findingSites || []
|
|
4959
|
+
};
|
|
4960
|
+
};
|
|
4961
|
+
UltrasoundDirectional.toolType = ULTRASOUND_DIRECTIONAL;
|
|
4962
|
+
UltrasoundDirectional.utilityToolType = ULTRASOUND_DIRECTIONAL;
|
|
4963
|
+
UltrasoundDirectional.TID300Representation = TID300Length;
|
|
4964
|
+
UltrasoundDirectional.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
4965
|
+
if (!TrackingIdentifier.includes(":")) {
|
|
4966
|
+
return false;
|
|
4967
|
+
}
|
|
4968
|
+
var _a = TrackingIdentifier.split(":"), cornerstone3DTag = _a[0], toolType = _a[1];
|
|
4969
|
+
if (cornerstone3DTag !== CORNERSTONE_3D_TAG) {
|
|
4970
|
+
return false;
|
|
4971
|
+
}
|
|
4972
|
+
return toolType === ULTRASOUND_DIRECTIONAL;
|
|
4973
|
+
};
|
|
4974
|
+
return UltrasoundDirectional;
|
|
4975
|
+
}());
|
|
4976
|
+
MeasurementReport.registerTool(UltrasoundDirectional);
|
|
4977
|
+
|
|
4867
4978
|
var Normalizer = normalizers.Normalizer;
|
|
4868
4979
|
var SegmentationDerivation = derivations.Segmentation;
|
|
4869
4980
|
/**
|
|
@@ -4973,415 +5084,6 @@ var Segmentation$1 = /*#__PURE__*/Object.freeze({
|
|
|
4973
5084
|
generateToolState: generateToolState
|
|
4974
5085
|
});
|
|
4975
5086
|
|
|
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
5087
|
function getPatientModule(imageId, metadataProvider) {
|
|
5386
5088
|
var generalSeriesModule = metadataProvider.get("generalSeriesModule", imageId);
|
|
5387
5089
|
var generalStudyModule = metadataProvider.get("generalStudyModule", imageId);
|
|
@@ -5476,6 +5178,7 @@ function getStructureSetModule(contour, index) {
|
|
|
5476
5178
|
};
|
|
5477
5179
|
}
|
|
5478
5180
|
|
|
5181
|
+
var _a = utilities$1.contours, generateContourSetsFromLabelmap$1 = _a.generateContourSetsFromLabelmap, AnnotationToPointData = _a.AnnotationToPointData;
|
|
5479
5182
|
var DicomMetaDictionary = dcmjs.data.DicomMetaDictionary;
|
|
5480
5183
|
/**
|
|
5481
5184
|
* Convert handles to RTSS report containing the dcmjs dicom dataset.
|
|
@@ -5490,14 +5193,11 @@ var DicomMetaDictionary = dcmjs.data.DicomMetaDictionary;
|
|
|
5490
5193
|
* @param csTools - cornerstone tool instance
|
|
5491
5194
|
* @returns Report object containing the dataset
|
|
5492
5195
|
*/
|
|
5493
|
-
function generateRTSSFromSegmentations(segmentations, metadataProvider, DicomMetadataStore
|
|
5196
|
+
function generateRTSSFromSegmentations(segmentations, metadataProvider, DicomMetadataStore) {
|
|
5494
5197
|
// Convert segmentations to ROIContours
|
|
5495
5198
|
var roiContours = [];
|
|
5496
|
-
var contourSets = generateContourSetsFromLabelmap({
|
|
5497
|
-
segmentations: segmentations
|
|
5498
|
-
cornerstoneCache: cornerstoneCache,
|
|
5499
|
-
cornerstoneToolsEnums: cornerstoneToolsEnums,
|
|
5500
|
-
vtkUtils: vtkUtils
|
|
5199
|
+
var contourSets = generateContourSetsFromLabelmap$1({
|
|
5200
|
+
segmentations: segmentations
|
|
5501
5201
|
});
|
|
5502
5202
|
contourSets.forEach(function (contourSet, segIndex) {
|
|
5503
5203
|
// Check contour set isn't undefined
|
|
@@ -5610,6 +5310,7 @@ function generateRTSSFromSegmentations(segmentations, metadataProvider, DicomMet
|
|
|
5610
5310
|
}
|
|
5611
5311
|
};
|
|
5612
5312
|
dataset._meta = _meta;
|
|
5313
|
+
dataset.SpecificCharacterSet = "ISO_IR 192";
|
|
5613
5314
|
return dataset;
|
|
5614
5315
|
}
|
|
5615
5316
|
/**
|
|
@@ -5618,19 +5319,18 @@ function generateRTSSFromSegmentations(segmentations, metadataProvider, DicomMet
|
|
|
5618
5319
|
* Note: The tool data needs to be formatted in a specific way, and currently
|
|
5619
5320
|
* it is limited to the RectangleROIStartEndTool in the Cornerstone.
|
|
5620
5321
|
*
|
|
5621
|
-
* @param annotations Array of Cornerstone tool annotation data
|
|
5622
|
-
* @param metadataProvider Metadata provider
|
|
5623
|
-
* @param options report generation options
|
|
5322
|
+
* @param annotations - Array of Cornerstone tool annotation data
|
|
5323
|
+
* @param metadataProvider - Metadata provider
|
|
5624
5324
|
* @returns Report object containing the dataset
|
|
5625
5325
|
*/
|
|
5626
|
-
function generateRTSSFromAnnotations(annotations, metadataProvider, DicomMetadataStore
|
|
5326
|
+
function generateRTSSFromAnnotations(annotations, metadataProvider, DicomMetadataStore) {
|
|
5627
5327
|
var rtMetadata = {
|
|
5628
5328
|
name: "RTSS from Annotations",
|
|
5629
5329
|
label: "RTSS from Annotations"
|
|
5630
5330
|
};
|
|
5631
5331
|
var dataset = _initializeDataset(rtMetadata, annotations[0].metadata, metadataProvider);
|
|
5632
5332
|
annotations.forEach(function (annotation, index) {
|
|
5633
|
-
var ContourSequence = AnnotationToPointData.convert(annotation, index, metadataProvider
|
|
5333
|
+
var ContourSequence = AnnotationToPointData.convert(annotation, index, metadataProvider);
|
|
5634
5334
|
dataset.StructureSetROISequence.push(getStructureSetModule(annotation, index));
|
|
5635
5335
|
dataset.ROIContourSequence.push(ContourSequence);
|
|
5636
5336
|
dataset.RTROIObservationsSequence.push(getRTROIObservationsSequence(annotation, index));
|
|
@@ -5662,6 +5362,7 @@ function generateRTSSFromAnnotations(annotations, metadataProvider, DicomMetadat
|
|
|
5662
5362
|
}
|
|
5663
5363
|
};
|
|
5664
5364
|
dataset._meta = _meta;
|
|
5365
|
+
dataset.SpecificCharacterSet = "ISO_IR 192";
|
|
5665
5366
|
return dataset;
|
|
5666
5367
|
}
|
|
5667
5368
|
// /**
|
|
@@ -5683,9 +5384,11 @@ function _initializeDataset(rtMetadata, imgMetadata, metadataProvider) {
|
|
|
5683
5384
|
var studyInstanceUID = metadataProvider.get("generalSeriesModule", imageId).studyInstanceUID;
|
|
5684
5385
|
var patientModule = getPatientModule(imageId, metadataProvider);
|
|
5685
5386
|
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() });
|
|
5387
|
+
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
5388
|
}
|
|
5688
5389
|
|
|
5390
|
+
var generateContourSetsFromLabelmap = utilities$1.contours.generateContourSetsFromLabelmap;
|
|
5391
|
+
|
|
5689
5392
|
var RTSS = /*#__PURE__*/Object.freeze({
|
|
5690
5393
|
__proto__: null,
|
|
5691
5394
|
generateContourSetsFromLabelmap: generateContourSetsFromLabelmap,
|
|
@@ -5704,6 +5407,7 @@ var Cornerstone3DSR = {
|
|
|
5704
5407
|
ArrowAnnotate: ArrowAnnotate,
|
|
5705
5408
|
Probe: Probe,
|
|
5706
5409
|
PlanarFreehandROI: PlanarFreehandROI,
|
|
5410
|
+
UltrasoundDirectional: UltrasoundDirectional,
|
|
5707
5411
|
MeasurementReport: MeasurementReport,
|
|
5708
5412
|
CodeScheme: CodingScheme,
|
|
5709
5413
|
CORNERSTONE_3D_TAG: CORNERSTONE_3D_TAG
|