@cornerstonejs/adapters 1.30.0 → 1.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,354 +4,354 @@ import ndarray from 'ndarray';
4
4
  import cloneDeep from 'lodash.clonedeep';
5
5
  import { vec3 } from 'gl-matrix';
6
6
 
7
- function _iterableToArrayLimit(arr, i) {
8
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
9
- if (null != _i) {
10
- var _s,
11
- _e,
12
- _x,
13
- _r,
14
- _arr = [],
15
- _n = !0,
16
- _d = !1;
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;
17
17
  try {
18
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
19
- if (Object(_i) !== _i) return;
20
- _n = !1;
21
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
22
- } catch (err) {
23
- _d = !0, _e = err;
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;
24
24
  } finally {
25
25
  try {
26
- if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
26
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
27
27
  } finally {
28
- if (_d) throw _e;
28
+ if (o) throw n;
29
29
  }
30
30
  }
31
- return _arr;
31
+ return a;
32
32
  }
33
33
  }
34
- function ownKeys(object, enumerableOnly) {
35
- var keys = Object.keys(object);
34
+ function ownKeys(e, r) {
35
+ var t = Object.keys(e);
36
36
  if (Object.getOwnPropertySymbols) {
37
- var symbols = Object.getOwnPropertySymbols(object);
38
- enumerableOnly && (symbols = symbols.filter(function (sym) {
39
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
40
- })), keys.push.apply(keys, symbols);
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);
41
41
  }
42
- return keys;
42
+ return t;
43
43
  }
44
- function _objectSpread2(target) {
45
- for (var i = 1; i < arguments.length; i++) {
46
- var source = null != arguments[i] ? arguments[i] : {};
47
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
48
- _defineProperty(target, key, source[key]);
49
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
50
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
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));
51
51
  });
52
52
  }
53
- return target;
53
+ return e;
54
54
  }
55
55
  function _regeneratorRuntime() {
56
56
  _regeneratorRuntime = function () {
57
- return exports;
57
+ return e;
58
58
  };
59
- var exports = {},
60
- Op = Object.prototype,
61
- hasOwn = Op.hasOwnProperty,
62
- defineProperty = Object.defineProperty || function (obj, key, desc) {
63
- obj[key] = desc.value;
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;
64
65
  },
65
- $Symbol = "function" == typeof Symbol ? Symbol : {},
66
- iteratorSymbol = $Symbol.iterator || "@@iterator",
67
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
68
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
69
- function define(obj, key, value) {
70
- return Object.defineProperty(obj, key, {
71
- value: 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,
72
73
  enumerable: !0,
73
74
  configurable: !0,
74
75
  writable: !0
75
- }), obj[key];
76
+ }), t[e];
76
77
  }
