dcmjs 0.44.0 → 0.44.1

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.es.js CHANGED
@@ -9028,7 +9028,7 @@ function toWindows(inputArray, size) {
9028
9028
  }
9029
9029
  var DicomMessage$3, Tag$1;
9030
9030
  var binaryVRs = ["FL", "FD", "SL", "SS", "UL", "US", "AT"],
9031
- explicitVRs = ["OB", "OW", "OF", "SQ", "UC", "UR", "UT", "UN", "OD"],
9031
+ length32VRs = ["OB", "OW", "OF", "SQ", "UC", "UR", "UT", "UN", "OD"],
9032
9032
  singleVRs$1 = ["SQ", "OF", "OW", "OB", "UN"];
9033
9033
  var ValueRepresentation = /*#__PURE__*/function () {
9034
9034
  function ValueRepresentation(type) {
@@ -9037,7 +9037,7 @@ var ValueRepresentation = /*#__PURE__*/function () {
9037
9037
  this.multi = false;
9038
9038
  this._isBinary = binaryVRs.indexOf(this.type) != -1;
9039
9039
  this._allowMultiple = !this._isBinary && singleVRs$1.indexOf(this.type) == -1;
9040
- this._isExplicit = explicitVRs.indexOf(this.type) != -1;
9040
+ this._isLength32 = length32VRs.indexOf(this.type) != -1;
9041
9041
  this._storeRaw = true;
9042
9042
  }
9043
9043
  _createClass(ValueRepresentation, [{
@@ -9050,10 +9050,30 @@ var ValueRepresentation = /*#__PURE__*/function () {
9050
9050
  value: function allowMultiple() {
9051
9051
  return this._allowMultiple;
9052
9052
  }
9053
+
9054
+ /**
9055
+ * Returns if the length is 32 bits. This has nothing to do with being
9056
+ * explicit or not, it only has to do with encoding.
9057
+ * @deprecated Replaced by isLength32
9058
+ */
9053
9059
  }, {
9054
9060
  key: "isExplicit",
9055
9061
  value: function isExplicit() {
9056
- return this._isExplicit;
9062
+ return this._isLength32;
9063
+ }
9064
+
9065
+ /**
9066
+ * Returns if the length is 32 bits. This has nothing to do with being
9067
+ * explicit or not, it only has to do with encoding.
9068
+ *
9069
+ * This used to be isExplicit, which was wrong as both encodings are explicit,
9070
+ * just one uses a single 4 byte word to encode both VR and length, and
9071
+ * the isLength32 always use a separate 32 bit length.
9072
+ */
9073
+ }, {
9074
+ key: "isLength32",
9075
+ value: function isLength32() {
9076
+ return this._isLength32;
9057
9077
  }
9058
9078
 
9059
9079
  /**
@@ -10481,7 +10501,7 @@ var ParsedUnknownValue = /*#__PURE__*/function (_BinaryRepresentation2) {
10481
10501
  _this28.noMultiple = true;
10482
10502
  _this28._isBinary = true;
10483
10503
  _this28._allowMultiple = false;
10484
- _this28._isExplicit = true;
10504
+ _this28._isLength32 = true;
10485
10505
  _this28._storeRaw = true;
10486
10506
  return _this28;
10487
10507
  }
@@ -10706,11 +10726,11 @@ var Tag = /*#__PURE__*/function () {
10706
10726
  }, {
10707
10727
  key: "write",
10708
10728
  value: function write(stream, vrType, values, syntax, writeOptions) {
10709
- var vr = ValueRepresentation.createByTypeString(vrType),
10710
- useSyntax = DicomMessage$1._normalizeSyntax(syntax);
10711
- var implicit = useSyntax == IMPLICIT_LITTLE_ENDIAN ? true : false,
10712
- isLittleEndian = useSyntax == IMPLICIT_LITTLE_ENDIAN || useSyntax == EXPLICIT_LITTLE_ENDIAN$1 ? true : false,
10713
- isEncapsulated = this.isPixelDataTag() && DicomMessage$1.isEncapsulated(syntax);
10729
+ var vr = ValueRepresentation.createByTypeString(vrType);
10730
+ var useSyntax = DicomMessage$1._normalizeSyntax(syntax);
10731
+ var implicit = useSyntax == IMPLICIT_LITTLE_ENDIAN ? true : false;
10732
+ var isLittleEndian = useSyntax == IMPLICIT_LITTLE_ENDIAN || useSyntax == EXPLICIT_LITTLE_ENDIAN$1 ? true : false;
10733
+ var isEncapsulated = this.isPixelDataTag() && DicomMessage$1.isEncapsulated(syntax);
10714
10734
  var oldEndian = stream.isLittleEndian;
10715
10735
  stream.setEndian(isLittleEndian);
10716
10736
  stream.writeUint16(this.group());
@@ -10733,8 +10753,13 @@ var Tag = /*#__PURE__*/function () {
10733
10753
  stream.writeUint32(valueLength);
10734
10754
  written += 4;
10735
10755
  } else {
10736
- if (vr.isExplicit()) {
10737
- stream.writeAsciiString(vr.type);
10756
+ // Big 16 length objects are encodings for values larger than
10757
+ // 16 bit lengths which would normally use a 16 bit length field.
10758
+ // This uses a VR=UN instead of the original VR, and a 32 bit length
10759
+ var isBig16Length = !vr.isLength32() && valueLength >= 0x10000 && valueLength !== 0xffffffff;
10760
+ if (vr.isLength32() || isBig16Length) {
10761
+ // Write as vr UN for big values
10762
+ stream.writeAsciiString(isBig16Length ? "UN" : vr.type);
10738
10763
  stream.writeUint16(0);
10739
10764
  stream.writeUint32(valueLength);
10740
10765
  written += 8;
@@ -11123,7 +11148,7 @@ var DicomMessage = /*#__PURE__*/function () {
11123
11148
  } else {
11124
11149
  vr = ValueRepresentation.createByTypeString(vrType);
11125
11150
  }
11126
- if (vr.isExplicit()) {
11151
+ if (vr.isLength32()) {
11127
11152
  stream.increment(2);
11128
11153
  length = stream.readUint32();
11129
11154
  } else {