@dcmjs-org/dcmjs 1.0.0-beta.21 → 1.0.0-beta.22

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-C_SwQ4fu.cjs');
5
+ var dcmjs = require('./dcmjs.shared-Dkebpbbj.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-CMo1hh3U.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-DVqSe8G1.js';
2
2
  export { log } from '@dcmjs-org/core';
3
3
  //# sourceMappingURL=dcmjs.es.js.map
package/build/dcmjs.js CHANGED
@@ -18852,6 +18852,22 @@
18852
18852
  DimensionDescriptionLabel: "ImagePositionPatient"
18853
18853
  }];
18854
18854
  }
18855
+
18856
+ /**
18857
+ * Fills in the functional groups of a multiframe dataset.
18858
+ *
18859
+ * A missing or empty SharedFunctionalGroupsSequence is built from the
18860
+ * top-level image plane attributes; a one-item array is used as its item.
18861
+ * The shared item gets the list accessors (addAccessors), so both
18862
+ * `SharedFunctionalGroupsSequence.X` and `SharedFunctionalGroupsSequence[0].X`
18863
+ * work.
18864
+ * The PerFrameFunctionalGroupsSequence is filled up to the declared
18865
+ * NumberOfFrames with items at the top-level position, existing items keep
18866
+ * their content, and each item without a FrameContentSequence gets one.
18867
+ * Added items share the position but get increasing InStackPositionNumber.
18868
+ * Items beyond NumberOfFrames are kept unchanged; a null item there is
18869
+ * skipped and does not throw.
18870
+ */
18855
18871
  }, {
18856
18872
  key: "normalizeMultiframe",
18857
18873
  value: function normalizeMultiframe() {
@@ -18875,6 +18891,10 @@
18875
18891
  if (!ds.PresentationLUTShape) {
18876
18892
  ds.PresentationLUTShape = "IDENTITY";
18877
18893
  }
18894
+ if (Array.isArray(ds.SharedFunctionalGroupsSequence)) {
18895
+ // The shared group has one item; an empty array counts as missing
18896
+ ds.SharedFunctionalGroupsSequence = ds.SharedFunctionalGroupsSequence[0];
18897
+ }
18878
18898
  if (!ds.SharedFunctionalGroupsSequence) {
18879
18899
  log.warn("Missing SharedFunctionalGroupsSequence; using the top-level image plane attributes");
18880
18900
  ds.SharedFunctionalGroupsSequence = ImageNormalizer.sharedImagePlaneGroups(ds, {
@@ -18882,6 +18902,7 @@
18882
18902
  SpacingBetweenSlices: ds.SpacingBetweenSlices
18883
18903
  });
18884
18904
  }
18905
+ ds.SharedFunctionalGroupsSequence = addAccessors(ds.SharedFunctionalGroupsSequence);
18885
18906
 
18886
18907
  // TODO: special case!
18887
18908
  if (ds.BodyPartExamined === "PROSTATE") {
@@ -18901,23 +18922,20 @@
18901
18922
  RescaleSlope: rescaleSlope,
18902
18923
  RescaleType: "US"
18903
18924
  };
18904
- var frameCount = this.datasets.length;
18905
- if (!ds.PerFrameFunctionalGroupsSequence) {
18906
- // One item per declared frame, all at the top-level position
18907
- frameCount = Math.max(frameCount, Number(ds.NumberOfFrames) || 0);
18908
- ds.PerFrameFunctionalGroupsSequence = Array.from({
18909
- length: frameCount
18910
- }, function () {
18911
- return ImageNormalizer.planePositionGroup(ds);
18912
- });
18913
- } else if (!Array.isArray(ds.PerFrameFunctionalGroupsSequence)) {
18914
- ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
18925
+ var frameCount = Math.max(this.datasets.length, Number(ds.NumberOfFrames) || 0);
18926
+ var perFrame = ds.PerFrameFunctionalGroupsSequence || [];
18927
+ ds.PerFrameFunctionalGroupsSequence = Array.isArray(perFrame) ? perFrame : [perFrame];
18928
+ while (ds.PerFrameFunctionalGroupsSequence.length < frameCount) {
18929
+ ds.PerFrameFunctionalGroupsSequence.push(ImageNormalizer.planePositionGroup(ds));
18915
18930
  }
18916
18931
  for (var frameNumber = 1; frameNumber <= frameCount; frameNumber++) {
18917
18932
  var _ds$PerFrameFunctiona, _ref;
18933
+ var item = (_ds$PerFrameFunctiona = ds.PerFrameFunctionalGroupsSequence)[_ref = frameNumber - 1] || (_ds$PerFrameFunctiona[_ref] = {});
18934
+ if (item.FrameContentSequence) {
18935
+ continue;
18936
+ }
18918
18937
  var dataset = this.datasets[frameNumber - 1] || {};
18919
- (_ds$PerFrameFunctiona = ds.PerFrameFunctionalGroupsSequence)[_ref = frameNumber - 1] || (_ds$PerFrameFunctiona[_ref] = {});
18920
- ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
18938
+ item.FrameContentSequence = {
18921
18939
  FrameAcquisitionDuration: 0,
18922
18940
  StackID: 1,
18923
18941
  InStackPositionNumber: frameNumber,
@@ -18925,9 +18943,8 @@
18925
18943
  };
18926
18944
  var frameTime = dataset.AcquisitionDate + dataset.AcquisitionTime;
18927
18945
  if (!isNaN(frameTime)) {
18928
- var frameContentSequence = ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
18929
- frameContentSequence.FrameAcquisitionDateTime = frameTime;
18930
- frameContentSequence.FrameReferenceDateTime = frameTime;
18946
+ item.FrameContentSequence.FrameAcquisitionDateTime = frameTime;
18947
+ item.FrameContentSequence.FrameReferenceDateTime = frameTime;
18931
18948
  }
18932
18949
  }
18933
18950
 
@@ -18955,7 +18972,7 @@
18955
18972
  count: 0
18956
18973
  };
18957
18974
  ds.PerFrameFunctionalGroupsSequence.forEach(function (functionalGroup) {
18958
- if (functionalGroup.FrameVOILUT) {
18975
+ if (functionalGroup !== null && functionalGroup !== void 0 && functionalGroup.FrameVOILUT) {
18959
18976
  var wc = functionalGroup.FrameVOILUTSequence.WindowCenter;
18960
18977
  var ww = functionalGroup.FrameVOILUTSequence.WindowWidth;
18961
18978
  if (functionalGroup.FrameVOILUTSequence && wc && ww) {
@@ -19029,9 +19046,11 @@
19029
19046
  }, {
19030
19047
  key: "planePositionGroup",
19031
19048
  value: function planePositionGroup(dataset) {
19049
+ var position = dataset.ImagePositionPatient;
19032
19050
  return {
19033
19051
  PlanePositionSequence: {
19034
- ImagePositionPatient: dataset.ImagePositionPatient
19052
+ // A copy, so that no two frames share one array
19053
+ ImagePositionPatient: Array.isArray(position) ? position.slice() : position
19035
19054
  }
19036
19055
  };
19037
19056
  }