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

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);