77
78
  try {
78
79
  define({}, "");
79
- } catch (err) {
80
- define = function (obj, key, value) {
81
- return obj[key] = value;
80
+ } catch (t) {
81
+ define = function (t, e, r) {
82
+ return t[e] = r;
82
83
  };
83
84
  }
84
- function wrap(innerFn, outerFn, self, tryLocsList) {
85
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
86
- generator = Object.create(protoGenerator.prototype),
87
- context = new Context(tryLocsList || []);
88
- return defineProperty(generator, "_invoke", {
89
- value: makeInvokeMethod(innerFn, self, context)
90
- }), generator;
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;
91
92
  }
92
- function tryCatch(fn, obj, arg) {
93
+ function tryCatch(t, e, r) {
93
94
  try {
94
95
  return {
95
96
  type: "normal",
96
- arg: fn.call(obj, arg)
97
+ arg: t.call(e, r)
97
98
  };
98
- } catch (err) {
99
+ } catch (t) {
99
100
  return {
100
101
  type: "throw",
101
- arg: err
102
+ arg: t
102
103
  };
103
104
  }
104
105
  }
105
- exports.wrap = wrap;
106
- var ContinueSentinel = {};
106
+ e.wrap = wrap;
107
+ var h = "suspendedStart",
108
+ l = "suspendedYield",
109
+ f = "executing",
110
+ s = "completed",
111
+ y = {};
107
112
  function Generator() {}
108
113
  function GeneratorFunction() {}
109
114
  function GeneratorFunctionPrototype() {}
110
- var IteratorPrototype = {};
111
- define(IteratorPrototype, iteratorSymbol, function () {
115
+ var p = {};
116
+ define(p, a, function () {
112
117
  return this;
113
118
  });
114
- var getProto = Object.getPrototypeOf,
115
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
116
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
117
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
118
- function defineIteratorMethods(prototype) {
119
- ["next", "throw", "return"].forEach(function (method) {
120
- define(prototype, method, function (arg) {
121
- return this._invoke(method, arg);
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);
122
127
  });
123
128
  });
124
129
  }
125
- function AsyncIterator(generator, PromiseImpl) {
126
- function invoke(method, arg, resolve, reject) {
127
- var record = tryCatch(generator[method], generator, arg);
128
- if ("throw" !== record.type) {
129
- var result = record.arg,
130
- value = result.value;
131
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
132
- invoke("next", value, resolve, reject);
133
- }, function (err) {
134
- invoke("throw", err, resolve, reject);
135
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
136
- result.value = unwrapped, resolve(result);
137
- }, function (error) {
138
- return invoke("throw", error, resolve, reject);
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);
139
144
  });
140
145
  }
141
- reject(record.arg);
146
+ a(c.arg);
142
147
  }
143
- var previousPromise;
144
- defineProperty(this, "_invoke", {
145
- value: function (method, arg) {
148
+ var r;
149
+ o(this, "_invoke", {
150
+ value: function (t, n) {
146
151
  function callInvokeWithMethodAndArg() {
147
- return new PromiseImpl(function (resolve, reject) {
148
- invoke(method, arg, resolve, reject);
152
+ return new e(function (e, r) {
153
+ invoke(t, n, e, r);
149
154
  });
150
155
  }
151
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
156
+ return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
152
157
  }
153
158
  });
154
159
  }
155
- function makeInvokeMethod(innerFn, self, context) {
156
- var state = "suspendedStart";
157
- return function (method, arg) {
158
- if ("executing" === state) throw new Error("Generator is already running");
159
- if ("completed" === state) {
160
- if ("throw" === method) throw arg;
161
- return doneResult();
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
+ };
162
170
  }
163
- for (context.method = method, context.arg = arg;;) {
164
- var delegate = context.delegate;
165
- if (delegate) {
166
- var delegateResult = maybeInvokeDelegate(delegate, context);
167
- if (delegateResult) {
168
- if (delegateResult === ContinueSentinel) continue;
169
- return delegateResult;
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;
170
178
  }
171
179
  }
172
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
173
- if ("suspendedStart" === state) throw state = "completed", context.arg;
174
- context.dispatchException(context.arg);
175
- } else "return" === context.method && context.abrupt("return", context.arg);
176
- state = "executing";
177
- var record = tryCatch(innerFn, self, context);
178
- if ("normal" === record.type) {
179
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
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;
180
188
  return {
181
- value: record.arg,
182
- done: context.done
189
+ value: p.arg,
190
+ done: n.done
183
191
  };
184
192
  }
185
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
193
+ "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
186
194
  }
187
195
  };
188
196
  }
189
- function maybeInvokeDelegate(delegate, context) {
190
- var methodName = context.method,
191
- method = delegate.iterator[methodName];
192
- if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
193
- var record = tryCatch(method, delegate.iterator, context.arg);
194
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
195
- var info = record.arg;
196
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
197
- }
198
- function pushTryEntry(locs) {
199
- var entry = {
200
- tryLoc: locs[0]
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]
201
209
  };
202
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
210
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
203
211
  }
204
- function resetTryEntry(entry) {
205
- var record = entry.completion || {};
206
- record.type = "normal", delete record.arg, entry.completion = record;
212
+ function resetTryEntry(t) {
213
+ var e = t.completion || {};
214
+ e.type = "normal", delete e.arg, t.completion = e;
207
215
  }
208
- function Context(tryLocsList) {
216
+ function Context(t) {
209
217
  this.tryEntries = [{
210
218
  tryLoc: "root"
211
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
212
- }
213
- function values(iterable) {
214
- if (iterable) {
215
- var iteratorMethod = iterable[iteratorSymbol];
216
- if (iteratorMethod) return iteratorMethod.call(iterable);
217
- if ("function" == typeof iterable.next) return iterable;
218
- if (!isNaN(iterable.length)) {
219
- var i = -1,
220
- next = function next() {
221
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
222
- return next.value = undefined, next.done = !0, next;
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;
223
231
  };
224
- return next.next = next;
232
+ return i.next = i;
225
233
  }
226
234
  }
227
- return {
228
- next: doneResult
229
- };
230
- }
231
- function doneResult() {
232
- return {
233
- value: undefined,
234
- done: !0
235
- };
235
+ throw new TypeError(typeof e + " is not iterable");
236
236
  }
237
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
237
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
238
238
  value: GeneratorFunctionPrototype,
239
239
  configurable: !0
240
- }), defineProperty(GeneratorFunctionPrototype, "constructor", {
240
+ }), o(GeneratorFunctionPrototype, "constructor", {
241
241
  value: GeneratorFunction,
242
242
  configurable: !0
243
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
244
- var ctor = "function" == typeof genFun && genFun.constructor;
245
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
246
- }, exports.mark = function (genFun) {
247
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
248
- }, exports.awrap = function (arg) {
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) {
249
249
  return {
250
- __await: arg
250
+ __await: t
251
251
  };
252
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
252
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
253
253
  return this;
254
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
255
- void 0 === PromiseImpl && (PromiseImpl = Promise);
256
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
257
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
258
- return result.done ? result.value : iter.next();
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();
259
259
  });
260
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
260
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
261
261
  return this;
262
- }), define(Gp, "toString", function () {
262
+ }), define(g, "toString", function () {
263
263
  return "[object Generator]";
264
- }), exports.keys = function (val) {
265
- var object = Object(val),
266
- keys = [];
267
- for (var key in object) keys.push(key);
268
- return keys.reverse(), function next() {
269
- for (; keys.length;) {
270
- var key = keys.pop();
271
- if (key in object) return next.value = key, next.done = !1, next;
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;
272
272
  }
273
273
  return next.done = !0, next;
274
274
  };
275
- }, exports.values = values, Context.prototype = {
275
+ }, e.values = values, Context.prototype = {
276
276
  constructor: Context,
277
- reset: function (skipTempReset) {
278
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
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);
279
279
  },
280
280
  stop: function () {
281
281
  this.done = !0;
282
- var rootRecord = this.tryEntries[0].completion;
283
- if ("throw" === rootRecord.type) throw rootRecord.arg;
282
+ var t = this.tryEntries[0].completion;
283
+ if ("throw" === t.type) throw t.arg;
284
284
  return this.rval;
285
285
  },
286
- dispatchException: function (exception) {
287
- if (this.done) throw exception;
288
- var context = this;
289
- function handle(loc, caught) {
290
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
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;
291
291
  }
292
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
293
- var entry = this.tryEntries[i],
294
- record = entry.completion;
295
- if ("root" === entry.tryLoc) return handle("end");
296
- if (entry.tryLoc <= this.prev) {
297
- var hasCatch = hasOwn.call(entry, "catchLoc"),
298
- hasFinally = hasOwn.call(entry, "finallyLoc");
299
- if (hasCatch && hasFinally) {
300
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
301
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
302
- } else if (hasCatch) {
303
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
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);
304
304
  } else {
305
- if (!hasFinally) throw new Error("try statement without catch or finally");
306
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
305
+ if (!u) throw new Error("try statement without catch or finally");
306
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
307
307
  }
308
308
  }
309
309
  }
310
310
  },
