@dcmjs-org/dcmjs 1.0.0-beta.17 → 1.0.0-beta.18

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/build/dcmjs.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dcmjs = require('./dcmjs.shared---E7clvy.cjs');
5
+ var dcmjs = require('./dcmjs.shared-CKG7Js9d.cjs');
6
6
  var core = require('@dcmjs-org/core');
7
7
 
8
8
 
package/build/dcmjs.es.js CHANGED
@@ -1,3 +1,3 @@
1
- export { D as DICOMWEB, j as adapters, k as anonymizer, l as async, m as constants, n as data, o as default, p as derivations, q as normalizers, s as sr, u as utilities } from './dcmjs.shared-Cy_BdC0f.js';
1
+ export { D as DICOMWEB, j as adapters, k as anonymizer, l as async, m as constants, n as data, o as default, p as derivations, q as normalizers, s as sr, u as utilities } from './dcmjs.shared-BLrcKS2A.js';
2
2
  export { log } from '@dcmjs-org/core';
3
3
  //# sourceMappingURL=dcmjs.es.js.map
package/build/dcmjs.js CHANGED
@@ -11149,6 +11149,8 @@
11149
11149
  throw new Error("SequenceOfItems.read needs readOptions.readItem to parse the items");
11150
11150
  }
11151
11151
  elements.push(readOptions.readItem(itemStream, syntax));
11152
+ } else {
11153
+ elements.push({});
11152
11154
  }
11153
11155
  if (!undefLength && read == sqlength) {
11154
11156
  break;
@@ -18496,16 +18498,10 @@
18496
18498
  //
18497
18499
  // shared
18498
18500
  var SpacingBetweenSlices = Math.abs(distance1 - distance0);
18499
- ds.SharedFunctionalGroupsSequence = {
18500
- PlaneOrientationSequence: {
18501
- ImageOrientationPatient: dataset0.ImageOrientationPatient
18502
- },
18503
- PixelMeasuresSequence: {
18504
- PixelSpacing: dataset0.PixelSpacing,
18505
- SpacingBetweenSlices: SpacingBetweenSlices,
18506
- SliceThickness: SpacingBetweenSlices
18507
- }
18508
- };
18501
+ ds.SharedFunctionalGroupsSequence = ImageNormalizer.sharedImagePlaneGroups(dataset0, {
18502
+ SpacingBetweenSlices: SpacingBetweenSlices,
18503
+ SliceThickness: SpacingBetweenSlices
18504
+ });
18509
18505
  ds.ReferencedSeriesSequence = {
18510
18506
  SeriesInstanceUID: dataset0.SeriesInstanceUID,
18511
18507
  ReferencedInstanceSequence: []
@@ -18518,15 +18514,12 @@
18518
18514
  // and set the referenced series uid
18519
18515
  distanceDatasetPairs.forEach(function (pair) {
18520
18516
  var dataset = pair[1];
18521
- ds.PerFrameFunctionalGroupsSequence.push({
18522
- PlanePositionSequence: {
18523
- ImagePositionPatient: dataset.ImagePositionPatient
18524
- },
18517
+ ds.PerFrameFunctionalGroupsSequence.push(_objectSpread2(_objectSpread2({}, ImageNormalizer.planePositionGroup(dataset)), {}, {
18525
18518
  FrameVOILUTSequence: {
18526
18519
  WindowCenter: dataset.WindowCenter,
18527
18520
  WindowWidth: dataset.WindowWidth
18528
18521
  }
18529
- });
18522
+ }));
18530
18523
  ds.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
18531
18524
  ReferencedSOPClassUID: dataset.SOPClassUID,
18532
18525
  ReferencedSOPInstanceUID: dataset.SOPInstanceUID
@@ -18568,7 +18561,11 @@
18568
18561
  ds.PresentationLUTShape = "IDENTITY";
18569
18562
  }
18570
18563
  if (!ds.SharedFunctionalGroupsSequence) {
18571
- log.error("Can only process multiframe data with SharedFunctionalGroupsSequence");
18564
+ log.warn("Missing SharedFunctionalGroupsSequence; using the top-level image plane attributes");
18565
+ ds.SharedFunctionalGroupsSequence = ImageNormalizer.sharedImagePlaneGroups(ds, {
18566
+ SliceThickness: ds.SliceThickness,
18567
+ SpacingBetweenSlices: ds.SpacingBetweenSlices
18568
+ });
18572
18569
  }
18573
18570
 
18574
18571
  // TODO: special case!
@@ -18589,9 +18586,22 @@
18589
18586
  RescaleSlope: rescaleSlope,
18590
18587
  RescaleType: "US"
18591
18588
  };
18592
- var frameNumber = 1;
18593
- this.datasets.forEach(function (dataset) {
18594
- if (ds.NumberOfFrames === 1) ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
18589
+ var frameCount = this.datasets.length;
18590
+ if (!ds.PerFrameFunctionalGroupsSequence) {
18591
+ // One item per declared frame, all at the top-level position
18592
+ frameCount = Math.max(frameCount, Number(ds.NumberOfFrames) || 0);
18593
+ ds.PerFrameFunctionalGroupsSequence = Array.from({
18594
+ length: frameCount
18595
+ }, function () {
18596
+ return ImageNormalizer.planePositionGroup(ds);
18597
+ });
18598
+ } else if (!Array.isArray(ds.PerFrameFunctionalGroupsSequence)) {
18599
+ ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
18600
+ }
18601
+ for (var frameNumber = 1; frameNumber <= frameCount; frameNumber++) {
18602
+ var _ds$PerFrameFunctiona, _ref;
18603
+ var dataset = this.datasets[frameNumber - 1] || {};
18604
+ (_ds$PerFrameFunctiona = ds.PerFrameFunctionalGroupsSequence)[_ref = frameNumber - 1] || (_ds$PerFrameFunctiona[_ref] = {});
18595
18605
  ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
18596
18606
  FrameAcquisitionDuration: 0,
18597
18607
  StackID: 1,
@@ -18604,8 +18614,7 @@
18604
18614
  frameContentSequence.FrameAcquisitionDateTime = frameTime;
18605
18615
  frameContentSequence.FrameReferenceDateTime = frameTime;
18606
18616
  }
18607
- frameNumber++;
18608
- });
18617
+ }
18609
18618
 
18610
18619
  //
18611
18620
  // TODO: convert this to shared functional group not top level element
@@ -18690,6 +18699,27 @@
18690
18699
  value: function vec3Dot(a, b) {
18691
18700
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
18692
18701
  }
18702
+ }, {
18703
+ key: "sharedImagePlaneGroups",
18704
+ value: function sharedImagePlaneGroups(dataset, pixelMeasures) {
18705
+ return {
18706
+ PlaneOrientationSequence: {
18707
+ ImageOrientationPatient: dataset.ImageOrientationPatient
18708
+ },
18709
+ PixelMeasuresSequence: _objectSpread2({
18710
+ PixelSpacing: dataset.PixelSpacing
18711
+ }, pixelMeasures)
18712
+ };
18713
+ }
18714
+ }, {
18715
+ key: "planePositionGroup",
18716
+ value: function planePositionGroup(dataset) {
18717
+ return {
18718
+ PlanePositionSequence: {
18719
+ ImagePositionPatient: dataset.ImagePositionPatient
18720
+ }
18721
+ };
18722
+ }
18693
18723
  }]);
