dcmjs 0.24.4 → 0.24.7

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
@@ -1583,7 +1583,8 @@ var BinaryRepresentation = /*#__PURE__*/function (_ValueRepresentation3) {
1583
1583
  var bufferLength = 0;
1584
1584
 
1585
1585
  for (i = 0; i < frames; i++) {
1586
- bufferLength += value[i].byteLength;
1586
+ var needsPadding = Boolean(value[i].byteLength & 1);
1587
+ bufferLength += value[i].byteLength + (needsPadding ? 1 : 0);
1587
1588
  var _fragmentsLength = 1;
1588
1589
 
1589
1590
  if (fragmentMultiframe) {
@@ -1597,6 +1598,8 @@ var BinaryRepresentation = /*#__PURE__*/function (_ValueRepresentation3) {
1597
1598
  binaryStream = new WriteBufferStream(bufferLength, stream.isLittleEndian);
1598
1599
 
1599
1600
  for (i = 0; i < frames; i++) {
1601
+ var _needsPadding = Boolean(value[i].byteLength & 1);
1602
+
1600
1603
  startOffset.push(binaryStream.size);
1601
1604
  var frameBuffer = value[i],
1602
1605
  frameStream = new ReadBufferStream(frameBuffer);
@@ -1607,13 +1610,14 @@ var BinaryRepresentation = /*#__PURE__*/function (_ValueRepresentation3) {
1607
1610
  }
1608
1611
 
1609
1612
  for (var j = 0, fragmentStart = 0; j < fragmentsLength; j++) {
1613
+ var isFinalFragment = j === fragmentsLength - 1;
1610
1614
  var fragmentEnd = fragmentStart + frameStream.size;
1611
1615
 
1612
1616
  if (fragmentMultiframe) {
1613
1617
  fragmentEnd = fragmentStart + fragmentSize;
1614
1618
  }
1615
1619
 
1616
- if (j == fragmentsLength - 1) {
1620
+ if (isFinalFragment) {
1617
1621
  fragmentEnd = frameStream.size;
1618
1622
  }
1619
1623
 
@@ -1621,8 +1625,13 @@ var BinaryRepresentation = /*#__PURE__*/function (_ValueRepresentation3) {
1621
1625
  fragmentStart = fragmentEnd;
1622
1626
  binaryStream.writeUint16(0xfffe);
1623
1627
  binaryStream.writeUint16(0xe000);
1624
- binaryStream.writeUint32(fragStream.size);
1628
+ var addPaddingByte = isFinalFragment && _needsPadding;
1629
+ binaryStream.writeUint32(fragStream.size + (addPaddingByte ? 1 : 0));
1625
1630
  binaryStream.concat(fragStream);
1631
+
1632
+ if (addPaddingByte) {
1633
+ binaryStream.writeInt8(this.padByte);
1634
+ }
1626
1635
  }
1627
1636
  }
1628
1637
 
@@ -1638,13 +1647,6 @@ var BinaryRepresentation = /*#__PURE__*/function (_ValueRepresentation3) {
1638
1647
  stream.writeUint16(0xfffe);
1639
1648
  stream.writeUint16(0xe0dd);
1640
1649
  stream.writeUint32(0x0);
1641
- var written = 8 + binaryStream.size + startOffset.length * 4 + 8;
1642
-
1643
- if (written & 1) {
1644
- stream.writeUint8(this.padByte);
1645
- written++;
1646
- }
1647
-
1648
1650
  return 0xffffffff;
1649
1651
  } else {
1650
1652
  var binaryData = value[0];
@@ -3031,7 +3033,7 @@ var handler = {
3031
3033
  * assert src.b === 'innerChange'
3032
3034
  */
3033
3035
 
3034
- var addAccessors$1 = function addAccessors(dest, sqZero) {
3036
+ var addAccessors = function addAccessors(dest, sqZero) {
3035
3037
  if (dest.__isProxy) return dest;
3036
3038
  var itemZero = sqZero;
3037
3039
 
@@ -3202,7 +3204,7 @@ var DicomMetaDictionary = /*#__PURE__*/function () {
3202
3204
  var sqZero = naturalDataset[naturalName][0];
3203
3205
 
3204
3206
  if (sqZero && _typeof(sqZero) === "object" && !sqZero.length) {
3205
- naturalDataset[naturalName] = addAccessors$1(naturalDataset[naturalName], sqZero);
3207
+ naturalDataset[naturalName] = addAccessors(naturalDataset[naturalName], sqZero);
3206
3208
  } else {
3207
3209
  naturalDataset[naturalName] = sqZero;
3208
3210
  }
@@ -3470,7 +3472,7 @@ var DicomMessage = /*#__PURE__*/function () {
3470
3472
  if (cleanTagString === "00080005") {
3471
3473
  if (readInfo.values.length > 0) {
3472
3474
  var coding = readInfo.values[0];
3473
- coding = coding.replaceAll("_", "-").replaceAll(" ", "-").toLowerCase();
3475
+ coding = coding.replace(/[_ ]/g, "-").toLowerCase();
3474
3476
 
3475
3477
  if (coding in encodingMapping) {
3476
3478
  coding = encodingMapping[coding];
@@ -7296,25 +7298,25 @@ var TID1500MeasurementReport = /*#__PURE__*/function () {
7296
7298
  ContentSequence: [{
7297
7299
  RelationshipType: "HAS CONCEPT MOD",
7298
7300
  ValueType: "CODE",
7299
- ConceptNameCodeSequence: addAccessors$1({
7301
+ ConceptNameCodeSequence: addAccessors({
7300
7302
  CodeValue: "121049",
7301
7303
  CodingSchemeDesignator: "DCM",
7302
7304
  CodeMeaning: "Language of Content Item and Descendants"
7303
7305
  }),
7304
- ConceptCodeSequence: addAccessors$1({
7306
+ ConceptCodeSequence: addAccessors({
7305
7307
  CodeValue: "eng",
7306
7308
  CodingSchemeDesignator: "RFC5646",
7307
7309
  CodeMeaning: "English"
7308
7310
  }),
7309
- ContentSequence: addAccessors$1({
7311
+ ContentSequence: addAccessors({
7310
7312
  RelationshipType: "HAS CONCEPT MOD",
7311
7313
  ValueType: "CODE",
7312
- ConceptNameCodeSequence: addAccessors$1({
7314
+ ConceptNameCodeSequence: addAccessors({
7313
7315
  CodeValue: "121046",
7314
7316
  CodingSchemeDesignator: "DCM",
7315
7317
  CodeMeaning: "Country of Language"
7316
7318
  }),
7317
- ConceptCodeSequence: addAccessors$1({
7319
+ ConceptCodeSequence: addAccessors({
7318
7320
  CodeValue: "US",
7319
7321
  CodingSchemeDesignator: "ISO3166_1",
7320
7322
  CodeMeaning: "United States"
@@ -7323,12 +7325,12 @@ var TID1500MeasurementReport = /*#__PURE__*/function () {
7323
7325
  }, this.PersonObserverName, {
7324
7326
  RelationshipType: "HAS CONCEPT MOD",
7325
7327
  ValueType: "CODE",
7326
- ConceptNameCodeSequence: addAccessors$1({
7328
+ ConceptNameCodeSequence: addAccessors({
7327
7329
  CodeValue: "121058",
7328
7330
  CodingSchemeDesignator: "DCM",
7329
7331
  CodeMeaning: "Procedure reported"
7330
7332
  }),
7331
- ConceptCodeSequence: addAccessors$1({
7333
+ ConceptCodeSequence: addAccessors({
7332
7334
  CodeValue: "1",
7333
7335
  CodingSchemeDesignator: "99dcmjs",
7334
7336
  CodeMeaning: "Unknown procedure"
@@ -7839,12 +7841,12 @@ var TID300Measurement = /*#__PURE__*/function () {
7839
7841
  return [{
7840
7842
  RelationshipType: "CONTAINS",
7841
7843
  ValueType: "CODE",
7842
- ConceptNameCodeSequence: addAccessors$1({
7844
+ ConceptNameCodeSequence: addAccessors({
7843
7845
  CodeValue: "121071",
7844
7846
  CodingSchemeDesignator: "DCM",
7845
7847
  CodeMeaning: "Finding"
7846
7848
  }),
7847
- ConceptCodeSequence: addAccessors$1({
7849
+ ConceptCodeSequence: addAccessors({
7848
7850
  CodeValue: CodeValue,
7849
7851
  //: "SAMPLE FINDING",
7850
7852
  CodingSchemeDesignator: CodingSchemeDesignator,
@@ -7865,12 +7867,12 @@ var TID300Measurement = /*#__PURE__*/function () {
7865
7867
  return {
7866
7868
  RelationshipType: "CONTAINS",
7867
7869
  ValueType: "CODE",
7868
- ConceptNameCodeSequence: addAccessors$1({
7870
+ ConceptNameCodeSequence: addAccessors({
7869
7871
  CodeValue: "363698007",
7870
7872
  CodingSchemeDesignator: "SCT",
7871
7873
  CodeMeaning: "Finding Site"
7872
7874
  }),
7873
- ConceptCodeSequence: addAccessors$1({
7875
+ ConceptCodeSequence: addAccessors({
7874
7876
  CodeValue: CodeValue,
7875
7877
  //: "SAMPLE FINDING SITE",
7876
7878
  CodingSchemeDesignator: CodingSchemeDesignator,
@@ -16998,7 +17000,7 @@ var utilities = {
16998
17000
  TID1500: TID1500,
16999
17001
  TID300: TID300,
17000
17002
  message: message,
17001
- addAccessors: addAccessors$1
17003
+ addAccessors: addAccessors
17002
17004
  };
17003
17005
 
17004
17006
  var Code = /*#__PURE__*/function () {