311
- abrupt: function (type, arg) {
312
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
313
- var entry = this.tryEntries[i];
314
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
315
- var finallyEntry = entry;
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;
316
316
  break;
317
317
  }
318
318
  }
319
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
320
- var record = finallyEntry ? finallyEntry.completion : {};
321
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
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);
322
322
  },
323
- complete: function (record, afterLoc) {
324
- if ("throw" === record.type) throw record.arg;
325
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
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;
326
326
  },
327
- finish: function (finallyLoc) {
328
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
329
- var entry = this.tryEntries[i];
330
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
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;
331
331
  }
332
332
  },
333
- catch: function (tryLoc) {
334
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
335
- var entry = this.tryEntries[i];
336
- if (entry.tryLoc === tryLoc) {
337
- var record = entry.completion;
338
- if ("throw" === record.type) {
339
- var thrown = record.arg;
340
- resetTryEntry(entry);
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);
341
341
  }
342
- return thrown;
342
+ return o;
343
343
  }
344
344
  }
345
345
  throw new Error("illegal catch attempt");
346
346
  },
347
- delegateYield: function (iterable, resultName, nextLoc) {
347
+ delegateYield: function (e, r, n) {
348
348
  return this.delegate = {
349
- iterator: values(iterable),
350
- resultName: resultName,
351
- nextLoc: nextLoc
352
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
349
+ iterator: values(e),
350
+ resultName: r,
351
+ nextLoc: n
352
+ }, "next" === this.method && (this.arg = t), y;
353
353
  }
354
- }, exports;
354
+ }, e;
355
355
  }
