dwv 0.31.0 → 0.31.2

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/dwv.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! dwv 0.31.0 2023-03-07 18:27:54 */
1
+ /*! dwv 0.31.2 2023-05-07 12:03:47 */
2
2
  // Inspired from umdjs
3
3
  // See https://github.com/umdjs/umd/blob/master/templates/returnExports.js
4
4
  (function (root, factory) {
@@ -4749,7 +4749,7 @@ dwv.dicom = dwv.dicom || {};
4749
4749
  * @returns {string} The version of the library.
4750
4750
  */
4751
4751
  dwv.getVersion = function () {
4752
- return '0.31.0';
4752
+ return '0.31.2';
4753
4753
  };
4754
4754
 
4755
4755
  /**
@@ -15923,6 +15923,8 @@ dwv.gui.ViewLayer = function (containerDiv) {
15923
15923
  needsDraw = true;
15924
15924
  }
15925
15925
 
15926
+ // previous fit scale
15927
+ var previousFitScale = fitScale;
15926
15928
  // previous scale without fit
15927
15929
  var previousScale = {
15928
15930
  x: scale.x / fitScale.x,
@@ -15951,9 +15953,19 @@ dwv.gui.ViewLayer = function (containerDiv) {
15951
15953
  x: fitOffset.x / newFitScale.x,
15952
15954
  y: fitOffset.y / newFitScale.y
15953
15955
  };
15956
+ var newFlipOffset = {
15957
+ x: flipOffset.x * previousFitScale.x / newFitScale.x,
15958
+ y: flipOffset.y * previousFitScale.y / newFitScale.y
15959
+ };
15954
15960
  // check if different
15955
- if (viewOffset.x !== newViewOffset.x || viewOffset.y !== newViewOffset.y) {
15961
+ if (viewOffset.x !== newViewOffset.x ||
15962
+ viewOffset.y !== newViewOffset.y ||
15963
+ flipOffset.x !== newFlipOffset.x ||
15964
+ flipOffset.y !== newFlipOffset.y) {
15965
+ // update private local offsets
15966
+ flipOffset = newFlipOffset;
15956
15967
  viewOffset = newViewOffset;
15968
+ // update global offset
15957
15969
  offset = {
15958
15970
  x: viewOffset.x + baseOffset.x + zoomOffset.x + flipOffset.x,
15959
15971
  y: viewOffset.y + baseOffset.y + zoomOffset.y + flipOffset.y
@@ -21263,6 +21275,15 @@ dwv.image.MaskFactory.prototype.create = function (
21263
21275
  dwv.logger.warn(
21264
21276
  'Using larger real world epsilon in SEG pos pat adding'
21265
21277
  );
21278
+ } else {
21279
+ // try even larger epsilon
21280
+ res = value > dwv.math.REAL_WORLD_EPSILON * 100;
21281
+ if (!res) {
21282
+ // warn if epsilon < value < epsilon * 100
21283
+ dwv.logger.warn(
21284
+ 'Using even larger real world epsilon in SEG pos pat adding'
21285
+ );
21286
+ }
21266
21287
  }
21267
21288
  }
21268
21289
  return res;
@@ -23423,7 +23444,7 @@ dwv.image.ViewFactory.prototype.create = function (dicomElements, image) {
23423
23444
  for (var key in dwv.tool.defaultpresets[modality]) {
23424
23445
  var preset = dwv.tool.defaultpresets[modality][key];
23425
23446
  windowPresets[key] = {
23426
- wl: new dwv.image.WindowLevel(preset.center, preset.width),
23447
+ wl: [new dwv.image.WindowLevel(preset.center, preset.width)],
23427
23448
  name: key
23428
23449
  };
23429
23450
  }
@@ -24010,7 +24031,10 @@ dwv.io.DicomDataLoader = function () {
24010
24031
  // call listeners
24011
24032
  self.onloadend(event);
24012
24033
  };
24013
- db2v.onerror = self.onerror;
24034
+ db2v.onerror = function (event) {
24035
+ event.source = origin;
24036
+ self.onerror(event);
24037
+ };
24014
24038
  db2v.onabort = self.onabort;
24015
24039
  }
24016
24040
 
@@ -38934,6 +38958,9 @@ dwv.utils.objectToArray = function (obj) {
38934
38958
  var keys = Object.keys(obj);
38935
38959
  for (var i = 0; i < keys.length; ++i) {
38936
38960
  var key = keys[i];
38961
+ if (obj[key] === null) {
38962
+ continue;
38963
+ }
38937
38964
  var row = {name: key};
38938
38965
  var innerKeys = Object.keys(obj[key]);
38939
38966
  for (var j = 0; j < innerKeys.length; ++j) {
@@ -39763,6 +39790,8 @@ dwv.utils.WorkerThread = function (parentPool) {
39763
39790
  this.stop = function () {
39764
39791
  // stop the worker
39765
39792
  worker.terminate();
39793
+ // force create at next run
39794
+ worker = undefined;
39766
39795
  };
39767
39796
 
39768
39797
  /**