18694
18724
  }(Normalizer);
18695
18725
  var MRImageNormalizer = /*#__PURE__*/function (_ImageNormalizer) {
@@ -21472,7 +21502,7 @@
21472
21502
  var _matrix$shape = _slicedToArray(matrix.shape, 2),
21473
21503
  rows = _matrix$shape[0],
21474
21504
  cols = _matrix$shape[1];
21475
- var result = ndarray(new Uint8Array(rows * cols), [rows, cols]);
21505
+ var result = ndarray(new matrix.data.constructor(rows * cols), [rows, cols]);
21476
21506
  for (var i = 0; i < rows; i++) {
21477
21507
  for (var j = 0; j < cols; j++) {
21478
21508
  result.set(i, j, matrix.get(i, cols - 1 - j));
@@ -21491,7 +21521,7 @@
21491
21521
  var _matrix$shape2 = _slicedToArray(matrix.shape, 2),
21492
21522
  rows = _matrix$shape2[0],
21493
21523
  cols = _matrix$shape2[1];
21494
- var result = ndarray(new Uint8Array(rows * cols), [rows, cols]);
21524
+ var result = ndarray(new matrix.data.constructor(rows * cols), [rows, cols]);
21495
21525
  for (var j = 0; j < cols; j++) {
21496
21526
  for (var i = 0; i < rows; i++) {
21497
21527
  result.set(i, j, matrix.get(rows - 1 - i, j));
@@ -21510,7 +21540,7 @@
21510
21540
  var _matrix$shape = _slicedToArray(matrix.shape, 2),
21511
21541
  rows = _matrix$shape[0],
21512
21542
  cols = _matrix$shape[1];
21513
- var result = ndarray(new Uint8Array(rows * cols), [cols, rows]);
21543
+ var result = ndarray(new matrix.data.constructor(rows * cols), [cols, rows]);
21514
21544
  var resultColsMinus1 = result.shape[1] - 1;
21515
21545
  for (var i = 0; i < rows; i++) {
21516
21546
  for (var j = 0; j < cols; j++) {