356
356
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
357
357
  try {
@@ -2814,32 +2814,33 @@ function checkSEGsOverlapping(pixelData, multiframe, imageIds, validOrientations
2814
2814
 
2815
2815
  var frameSegmentsMapping = new Map();
2816
2816
  var _loop3 = function _loop3() {
2817
- var segmentIndex = getSegmentIndex(multiframe, frameSegment);
2818
- if (segmentIndex === undefined) {
2819
- console.warn("Could not retrieve the segment index for frame segment " + frameSegment + ", skipping this frame.");
2820
- return "continue";
2821
- }
2822
- var imageId = findReferenceSourceImageId(multiframe, frameSegment, imageIds, metadataProvider, tolerance, sopUIDImageIdIndexMap);
2823
- if (!imageId) {
2824
- console.warn("Image not present in stack, can't import frame : " + frameSegment + ".");
2825
- return "continue";
2826
- }
2827
- var imageIdIndex = imageIds.findIndex(function (element) {
2828
- return element === imageId;
2829
- });
2830
- if (frameSegmentsMapping.has(imageIdIndex)) {
2831
- var segmentArray = frameSegmentsMapping.get(imageIdIndex);
2832
- if (!segmentArray.includes(frameSegment)) {
2833
- segmentArray.push(frameSegment);
2834
- frameSegmentsMapping.set(imageIdIndex, segmentArray);
2817
+ var segmentIndex = getSegmentIndex(multiframe, frameSegment);
2818
+ if (segmentIndex === undefined) {
2819
+ console.warn("Could not retrieve the segment index for frame segment " + frameSegment + ", skipping this frame.");
2820
+ return 0; // continue
2835
2821
  }
2836
- } else {
2837
- frameSegmentsMapping.set(imageIdIndex, [frameSegment]);
2838
- }
2839
- };
2822
+ var imageId = findReferenceSourceImageId(multiframe, frameSegment, imageIds, metadataProvider, tolerance, sopUIDImageIdIndexMap);
2823
+ if (!imageId) {
2824
+ console.warn("Image not present in stack, can't import frame : " + frameSegment + ".");
2825
+ return 0; // continue
2826
+ }
2827
+ var imageIdIndex = imageIds.findIndex(function (element) {
2828
+ return element === imageId;
2829
+ });
2830
+ if (frameSegmentsMapping.has(imageIdIndex)) {
2831
+ var segmentArray = frameSegmentsMapping.get(imageIdIndex);
2832
+ if (!segmentArray.includes(frameSegment)) {
2833
+ segmentArray.push(frameSegment);
2834
+ frameSegmentsMapping.set(imageIdIndex, segmentArray);
2835
+ }
2836
+ } else {
2837
+ frameSegmentsMapping.set(imageIdIndex, [frameSegment]);
2838
+ }
2839
+ },
2840
+ _ret;
2840
2841
  for (var frameSegment = 0; frameSegment < groupsLen; ++frameSegment) {
2841
- var _ret = _loop3();
2842
- if (_ret === "continue") continue;
2842
+ _ret = _loop3();
2843
+ if (_ret === 0) continue;
2843
2844
  }
2844
2845
  var _iterator = _createForOfIteratorHelper(frameSegmentsMapping.entries()),
2845
2846
  _step;
@@ -2907,77 +2908,78 @@ function insertOverlappingPixelDataPlanar(segmentsOnFrame, segmentsOnFrameArray,
2907
2908
  var numberOfSegs = multiframe.SegmentSequence.length;
2908
2909
  for (var segmentIndexToProcess = 1; segmentIndexToProcess <= numberOfSegs; ++segmentIndexToProcess) {
2909
2910
  var _loop4 = function _loop4(_i2) {
2910
- var PerFrameFunctionalGroups = PerFrameFunctionalGroupsSequence[_i2];
2911
- var segmentIndex = getSegmentIndex(multiframe, _i2);
2912
- if (segmentIndex === undefined) {
2913
- throw new Error("Could not retrieve the segment index. Aborting segmentation loading.");
2914
- }
2915
- if (segmentIndex !== segmentIndexToProcess) {
2916
- i = _i2;
2917
- return "continue";
2918
- }
2919
- var ImageOrientationPatientI = sharedImageOrientationPatient || PerFrameFunctionalGroups.PlaneOrientationSequence.ImageOrientationPatient;
2920
-
2921
- // Since we moved to the chunks approach, we need to read the data
2922
- // and handle scenarios where the portion of data is in one chunk
2923
- // and the other portion is in another chunk
2924
- var view = readFromUnpackedChunks(pixelData, _i2 * sliceLength, sliceLength);
2925
- var pixelDataI2D = ndarray(view, [Rows, Columns]);
2926
- var alignedPixelDataI = alignPixelDataWithSourceData(pixelDataI2D, ImageOrientationPatientI, validOrientations, tolerance);
2927
- if (!alignedPixelDataI) {
2928
- 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.");
2929
- }
2930
- var imageId = findReferenceSourceImageId(multiframe, _i2, imageIds, metadataProvider, tolerance, sopUIDImageIdIndexMap);
2931
- if (!imageId) {
2932
- console.warn("Image not present in stack, can't import frame : " + _i2 + ".");
2933
- i = _i2;
2934
- return "continue";
2935
- }
2936
- var sourceImageMetadata = metadataProvider.get("instance", imageId);
2937
- if (Rows !== sourceImageMetadata.Rows || Columns !== sourceImageMetadata.Columns) {
2938
- 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. ");
2939
- }
2940
- var imageIdIndex = imageIds.findIndex(function (element) {
2941
- return element === imageId;
2942
- });
2943
- var byteOffset = sliceLength * imageIdIndex * TypedArrayConstructor.BYTES_PER_ELEMENT;
2944
- var labelmap2DView = new TypedArrayConstructor(tempBuffer, byteOffset, sliceLength);
2945
- var data = alignedPixelDataI.data;
2946
- var segmentOnFrame = false;
2947
- for (var j = 0, len = alignedPixelDataI.data.length; j < len; ++j) {
2948
- if (data[j]) {
2949
- if (labelmap2DView[j] !== 0) {
2950
- m++;
2951
- if (m >= M) {
2952
- labelmapBufferArray[m] = new ArrayBuffer(arrayBufferLength);
2953
- segmentsOnFrameArray[m] = [];
2954
- M++;
2911
+ var PerFrameFunctionalGroups = PerFrameFunctionalGroupsSequence[_i2];
2912
+ var segmentIndex = getSegmentIndex(multiframe, _i2);
2913
+ if (segmentIndex === undefined) {
2914
+ throw new Error("Could not retrieve the segment index. Aborting segmentation loading.");
2915
+ }
2916
+ if (segmentIndex !== segmentIndexToProcess) {
2917
+ i = _i2;
2918
+ return 0; // continue
2919
+ }
2920
+ var ImageOrientationPatientI = sharedImageOrientationPatient || PerFrameFunctionalGroups.PlaneOrientationSequence.ImageOrientationPatient;
2921
+
2922
+ // Since we moved to the chunks approach, we need to read the data
2923
+ // and handle scenarios where the portion of data is in one chunk
2924
+ // and the other portion is in another chunk
2925
+ var view = readFromUnpackedChunks(pixelData, _i2 * sliceLength, sliceLength);
2926
+ var pixelDataI2D = ndarray(view, [Rows, Columns]);
2927
+ var alignedPixelDataI = alignPixelDataWithSourceData(pixelDataI2D, ImageOrientationPatientI, validOrientations, tolerance);
2928
+ if (!alignedPixelDataI) {
2929
+ 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.");
2930
+ }
2931
+ var imageId = findReferenceSourceImageId(multiframe, _i2, imageIds, metadataProvider, tolerance, sopUIDImageIdIndexMap);
2932
+ if (!imageId) {
2933
+ console.warn("Image not present in stack, can't import frame : " + _i2 + ".");
2934
+ i = _i2;
2935
+ return 0; // continue
2936
+ }
2937
+ var sourceImageMetadata = metadataProvider.get("instance", imageId);
2938
+ if (Rows !== sourceImageMetadata.Rows || Columns !== sourceImageMetadata.Columns) {
2939
+ 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. ");
2940
+ }
2941
+ var imageIdIndex = imageIds.findIndex(function (element) {
2942
+ return element === imageId;
2943
+ });
2944
+ var byteOffset = sliceLength * imageIdIndex * TypedArrayConstructor.BYTES_PER_ELEMENT;
2945
+ var labelmap2DView = new TypedArrayConstructor(tempBuffer, byteOffset, sliceLength);
2946
+ var data = alignedPixelDataI.data;
2947
+ var segmentOnFrame = false;
2948
+ for (var j = 0, len = alignedPixelDataI.data.length; j < len; ++j) {
2949
+ if (data[j]) {
2950
+ if (labelmap2DView[j] !== 0) {
2951
+ m++;
2952
+ if (m >= M) {
2953
+ labelmapBufferArray[m] = new ArrayBuffer(arrayBufferLength);
2954
+ segmentsOnFrameArray[m] = [];
2955
+ M++;
2956
+ }
2957
+ tempBuffer = labelmapBufferArray[m].slice(0);
2958
+ tempSegmentsOnFrame = cloneDeep(segmentsOnFrameArray[m]);
2959
+ _i2 = 0;
2960
+ break;
2961
+ } else {
2962
+ labelmap2DView[j] = segmentIndex;
2963
+ segmentOnFrame = true;
2955
2964
  }
2956
- tempBuffer = labelmapBufferArray[m].slice(0);
2957
- tempSegmentsOnFrame = cloneDeep(segmentsOnFrameArray[m]);
2958
- _i2 = 0;
2959
- break;
2960
- } else {
2961
- labelmap2DView[j] = segmentIndex;
2962
- segmentOnFrame = true;
2963
2965
  }
2964
2966
  }
2965
- }
2966
- if (segmentOnFrame) {
2967
- if (!tempSegmentsOnFrame[imageIdIndex]) {
2968
- tempSegmentsOnFrame[imageIdIndex] = [];
2969
- }
2970
- tempSegmentsOnFrame[imageIdIndex].push(segmentIndex);
2971
- if (!segmentsOnFrame[imageIdIndex]) {
2972
- segmentsOnFrame[imageIdIndex] = [];
2967
+ if (segmentOnFrame) {
2968
+ if (!tempSegmentsOnFrame[imageIdIndex]) {
2969
+ tempSegmentsOnFrame[imageIdIndex] = [];
2970
+ }
2971
+ tempSegmentsOnFrame[imageIdIndex].push(segmentIndex);
2972
+ if (!segmentsOnFrame[imageIdIndex]) {
2973
+ segmentsOnFrame[imageIdIndex] = [];
2974
+ }
2975
+ segmentsOnFrame[imageIdIndex].push(segmentIndex);
2973
2976
  }
2974
- segmentsOnFrame[imageIdIndex].push(segmentIndex);
2975
- }
2976
- i = _i2;
2977
- };
2977
+ i = _i2;
2978
+ },
2979
+ _ret2;
2978
2980
  for (var i = 0, groupsLen = PerFrameFunctionalGroupsSequence.length; i < groupsLen; ++i) {
2979
- var _ret2 = _loop4(i);
2980
- if (_ret2 === "continue") continue;
2981
+ _ret2 = _loop4(i);
2982
+ if (_ret2 === 0) continue;
2981
2983
  }
2982
2984
  labelmapBufferArray[m] = tempBuffer.slice(0);
2983
2985
  segmentsOnFrameArray[m] = cloneDeep(tempSegmentsOnFrame);
@@ -3547,6 +3549,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
3547
3549
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
3548
3550
  PERFORMANCE OF THIS SOFTWARE.
3549
3551
  ***************************************************************************** */
3552
+ /* global Reflect, Promise, SuppressedError, Symbol */
3553
+
3550
3554
  var __assign = function () {
3551
3555
  __assign = Object.assign || function __assign(t) {
3552
3556
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -3566,6 +3570,10 @@ function __spreadArray(to, from, pack) {
3566
3570
  }
3567
3571
  return to.concat(ar || Array.prototype.slice.call(from));
3568
3572
  }
3573
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
3574
+ var e = new Error(message);
3575
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
3576
+ };
3569
3577
 
3570
3578
  var CORNERSTONE_3D_TAG = "Cornerstone3DTools@^0.1.0";
3571
3579