@dcmjs-org/dcmjs 1.0.0-beta.13 → 1.0.0-beta.15

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.js CHANGED
@@ -11027,7 +11027,8 @@
11027
11027
  // Registered by core/writeCore.js at load; the eager engine's
11028
11028
  // DicomMessage.write is a delegate to the same function, so
11029
11029
  // this is the one item-serialization path either way.
11030
- written += writeDataSet$1(item, stream, syntax, writeOptions);
11030
+ // A null item (NAT-U-RT-7) is an empty item
11031
+ written += writeDataSet$1(item || {}, stream, syntax, writeOptions);
11031
11032
  _get(_getPrototypeOf(SequenceOfItems.prototype), "write", this).call(this, stream, "Uint16", 0xfffe);
11032
11033
  _get(_getPrototypeOf(SequenceOfItems.prototype), "write", this).call(this, stream, "Uint16", 0xe00d);
11033
11034
  _get(_getPrototypeOf(SequenceOfItems.prototype), "write", this).call(this, stream, "Uint32", 0x00000000);
@@ -11556,6 +11557,17 @@
11556
11557
  value: function write(stream, vrType, values, syntax, writeOptions) {
11557
11558
  var vr = ValueRepresentation$1.createByTypeString(vrType);
11558
11559
  var useSyntax = normalizeSyntax(syntax);
11560
+ // No value (NAT-U-RT-7): absent, null, "" or only undefined entries is
11561
+ // an empty list; an undefined entry beside a value is a null entry
11562
+ if (values === undefined || values === null || values === "") {
11563
+ values = [];
11564
+ } else if (Array.isArray(values) && values.includes(undefined)) {
11565
+ values = values.every(function (v) {
11566
+ return v === undefined;
11567
+ }) ? [] : values.map(function (v) {
11568
+ return v === undefined ? null : v;
11569
+ });
11570
+ }
11559
11571
  var implicit = useSyntax === IMPLICIT_LITTLE_ENDIAN;
11560
11572
  var isLittleEndian = useSyntax === IMPLICIT_LITTLE_ENDIAN || useSyntax === EXPLICIT_LITTLE_ENDIAN;
11561
11573
  var isEncapsulated = this.isPixelDataTag() && isEncapsulatedSyntax(syntax);
@@ -12795,7 +12807,9 @@
12795
12807
  /**
12796
12808
  * A PN value in the naturalized form (NAT-U-VAL-5): the component object
12797
12809
  * `{ Alphabetic, Ideographic, Phonetic }`, or a list of them, with the PN
12798
- * value accessors (String() gives the DICOM PN string).
12810
+ * value accessors (String() gives the DICOM PN string). A single component
12811
+ * object is array-like, as a single-item sequence (NAT-U-SQ-1):
12812
+ * `pn[0] === pn`, `pn.length === 1`, and `for...of` gives it once.
12799
12813
  *
12800
12814
  * The input is a PN string (`"Doe^John"`, `"A^B=C\\D^E"`), a component
12801
12815
  * object, or a list of strings and objects. `length` is the value count:
@@ -12819,7 +12833,7 @@
12819
12833
  });
12820
12834
  if (single && list.length <= 1) {
12821
12835
  var name = list[0];
12822
- return name && Object.keys(name).length ? dicomJson.pnAddValueAccessors(name) : null;
12836
+ return name && Object.keys(name).length ? addAccessors(dicomJson.pnAddValueAccessors(name)) : null;
12823
12837
  }
12824
12838
  return dicomJson.pnAddValueAccessors(list);
12825
12839
  }