dcmjs 0.33.1 → 0.34.0
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 +458 -260
- package/build/dcmjs.es.js.map +1 -1
- package/build/dcmjs.js +458 -260
- package/build/dcmjs.js.map +1 -1
- package/package.json +1 -1
- package/test/data.test.js +250 -2
- package/test/lossless-read-write.test.js +614 -0
- package/test/utilities/deepEqual.test.js +78 -0
package/build/dcmjs.es.js
CHANGED
|
@@ -8502,7 +8502,7 @@ function toWindows(inputArray, size) {
|
|
|
8502
8502
|
|
|
8503
8503
|
var DicomMessage$3, Tag$1;
|
|
8504
8504
|
var binaryVRs = ["FL", "FD", "SL", "SS", "UL", "US", "AT"],
|
|
8505
|
-
explicitVRs = ["OB", "OW", "OF", "SQ", "UC", "UR", "UT", "UN"],
|
|
8505
|
+
explicitVRs = ["OB", "OW", "OF", "SQ", "UC", "UR", "UT", "UN", "OD"],
|
|
8506
8506
|
singleVRs$1 = ["SQ", "OF", "OW", "OB", "UN"];
|
|
8507
8507
|
var ValueRepresentation = /*#__PURE__*/function () {
|
|
8508
8508
|
function ValueRepresentation(type) {
|
|
@@ -8512,6 +8512,7 @@ var ValueRepresentation = /*#__PURE__*/function () {
|
|
|
8512
8512
|
this._isBinary = binaryVRs.indexOf(this.type) != -1;
|
|
8513
8513
|
this._allowMultiple = !this._isBinary && singleVRs$1.indexOf(this.type) == -1;
|
|
8514
8514
|
this._isExplicit = explicitVRs.indexOf(this.type) != -1;
|
|
8515
|
+
this._storeRaw = true;
|
|
8515
8516
|
}
|
|
8516
8517
|
_createClass(ValueRepresentation, [{
|
|
8517
8518
|
key: "isBinary",
|
|
@@ -8528,6 +8529,19 @@ var ValueRepresentation = /*#__PURE__*/function () {
|
|
|
8528
8529
|
value: function isExplicit() {
|
|
8529
8530
|
return this._isExplicit;
|
|
8530
8531
|
}
|
|
8532
|
+
|
|
8533
|
+
/**
|
|
8534
|
+
* Flag that specifies whether to store the original unformatted value that is read from the dicom input buffer.
|
|
8535
|
+
* The `_rawValue` is used for lossless round trip processing, which preserves data (whitespace, special chars) on write
|
|
8536
|
+
* that may be lost after casting to other data structures like Number, or applying formatting for readability.
|
|
8537
|
+
*
|
|
8538
|
+
* Example DecimalString: _rawValue: ["-0.000"], Value: [0]
|
|
8539
|
+
*/
|
|
8540
|
+
}, {
|
|
8541
|
+
key: "storeRaw",
|
|
8542
|
+
value: function storeRaw() {
|
|
8543
|
+
return this._storeRaw;
|
|
8544
|
+
}
|
|
8531
8545
|
}, {
|
|
8532
8546
|
key: "addValueAccessors",
|
|
8533
8547
|
value: function addValueAccessors(value) {
|
|
@@ -8544,11 +8558,29 @@ var ValueRepresentation = /*#__PURE__*/function () {
|
|
|
8544
8558
|
}, {
|
|
8545
8559
|
key: "read",
|
|
8546
8560
|
value: function read(stream, length, syntax) {
|
|
8561
|
+
var readOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
|
|
8562
|
+
forceStoreRaw: false
|
|
8563
|
+
};
|
|
8547
8564
|
if (this.fixed && this.maxLength) {
|
|
8548
8565
|
if (!length) return this.defaultValue;
|
|
8549
8566
|
if (this.maxLength != length) log.error("Invalid length for fixed length tag, vr " + this.type + ", length " + this.maxLength + " != " + length);
|
|
8550
8567
|
}
|
|
8551
|
-
|
|
8568
|
+
var rawValue = this.readBytes(stream, length, syntax);
|
|
8569
|
+
var value = this.applyFormatting(rawValue);
|
|
8570
|
+
|
|
8571
|
+
// avoid duplicating large binary data structures like pixel data which are unlikely to be formatted or directly manipulated
|
|
8572
|
+
if (!this.storeRaw() && !readOptions.forceStoreRaw) {
|
|
8573
|
+
rawValue = undefined;
|
|
8574
|
+
}
|
|
8575
|
+
return {
|
|
8576
|
+
rawValue: rawValue,
|
|
8577
|
+
value: value
|
|
8578
|
+
};
|
|
8579
|
+
}
|
|
8580
|
+
}, {
|
|
8581
|
+
key: "applyFormatting",
|
|
8582
|
+
value: function applyFormatting(value) {
|
|
8583
|
+
return value;
|
|
8552
8584
|
}
|
|
8553
8585
|
}, {
|
|
8554
8586
|
key: "readBytes",
|
|
@@ -8759,8 +8791,11 @@ var BinaryRepresentation = /*#__PURE__*/function (_ValueRepresentation3) {
|
|
|
8759
8791
|
_inherits(BinaryRepresentation, _ValueRepresentation3);
|
|
8760
8792
|
var _super3 = _createSuper(BinaryRepresentation);
|
|
8761
8793
|
function BinaryRepresentation(type) {
|
|
8794
|
+
var _this;
|
|
8762
8795
|
_classCallCheck(this, BinaryRepresentation);
|
|
8763
|
-
|
|
8796
|
+
_this = _super3.call(this, type);
|
|
8797
|
+
_this._storeRaw = false;
|
|
8798
|
+
return _this;
|
|
8764
8799
|
}
|
|
8765
8800
|
_createClass(BinaryRepresentation, [{
|
|
8766
8801
|
key: "writeBytes",
|
|
@@ -8961,17 +8996,22 @@ var ApplicationEntity = /*#__PURE__*/function (_AsciiStringRepresent) {
|
|
|
8961
8996
|
_inherits(ApplicationEntity, _AsciiStringRepresent);
|
|
8962
8997
|
var _super4 = _createSuper(ApplicationEntity);
|
|
8963
8998
|
function ApplicationEntity() {
|
|
8964
|
-
var
|
|
8999
|
+
var _this2;
|
|
8965
9000
|
_classCallCheck(this, ApplicationEntity);
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
return
|
|
9001
|
+
_this2 = _super4.call(this, "AE");
|
|
9002
|
+
_this2.maxLength = 16;
|
|
9003
|
+
_this2.padByte = PADDING_SPACE;
|
|
9004
|
+
return _this2;
|
|
8970
9005
|
}
|
|
8971
9006
|
_createClass(ApplicationEntity, [{
|
|
8972
9007
|
key: "readBytes",
|
|
8973
9008
|
value: function readBytes(stream, length) {
|
|
8974
|
-
return stream.readAsciiString(length)
|
|
9009
|
+
return stream.readAsciiString(length);
|
|
9010
|
+
}
|
|
9011
|
+
}, {
|
|
9012
|
+
key: "applyFormatting",
|
|
9013
|
+
value: function applyFormatting(value) {
|
|
9014
|
+
return value.trim();
|
|
8975
9015
|
}
|
|
8976
9016
|
}]);
|
|
8977
9017
|
return ApplicationEntity;
|
|
@@ -8980,17 +9020,31 @@ var CodeString = /*#__PURE__*/function (_AsciiStringRepresent2) {
|
|
|
8980
9020
|
_inherits(CodeString, _AsciiStringRepresent2);
|
|
8981
9021
|
var _super5 = _createSuper(CodeString);
|
|
8982
9022
|
function CodeString() {
|
|
8983
|
-
var
|
|
9023
|
+
var _this3;
|
|
8984
9024
|
_classCallCheck(this, CodeString);
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
return
|
|
9025
|
+
_this3 = _super5.call(this, "CS");
|
|
9026
|
+
_this3.maxLength = 16;
|
|
9027
|
+
_this3.padByte = PADDING_SPACE;
|
|
9028
|
+
return _this3;
|
|
8989
9029
|
}
|
|
8990
9030
|
_createClass(CodeString, [{
|
|
8991
9031
|
key: "readBytes",
|
|
8992
9032
|
value: function readBytes(stream, length) {
|
|
8993
|
-
|
|
9033
|
+
var BACKSLASH = String.fromCharCode(VM_DELIMITER);
|
|
9034
|
+
return stream.readAsciiString(length).split(BACKSLASH);
|
|
9035
|
+
}
|
|
9036
|
+
}, {
|
|
9037
|
+
key: "applyFormatting",
|
|
9038
|
+
value: function applyFormatting(value) {
|
|
9039
|
+
var trim = function trim(str) {
|
|
9040
|
+
return str.trim();
|
|
9041
|
+
};
|
|
9042
|
+
if (Array.isArray(value)) {
|
|
9043
|
+
return value.map(function (str) {
|
|
9044
|
+
return trim(str);
|
|
9045
|
+
});
|
|
9046
|
+
}
|
|
9047
|
+
return trim(value);
|
|
8994
9048
|
}
|
|
8995
9049
|
}]);
|
|
8996
9050
|
return CodeString;
|
|
@@ -8999,14 +9053,14 @@ var AgeString = /*#__PURE__*/function (_AsciiStringRepresent3) {
|
|
|
8999
9053
|
_inherits(AgeString, _AsciiStringRepresent3);
|
|
9000
9054
|
var _super6 = _createSuper(AgeString);
|
|
9001
9055
|
function AgeString() {
|
|
9002
|
-
var
|
|
9056
|
+
var _this4;
|
|
9003
9057
|
_classCallCheck(this, AgeString);
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
return
|
|
9058
|
+
_this4 = _super6.call(this, "AS");
|
|
9059
|
+
_this4.maxLength = 4;
|
|
9060
|
+
_this4.padByte = PADDING_SPACE;
|
|
9061
|
+
_this4.fixed = true;
|
|
9062
|
+
_this4.defaultValue = "";
|
|
9063
|
+
return _this4;
|
|
9010
9064
|
}
|
|
9011
9065
|
return _createClass(AgeString);
|
|
9012
9066
|
}(AsciiStringRepresentation);
|
|
@@ -9014,14 +9068,14 @@ var AttributeTag = /*#__PURE__*/function (_ValueRepresentation4) {
|
|
|
9014
9068
|
_inherits(AttributeTag, _ValueRepresentation4);
|
|
9015
9069
|
var _super7 = _createSuper(AttributeTag);
|
|
9016
9070
|
function AttributeTag() {
|
|
9017
|
-
var
|
|
9071
|
+
var _this5;
|
|
9018
9072
|
_classCallCheck(this, AttributeTag);
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
return
|
|
9073
|
+
_this5 = _super7.call(this, "AT");
|
|
9074
|
+
_this5.maxLength = 4;
|
|
9075
|
+
_this5.valueLength = 4;
|
|
9076
|
+
_this5.padByte = PADDING_NULL;
|
|
9077
|
+
_this5.fixed = true;
|
|
9078
|
+
return _this5;
|
|
9025
9079
|
}
|
|
9026
9080
|
_createClass(AttributeTag, [{
|
|
9027
9081
|
key: "readBytes",
|
|
@@ -9040,14 +9094,14 @@ var DateValue = /*#__PURE__*/function (_AsciiStringRepresent4) {
|
|
|
9040
9094
|
_inherits(DateValue, _AsciiStringRepresent4);
|
|
9041
9095
|
var _super8 = _createSuper(DateValue);
|
|
9042
9096
|
function DateValue(value) {
|
|
9043
|
-
var
|
|
9097
|
+
var _this6;
|
|
9044
9098
|
_classCallCheck(this, DateValue);
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9099
|
+
_this6 = _super8.call(this, "DA", value);
|
|
9100
|
+
_this6.maxLength = 18;
|
|
9101
|
+
_this6.padByte = PADDING_SPACE;
|
|
9048
9102
|
//this.fixed = true;
|
|
9049
|
-
|
|
9050
|
-
return
|
|
9103
|
+
_this6.defaultValue = "";
|
|
9104
|
+
return _this6;
|
|
9051
9105
|
}
|
|
9052
9106
|
return _createClass(DateValue);
|
|
9053
9107
|
}(AsciiStringRepresentation);
|
|
@@ -9055,33 +9109,39 @@ var DecimalString = /*#__PURE__*/function (_AsciiStringRepresent5) {
|
|
|
9055
9109
|
_inherits(DecimalString, _AsciiStringRepresent5);
|
|
9056
9110
|
var _super9 = _createSuper(DecimalString);
|
|
9057
9111
|
function DecimalString() {
|
|
9058
|
-
var
|
|
9112
|
+
var _this7;
|
|
9059
9113
|
_classCallCheck(this, DecimalString);
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
return
|
|
9114
|
+
_this7 = _super9.call(this, "DS");
|
|
9115
|
+
_this7.maxLength = 16;
|
|
9116
|
+
_this7.padByte = PADDING_SPACE;
|
|
9117
|
+
return _this7;
|
|
9064
9118
|
}
|
|
9065
9119
|
_createClass(DecimalString, [{
|
|
9066
9120
|
key: "readBytes",
|
|
9067
9121
|
value: function readBytes(stream, length) {
|
|
9068
9122
|
var BACKSLASH = String.fromCharCode(VM_DELIMITER);
|
|
9069
9123
|
var ds = stream.readAsciiString(length);
|
|
9070
|
-
ds = ds.replace(/[^0-9.\\\-+e]/gi, "");
|
|
9071
9124
|
if (ds.indexOf(BACKSLASH) !== -1) {
|
|
9072
9125
|
// handle decimal string with multiplicity
|
|
9073
|
-
|
|
9074
|
-
ds = dsArray.map(function (ds) {
|
|
9075
|
-
return ds === "" ? null : Number(ds);
|
|
9076
|
-
});
|
|
9077
|
-
} else {
|
|
9078
|
-
ds = [ds === "" ? null : Number(ds)];
|
|
9126
|
+
return ds.split(BACKSLASH);
|
|
9079
9127
|
}
|
|
9080
|
-
return ds;
|
|
9128
|
+
return [ds];
|
|
9081
9129
|
}
|
|
9082
9130
|
}, {
|
|
9083
|
-
key: "
|
|
9084
|
-
value: function
|
|
9131
|
+
key: "applyFormatting",
|
|
9132
|
+
value: function applyFormatting(value) {
|
|
9133
|
+
var formatNumber = function formatNumber(numberStr) {
|
|
9134
|
+
var returnVal = numberStr.trim().replace(/[^0-9.\\\-+e]/gi, "");
|
|
9135
|
+
return returnVal === "" ? null : Number(returnVal);
|
|
9136
|
+
};
|
|
9137
|
+
if (Array.isArray(value)) {
|
|
9138
|
+
return value.map(formatNumber);
|
|
9139
|
+
}
|
|
9140
|
+
return formatNumber(value);
|
|
9141
|
+
}
|
|
9142
|
+
}, {
|
|
9143
|
+
key: "convertToString",
|
|
9144
|
+
value: function convertToString(value) {
|
|
9085
9145
|
if (value === null) return "";
|
|
9086
9146
|
var str = String(value);
|
|
9087
9147
|
if (str.length > this.maxLength) {
|
|
@@ -9116,10 +9176,10 @@ var DecimalString = /*#__PURE__*/function (_AsciiStringRepresent5) {
|
|
|
9116
9176
|
}, {
|
|
9117
9177
|
key: "writeBytes",
|
|
9118
9178
|
value: function writeBytes(stream, value, writeOptions) {
|
|
9119
|
-
var
|
|
9179
|
+
var _this8 = this;
|
|
9120
9180
|
var val = Array.isArray(value) ? value.map(function (ds) {
|
|
9121
|
-
return
|
|
9122
|
-
}) : [this.
|
|
9181
|
+
return _this8.convertToString(ds);
|
|
9182
|
+
}) : [this.convertToString(value)];
|
|
9123
9183
|
return _get(_getPrototypeOf(DecimalString.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
|
|
9124
9184
|
}
|
|
9125
9185
|
}]);
|
|
@@ -9129,12 +9189,12 @@ var DateTime = /*#__PURE__*/function (_AsciiStringRepresent6) {
|
|
|
9129
9189
|
_inherits(DateTime, _AsciiStringRepresent6);
|
|
9130
9190
|
var _super10 = _createSuper(DateTime);
|
|
9131
9191
|
function DateTime() {
|
|
9132
|
-
var
|
|
9192
|
+
var _this9;
|
|
9133
9193
|
_classCallCheck(this, DateTime);
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
return
|
|
9194
|
+
_this9 = _super10.call(this, "DT");
|
|
9195
|
+
_this9.maxLength = 26;
|
|
9196
|
+
_this9.padByte = PADDING_SPACE;
|
|
9197
|
+
return _this9;
|
|
9138
9198
|
}
|
|
9139
9199
|
return _createClass(DateTime);
|
|
9140
9200
|
}(AsciiStringRepresentation);
|
|
@@ -9142,19 +9202,24 @@ var FloatingPointSingle = /*#__PURE__*/function (_ValueRepresentation5) {
|
|
|
9142
9202
|
_inherits(FloatingPointSingle, _ValueRepresentation5);
|
|
9143
9203
|
var _super11 = _createSuper(FloatingPointSingle);
|
|
9144
9204
|
function FloatingPointSingle() {
|
|
9145
|
-
var
|
|
9205
|
+
var _this10;
|
|
9146
9206
|
_classCallCheck(this, FloatingPointSingle);
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
|
|
9152
|
-
return
|
|
9207
|
+
_this10 = _super11.call(this, "FL");
|
|
9208
|
+
_this10.maxLength = 4;
|
|
9209
|
+
_this10.padByte = PADDING_NULL;
|
|
9210
|
+
_this10.fixed = true;
|
|
9211
|
+
_this10.defaultValue = 0.0;
|
|
9212
|
+
return _this10;
|
|
9153
9213
|
}
|
|
9154
9214
|
_createClass(FloatingPointSingle, [{
|
|
9155
9215
|
key: "readBytes",
|
|
9156
9216
|
value: function readBytes(stream) {
|
|
9157
|
-
return
|
|
9217
|
+
return stream.readFloat();
|
|
9218
|
+
}
|
|
9219
|
+
}, {
|
|
9220
|
+
key: "applyFormatting",
|
|
9221
|
+
value: function applyFormatting(value) {
|
|
9222
|
+
return Number(value);
|
|
9158
9223
|
}
|
|
9159
9224
|
}, {
|
|
9160
9225
|
key: "writeBytes",
|
|
@@ -9168,19 +9233,24 @@ var FloatingPointDouble = /*#__PURE__*/function (_ValueRepresentation6) {
|
|
|
9168
9233
|
_inherits(FloatingPointDouble, _ValueRepresentation6);
|
|
9169
9234
|
var _super12 = _createSuper(FloatingPointDouble);
|
|
9170
9235
|
function FloatingPointDouble() {
|
|
9171
|
-
var
|
|
9236
|
+
var _this11;
|
|
9172
9237
|
_classCallCheck(this, FloatingPointDouble);
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
return
|
|
9238
|
+
_this11 = _super12.call(this, "FD");
|
|
9239
|
+
_this11.maxLength = 8;
|
|
9240
|
+
_this11.padByte = PADDING_NULL;
|
|
9241
|
+
_this11.fixed = true;
|
|
9242
|
+
_this11.defaultValue = 0.0;
|
|
9243
|
+
return _this11;
|
|
9179
9244
|
}
|
|
9180
9245
|
_createClass(FloatingPointDouble, [{
|
|
9181
9246
|
key: "readBytes",
|
|
9182
9247
|
value: function readBytes(stream) {
|
|
9183
|
-
return
|
|
9248
|
+
return stream.readDouble();
|
|
9249
|
+
}
|
|
9250
|
+
}, {
|
|
9251
|
+
key: "applyFormatting",
|
|
9252
|
+
value: function applyFormatting(value) {
|
|
9253
|
+
return Number(value);
|
|
9184
9254
|
}
|
|
9185
9255
|
}, {
|
|
9186
9256
|
key: "writeBytes",
|
|
@@ -9194,42 +9264,48 @@ var IntegerString = /*#__PURE__*/function (_AsciiStringRepresent7) {
|
|
|
9194
9264
|
_inherits(IntegerString, _AsciiStringRepresent7);
|
|
9195
9265
|
var _super13 = _createSuper(IntegerString);
|
|
9196
9266
|
function IntegerString() {
|
|
9197
|
-
var
|
|
9267
|
+
var _this12;
|
|
9198
9268
|
_classCallCheck(this, IntegerString);
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
return
|
|
9269
|
+
_this12 = _super13.call(this, "IS");
|
|
9270
|
+
_this12.maxLength = 12;
|
|
9271
|
+
_this12.padByte = PADDING_SPACE;
|
|
9272
|
+
return _this12;
|
|
9203
9273
|
}
|
|
9204
9274
|
_createClass(IntegerString, [{
|
|
9205
9275
|
key: "readBytes",
|
|
9206
9276
|
value: function readBytes(stream, length) {
|
|
9207
9277
|
var BACKSLASH = String.fromCharCode(VM_DELIMITER);
|
|
9208
|
-
var is = stream.readAsciiString(length)
|
|
9209
|
-
is = is.replace(/[^0-9.\\\-+e]/gi, "");
|
|
9278
|
+
var is = stream.readAsciiString(length);
|
|
9210
9279
|
if (is.indexOf(BACKSLASH) !== -1) {
|
|
9211
9280
|
// handle integer string with multiplicity
|
|
9212
|
-
|
|
9213
|
-
|
|
9214
|
-
|
|
9215
|
-
|
|
9216
|
-
|
|
9217
|
-
|
|
9281
|
+
return is.split(BACKSLASH);
|
|
9282
|
+
}
|
|
9283
|
+
return [is];
|
|
9284
|
+
}
|
|
9285
|
+
}, {
|
|
9286
|
+
key: "applyFormatting",
|
|
9287
|
+
value: function applyFormatting(value) {
|
|
9288
|
+
var formatNumber = function formatNumber(numberStr) {
|
|
9289
|
+
var returnVal = numberStr.trim().replace(/[^0-9.\\\-+e]/gi, "");
|
|
9290
|
+
return returnVal === "" ? null : Number(returnVal);
|
|
9291
|
+
};
|
|
9292
|
+
if (Array.isArray(value)) {
|
|
9293
|
+
return value.map(formatNumber);
|
|
9218
9294
|
}
|
|
9219
|
-
return
|
|
9295
|
+
return formatNumber(value);
|
|
9220
9296
|
}
|
|
9221
9297
|
}, {
|
|
9222
|
-
key: "
|
|
9223
|
-
value: function
|
|
9298
|
+
key: "convertToString",
|
|
9299
|
+
value: function convertToString(value) {
|
|
9224
9300
|
return value === null ? "" : String(value);
|
|
9225
9301
|
}
|
|
9226
9302
|
}, {
|
|
9227
9303
|
key: "writeBytes",
|
|
9228
9304
|
value: function writeBytes(stream, value, writeOptions) {
|
|
9229
|
-
var
|
|
9305
|
+
var _this13 = this;
|
|
9230
9306
|
var val = Array.isArray(value) ? value.map(function (is) {
|
|
9231
|
-
return
|
|
9232
|
-
}) : [this.
|
|
9307
|
+
return _this13.convertToString(is);
|
|
9308
|
+
}) : [this.convertToString(value)];
|
|
9233
9309
|
return _get(_getPrototypeOf(IntegerString.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
|
|
9234
9310
|
}
|
|
9235
9311
|
}]);
|
|
@@ -9239,17 +9315,22 @@ var LongString = /*#__PURE__*/function (_EncodedStringReprese) {
|
|
|
9239
9315
|
_inherits(LongString, _EncodedStringReprese);
|
|
9240
9316
|
var _super14 = _createSuper(LongString);
|
|
9241
9317
|
function LongString() {
|
|
9242
|
-
var
|
|
9318
|
+
var _this14;
|
|
9243
9319
|
_classCallCheck(this, LongString);
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
return
|
|
9320
|
+
_this14 = _super14.call(this, "LO");
|
|
9321
|
+
_this14.maxCharLength = 64;
|
|
9322
|
+
_this14.padByte = PADDING_SPACE;
|
|
9323
|
+
return _this14;
|
|
9248
9324
|
}
|
|
9249
9325
|
_createClass(LongString, [{
|
|
9250
9326
|
key: "readBytes",
|
|
9251
9327
|
value: function readBytes(stream, length) {
|
|
9252
|
-
return stream.readEncodedString(length)
|
|
9328
|
+
return stream.readEncodedString(length);
|
|
9329
|
+
}
|
|
9330
|
+
}, {
|
|
9331
|
+
key: "applyFormatting",
|
|
9332
|
+
value: function applyFormatting(value) {
|
|
9333
|
+
return value.trim();
|
|
9253
9334
|
}
|
|
9254
9335
|
}]);
|
|
9255
9336
|
return LongString;
|
|
@@ -9258,17 +9339,22 @@ var LongText = /*#__PURE__*/function (_EncodedStringReprese2) {
|
|
|
9258
9339
|
_inherits(LongText, _EncodedStringReprese2);
|
|
9259
9340
|
var _super15 = _createSuper(LongText);
|
|
9260
9341
|
function LongText() {
|
|
9261
|
-
var
|
|
9342
|
+
var _this15;
|
|
9262
9343
|
_classCallCheck(this, LongText);
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
return
|
|
9344
|
+
_this15 = _super15.call(this, "LT");
|
|
9345
|
+
_this15.maxCharLength = 10240;
|
|
9346
|
+
_this15.padByte = PADDING_SPACE;
|
|
9347
|
+
return _this15;
|
|
9267
9348
|
}
|
|
9268
9349
|
_createClass(LongText, [{
|
|
9269
9350
|
key: "readBytes",
|
|
9270
9351
|
value: function readBytes(stream, length) {
|
|
9271
|
-
return
|
|
9352
|
+
return stream.readEncodedString(length);
|
|
9353
|
+
}
|
|
9354
|
+
}, {
|
|
9355
|
+
key: "applyFormatting",
|
|
9356
|
+
value: function applyFormatting(value) {
|
|
9357
|
+
return rtrim(value);
|
|
9272
9358
|
}
|
|
9273
9359
|
}]);
|
|
9274
9360
|
return LongText;
|
|
@@ -9277,12 +9363,12 @@ var PersonName = /*#__PURE__*/function (_EncodedStringReprese3) {
|
|
|
9277
9363
|
_inherits(PersonName, _EncodedStringReprese3);
|
|
9278
9364
|
var _super16 = _createSuper(PersonName);
|
|
9279
9365
|
function PersonName() {
|
|
9280
|
-
var
|
|
9366
|
+
var _this16;
|
|
9281
9367
|
_classCallCheck(this, PersonName);
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
return
|
|
9368
|
+
_this16 = _super16.call(this, "PN");
|
|
9369
|
+
_this16.maxLength = null;
|
|
9370
|
+
_this16.padByte = PADDING_SPACE;
|
|
9371
|
+
return _this16;
|
|
9286
9372
|
}
|
|
9287
9373
|
_createClass(PersonName, [{
|
|
9288
9374
|
key: "addValueAccessors",
|
|
@@ -9356,8 +9442,20 @@ var PersonName = /*#__PURE__*/function (_EncodedStringReprese3) {
|
|
|
9356
9442
|
}, {
|
|
9357
9443
|
key: "readBytes",
|
|
9358
9444
|
value: function readBytes(stream, length) {
|
|
9359
|
-
|
|
9360
|
-
|
|
9445
|
+
return this.readPaddedEncodedString(stream, length).split(String.fromCharCode(VM_DELIMITER));
|
|
9446
|
+
}
|
|
9447
|
+
}, {
|
|
9448
|
+
key: "applyFormatting",
|
|
9449
|
+
value: function applyFormatting(value) {
|
|
9450
|
+
var parsePersonName = function parsePersonName(valueStr) {
|
|
9451
|
+
return dicomJson.pnConvertToJsonObject(valueStr, false);
|
|
9452
|
+
};
|
|
9453
|
+
if (Array.isArray(value)) {
|
|
9454
|
+
return value.map(function (valueStr) {
|
|
9455
|
+
return parsePersonName(valueStr);
|
|
9456
|
+
});
|
|
9457
|
+
}
|
|
9458
|
+
return parsePersonName(value);
|
|
9361
9459
|
}
|
|
9362
9460
|
}, {
|
|
9363
9461
|
key: "writeBytes",
|
|
@@ -9381,17 +9479,22 @@ var ShortString = /*#__PURE__*/function (_EncodedStringReprese4) {
|
|
|
9381
9479
|
_inherits(ShortString, _EncodedStringReprese4);
|
|
9382
9480
|
var _super17 = _createSuper(ShortString);
|
|
9383
9481
|
function ShortString() {
|
|
9384
|
-
var
|
|
9482
|
+
var _this17;
|
|
9385
9483
|
_classCallCheck(this, ShortString);
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
return
|
|
9484
|
+
_this17 = _super17.call(this, "SH");
|
|
9485
|
+
_this17.maxCharLength = 16;
|
|
9486
|
+
_this17.padByte = PADDING_SPACE;
|
|
9487
|
+
return _this17;
|
|
9390
9488
|
}
|
|
9391
9489
|
_createClass(ShortString, [{
|
|
9392
9490
|
key: "readBytes",
|
|
9393
9491
|
value: function readBytes(stream, length) {
|
|
9394
|
-
return stream.readEncodedString(length)
|
|
9492
|
+
return stream.readEncodedString(length);
|
|
9493
|
+
}
|
|
9494
|
+
}, {
|
|
9495
|
+
key: "applyFormatting",
|
|
9496
|
+
value: function applyFormatting(value) {
|
|
9497
|
+
return value.trim();
|
|
9395
9498
|
}
|
|
9396
9499
|
}]);
|
|
9397
9500
|
return ShortString;
|
|
@@ -9400,14 +9503,14 @@ var SignedLong = /*#__PURE__*/function (_ValueRepresentation7) {
|
|
|
9400
9503
|
_inherits(SignedLong, _ValueRepresentation7);
|
|
9401
9504
|
var _super18 = _createSuper(SignedLong);
|
|
9402
9505
|
function SignedLong() {
|
|
9403
|
-
var
|
|
9506
|
+
var _this18;
|
|
9404
9507
|
_classCallCheck(this, SignedLong);
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
|
|
9410
|
-
return
|
|
9508
|
+
_this18 = _super18.call(this, "SL");
|
|
9509
|
+
_this18.maxLength = 4;
|
|
9510
|
+
_this18.padByte = PADDING_NULL;
|
|
9511
|
+
_this18.fixed = true;
|
|
9512
|
+
_this18.defaultValue = 0;
|
|
9513
|
+
return _this18;
|
|
9411
9514
|
}
|
|
9412
9515
|
_createClass(SignedLong, [{
|
|
9413
9516
|
key: "readBytes",
|
|
@@ -9426,13 +9529,14 @@ var SequenceOfItems = /*#__PURE__*/function (_ValueRepresentation8) {
|
|
|
9426
9529
|
_inherits(SequenceOfItems, _ValueRepresentation8);
|
|
9427
9530
|
var _super19 = _createSuper(SequenceOfItems);
|
|
9428
9531
|
function SequenceOfItems() {
|
|
9429
|
-
var
|
|
9532
|
+
var _this19;
|
|
9430
9533
|
_classCallCheck(this, SequenceOfItems);
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
|
|
9435
|
-
|
|
9534
|
+
_this19 = _super19.call(this, "SQ");
|
|
9535
|
+
_this19.maxLength = null;
|
|
9536
|
+
_this19.padByte = PADDING_NULL;
|
|
9537
|
+
_this19.noMultiple = true;
|
|
9538
|
+
_this19._storeRaw = false;
|
|
9539
|
+
return _this19;
|
|
9436
9540
|
}
|
|
9437
9541
|
_createClass(SequenceOfItems, [{
|
|
9438
9542
|
key: "readBytes",
|
|
@@ -9554,15 +9658,15 @@ var SignedShort = /*#__PURE__*/function (_ValueRepresentation9) {
|
|
|
9554
9658
|
_inherits(SignedShort, _ValueRepresentation9);
|
|
9555
9659
|
var _super20 = _createSuper(SignedShort);
|
|
9556
9660
|
function SignedShort() {
|
|
9557
|
-
var
|
|
9661
|
+
var _this20;
|
|
9558
9662
|
_classCallCheck(this, SignedShort);
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
return
|
|
9663
|
+
_this20 = _super20.call(this, "SS");
|
|
9664
|
+
_this20.maxLength = 2;
|
|
9665
|
+
_this20.valueLength = 2;
|
|
9666
|
+
_this20.padByte = PADDING_NULL;
|
|
9667
|
+
_this20.fixed = true;
|
|
9668
|
+
_this20.defaultValue = 0;
|
|
9669
|
+
return _this20;
|
|
9566
9670
|
}
|
|
9567
9671
|
_createClass(SignedShort, [{
|
|
9568
9672
|
key: "readBytes",
|
|
@@ -9581,17 +9685,22 @@ var ShortText = /*#__PURE__*/function (_EncodedStringReprese5) {
|
|
|
9581
9685
|
_inherits(ShortText, _EncodedStringReprese5);
|
|
9582
9686
|
var _super21 = _createSuper(ShortText);
|
|
9583
9687
|
function ShortText() {
|
|
9584
|
-
var
|
|
9688
|
+
var _this21;
|
|
9585
9689
|
_classCallCheck(this, ShortText);
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
return
|
|
9690
|
+
_this21 = _super21.call(this, "ST");
|
|
9691
|
+
_this21.maxCharLength = 1024;
|
|
9692
|
+
_this21.padByte = PADDING_SPACE;
|
|
9693
|
+
return _this21;
|
|
9590
9694
|
}
|
|
9591
9695
|
_createClass(ShortText, [{
|
|
9592
9696
|
key: "readBytes",
|
|
9593
9697
|
value: function readBytes(stream, length) {
|
|
9594
|
-
return
|
|
9698
|
+
return stream.readEncodedString(length);
|
|
9699
|
+
}
|
|
9700
|
+
}, {
|
|
9701
|
+
key: "applyFormatting",
|
|
9702
|
+
value: function applyFormatting(value) {
|
|
9703
|
+
return rtrim(value);
|
|
9595
9704
|
}
|
|
9596
9705
|
}]);
|
|
9597
9706
|
return ShortText;
|
|
@@ -9600,17 +9709,22 @@ var TimeValue = /*#__PURE__*/function (_AsciiStringRepresent8) {
|
|
|
9600
9709
|
_inherits(TimeValue, _AsciiStringRepresent8);
|
|
9601
9710
|
var _super22 = _createSuper(TimeValue);
|
|
9602
9711
|
function TimeValue() {
|
|
9603
|
-
var
|
|
9712
|
+
var _this22;
|
|
9604
9713
|
_classCallCheck(this, TimeValue);
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
return
|
|
9714
|
+
_this22 = _super22.call(this, "TM");
|
|
9715
|
+
_this22.maxLength = 14;
|
|
9716
|
+
_this22.padByte = PADDING_SPACE;
|
|
9717
|
+
return _this22;
|
|
9609
9718
|
}
|
|
9610
9719
|
_createClass(TimeValue, [{
|
|
9611
9720
|
key: "readBytes",
|
|
9612
9721
|
value: function readBytes(stream, length) {
|
|
9613
|
-
return
|
|
9722
|
+
return stream.readAsciiString(length);
|
|
9723
|
+
}
|
|
9724
|
+
}, {
|
|
9725
|
+
key: "applyFormatting",
|
|
9726
|
+
value: function applyFormatting(value) {
|
|
9727
|
+
return rtrim(value);
|
|
9614
9728
|
}
|
|
9615
9729
|
}]);
|
|
9616
9730
|
return TimeValue;
|
|
@@ -9619,18 +9733,23 @@ var UnlimitedCharacters = /*#__PURE__*/function (_EncodedStringReprese6) {
|
|
|
9619
9733
|
_inherits(UnlimitedCharacters, _EncodedStringReprese6);
|
|
9620
9734
|
var _super23 = _createSuper(UnlimitedCharacters);
|
|
9621
9735
|
function UnlimitedCharacters() {
|
|
9622
|
-
var
|
|
9736
|
+
var _this23;
|
|
9623
9737
|
_classCallCheck(this, UnlimitedCharacters);
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
return
|
|
9738
|
+
_this23 = _super23.call(this, "UC");
|
|
9739
|
+
_this23.maxLength = null;
|
|
9740
|
+
_this23.multi = true;
|
|
9741
|
+
_this23.padByte = PADDING_SPACE;
|
|
9742
|
+
return _this23;
|
|
9629
9743
|
}
|
|
9630
9744
|
_createClass(UnlimitedCharacters, [{
|
|
9631
9745
|
key: "readBytes",
|
|
9632
9746
|
value: function readBytes(stream, length) {
|
|
9633
|
-
return
|
|
9747
|
+
return stream.readEncodedString(length);
|
|
9748
|
+
}
|
|
9749
|
+
}, {
|
|
9750
|
+
key: "applyFormatting",
|
|
9751
|
+
value: function applyFormatting(value) {
|
|
9752
|
+
return rtrim(value);
|
|
9634
9753
|
}
|
|
9635
9754
|
}]);
|
|
9636
9755
|
return UnlimitedCharacters;
|
|
@@ -9639,17 +9758,22 @@ var UnlimitedText = /*#__PURE__*/function (_EncodedStringReprese7) {
|
|
|
9639
9758
|
_inherits(UnlimitedText, _EncodedStringReprese7);
|
|
9640
9759
|
var _super24 = _createSuper(UnlimitedText);
|
|
9641
9760
|
function UnlimitedText() {
|
|
9642
|
-
var
|
|
9761
|
+
var _this24;
|
|
9643
9762
|
_classCallCheck(this, UnlimitedText);
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
return
|
|
9763
|
+
_this24 = _super24.call(this, "UT");
|
|
9764
|
+
_this24.maxLength = null;
|
|
9765
|
+
_this24.padByte = PADDING_SPACE;
|
|
9766
|
+
return _this24;
|
|
9648
9767
|
}
|
|
9649
9768
|
_createClass(UnlimitedText, [{
|
|
9650
9769
|
key: "readBytes",
|
|
9651
9770
|
value: function readBytes(stream, length) {
|
|
9652
|
-
return
|
|
9771
|
+
return stream.readEncodedString(length);
|
|
9772
|
+
}
|
|
9773
|
+
}, {
|
|
9774
|
+
key: "applyFormatting",
|
|
9775
|
+
value: function applyFormatting(value) {
|
|
9776
|
+
return rtrim(value);
|
|
9653
9777
|
}
|
|
9654
9778
|
}]);
|
|
9655
9779
|
return UnlimitedText;
|
|
@@ -9658,14 +9782,14 @@ var UnsignedShort = /*#__PURE__*/function (_ValueRepresentation10) {
|
|
|
9658
9782
|
_inherits(UnsignedShort, _ValueRepresentation10);
|
|
9659
9783
|
var _super25 = _createSuper(UnsignedShort);
|
|
9660
9784
|
function UnsignedShort() {
|
|
9661
|
-
var
|
|
9785
|
+
var _this25;
|
|
9662
9786
|
_classCallCheck(this, UnsignedShort);
|
|
9663
|
-
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
return
|
|
9787
|
+
_this25 = _super25.call(this, "US");
|
|
9788
|
+
_this25.maxLength = 2;
|
|
9789
|
+
_this25.padByte = PADDING_NULL;
|
|
9790
|
+
_this25.fixed = true;
|
|
9791
|
+
_this25.defaultValue = 0;
|
|
9792
|
+
return _this25;
|
|
9669
9793
|
}
|
|
9670
9794
|
_createClass(UnsignedShort, [{
|
|
9671
9795
|
key: "readBytes",
|
|
@@ -9684,14 +9808,14 @@ var UnsignedLong = /*#__PURE__*/function (_ValueRepresentation11) {
|
|
|
9684
9808
|
_inherits(UnsignedLong, _ValueRepresentation11);
|
|
9685
9809
|
var _super26 = _createSuper(UnsignedLong);
|
|
9686
9810
|
function UnsignedLong() {
|
|
9687
|
-
var
|
|
9811
|
+
var _this26;
|
|
9688
9812
|
_classCallCheck(this, UnsignedLong);
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
return
|
|
9813
|
+
_this26 = _super26.call(this, "UL");
|
|
9814
|
+
_this26.maxLength = 4;
|
|
9815
|
+
_this26.padByte = PADDING_NULL;
|
|
9816
|
+
_this26.fixed = true;
|
|
9817
|
+
_this26.defaultValue = 0;
|
|
9818
|
+
return _this26;
|
|
9695
9819
|
}
|
|
9696
9820
|
_createClass(UnsignedLong, [{
|
|
9697
9821
|
key: "readBytes",
|
|
@@ -9710,19 +9834,18 @@ var UniqueIdentifier = /*#__PURE__*/function (_AsciiStringRepresent9) {
|
|
|
9710
9834
|
_inherits(UniqueIdentifier, _AsciiStringRepresent9);
|
|
9711
9835
|
var _super27 = _createSuper(UniqueIdentifier);
|
|
9712
9836
|
function UniqueIdentifier() {
|
|
9713
|
-
var
|
|
9837
|
+
var _this27;
|
|
9714
9838
|
_classCallCheck(this, UniqueIdentifier);
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
return
|
|
9839
|
+
_this27 = _super27.call(this, "UI");
|
|
9840
|
+
_this27.maxLength = 64;
|
|
9841
|
+
_this27.padByte = PADDING_NULL;
|
|
9842
|
+
return _this27;
|
|
9719
9843
|
}
|
|
9720
9844
|
_createClass(UniqueIdentifier, [{
|
|
9721
9845
|
key: "readBytes",
|
|
9722
9846
|
value: function readBytes(stream, length) {
|
|
9723
9847
|
var result = this.readPaddedAsciiString(stream, length);
|
|
9724
9848
|
var BACKSLASH = String.fromCharCode(VM_DELIMITER);
|
|
9725
|
-
var uidRegExp = /[^0-9.]/g;
|
|
9726
9849
|
|
|
9727
9850
|
// Treat backslashes as a delimiter for multiple UIDs, in which case an
|
|
9728
9851
|
// array of UIDs is returned. This is used by DICOM Q&R to support
|
|
@@ -9733,12 +9856,21 @@ var UniqueIdentifier = /*#__PURE__*/function (_AsciiStringRepresent9) {
|
|
|
9733
9856
|
// https://dicom.nema.org/medical/dicom/current/output/chtml/part05/sect_6.4.html
|
|
9734
9857
|
|
|
9735
9858
|
if (result.indexOf(BACKSLASH) === -1) {
|
|
9736
|
-
return result
|
|
9859
|
+
return result;
|
|
9737
9860
|
} else {
|
|
9738
|
-
return result.split(BACKSLASH)
|
|
9739
|
-
|
|
9740
|
-
|
|
9861
|
+
return result.split(BACKSLASH);
|
|
9862
|
+
}
|
|
9863
|
+
}
|
|
9864
|
+
}, {
|
|
9865
|
+
key: "applyFormatting",
|
|
9866
|
+
value: function applyFormatting(value) {
|
|
9867
|
+
var removeInvalidUidChars = function removeInvalidUidChars(uidStr) {
|
|
9868
|
+
return uidStr.replace(/[^0-9.]/g, "");
|
|
9869
|
+
};
|
|
9870
|
+
if (Array.isArray(value)) {
|
|
9871
|
+
return value.map(removeInvalidUidChars);
|
|
9741
9872
|
}
|
|
9873
|
+
return removeInvalidUidChars(value);
|
|
9742
9874
|
}
|
|
9743
9875
|
}]);
|
|
9744
9876
|
return UniqueIdentifier;
|
|
@@ -9747,12 +9879,12 @@ var UniversalResource = /*#__PURE__*/function (_AsciiStringRepresent10) {
|
|
|
9747
9879
|
_inherits(UniversalResource, _AsciiStringRepresent10);
|
|
9748
9880
|
var _super28 = _createSuper(UniversalResource);
|
|
9749
9881
|
function UniversalResource() {
|
|
9750
|
-
var
|
|
9882
|
+
var _this28;
|
|
9751
9883
|
_classCallCheck(this, UniversalResource);
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
return
|
|
9884
|
+
_this28 = _super28.call(this, "UR");
|
|
9885
|
+
_this28.maxLength = null;
|
|
9886
|
+
_this28.padByte = PADDING_SPACE;
|
|
9887
|
+
return _this28;
|
|
9756
9888
|
}
|
|
9757
9889
|
_createClass(UniversalResource, [{
|
|
9758
9890
|
key: "readBytes",
|
|
@@ -9766,13 +9898,13 @@ var UnknownValue = /*#__PURE__*/function (_BinaryRepresentation) {
|
|
|
9766
9898
|
_inherits(UnknownValue, _BinaryRepresentation);
|
|
9767
9899
|
var _super29 = _createSuper(UnknownValue);
|
|
9768
9900
|
function UnknownValue() {
|
|
9769
|
-
var
|
|
9901
|
+
var _this29;
|
|
9770
9902
|
_classCallCheck(this, UnknownValue);
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
return
|
|
9903
|
+
_this29 = _super29.call(this, "UN");
|
|
9904
|
+
_this29.maxLength = null;
|
|
9905
|
+
_this29.padByte = PADDING_NULL;
|
|
9906
|
+
_this29.noMultiple = true;
|
|
9907
|
+
return _this29;
|
|
9776
9908
|
}
|
|
9777
9909
|
return _createClass(UnknownValue);
|
|
9778
9910
|
}(BinaryRepresentation);
|
|
@@ -9780,46 +9912,43 @@ var ParsedUnknownValue = /*#__PURE__*/function (_BinaryRepresentation2) {
|
|
|
9780
9912
|
_inherits(ParsedUnknownValue, _BinaryRepresentation2);
|
|
9781
9913
|
var _super30 = _createSuper(ParsedUnknownValue);
|
|
9782
9914
|
function ParsedUnknownValue(vr) {
|
|
9783
|
-
var
|
|
9915
|
+
var _this30;
|
|
9784
9916
|
_classCallCheck(this, ParsedUnknownValue);
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9917
|
+
_this30 = _super30.call(this, vr);
|
|
9918
|
+
_this30.maxLength = null;
|
|
9919
|
+
_this30.padByte = 0;
|
|
9920
|
+
_this30.noMultiple = true;
|
|
9921
|
+
_this30._isBinary = true;
|
|
9922
|
+
_this30._allowMultiple = false;
|
|
9923
|
+
_this30._isExplicit = true;
|
|
9924
|
+
_this30._storeRaw = true;
|
|
9925
|
+
return _this30;
|
|
9793
9926
|
}
|
|
9794
9927
|
_createClass(ParsedUnknownValue, [{
|
|
9795
9928
|
key: "read",
|
|
9796
|
-
value: function read(stream, length, syntax) {
|
|
9929
|
+
value: function read(stream, length, syntax, readOptions) {
|
|
9797
9930
|
var arrayBuffer = this.readBytes(stream, length, syntax)[0];
|
|
9798
9931
|
var streamFromBuffer = new ReadBufferStream(arrayBuffer, true);
|
|
9799
9932
|
var vr = ValueRepresentation.createByTypeString(this.type);
|
|
9800
|
-
var values = [];
|
|
9801
9933
|
if (vr.isBinary() && length > vr.maxLength && !vr.noMultiple) {
|
|
9934
|
+
var values = [];
|
|
9935
|
+
var rawValues = [];
|
|
9802
9936
|
var times = length / vr.maxLength,
|
|
9803
9937
|
i = 0;
|
|
9804
9938
|
while (i++ < times) {
|
|
9805
|
-
|
|
9939
|
+
var _vr$read = vr.read(streamFromBuffer, vr.maxLength, syntax, readOptions),
|
|
9940
|
+
rawValue = _vr$read.rawValue,
|
|
9941
|
+
value = _vr$read.value;
|
|
9942
|
+
rawValues.push(rawValue);
|
|
9943
|
+
values.push(value);
|
|
9806
9944
|
}
|
|
9945
|
+
return {
|
|
9946
|
+
rawValue: rawValues,
|
|
9947
|
+
value: values
|
|
9948
|
+
};
|
|
9807
9949
|
} else {
|
|
9808
|
-
|
|
9809
|
-
if (!vr.isBinary() && singleVRs$1.indexOf(vr.type) == -1) {
|
|
9810
|
-
values = val;
|
|
9811
|
-
if (typeof val === "string") {
|
|
9812
|
-
values = val.split(String.fromCharCode(VM_DELIMITER));
|
|
9813
|
-
}
|
|
9814
|
-
} else if (vr.type == "SQ") {
|
|
9815
|
-
values = val;
|
|
9816
|
-
} else if (vr.type == "OW" || vr.type == "OB") {
|
|
9817
|
-
values = val;
|
|
9818
|
-
} else {
|
|
9819
|
-
Array.isArray(val) ? values = val : values.push(val);
|
|
9820
|
-
}
|
|
9950
|
+
return vr.read(streamFromBuffer, length, syntax, readOptions);
|
|
9821
9951
|
}
|
|
9822
|
-
return values;
|
|
9823
9952
|
}
|
|
9824
9953
|
}]);
|
|
9825
9954
|
return ParsedUnknownValue;
|
|
@@ -9828,13 +9957,13 @@ var OtherWordString = /*#__PURE__*/function (_BinaryRepresentation3) {
|
|
|
9828
9957
|
_inherits(OtherWordString, _BinaryRepresentation3);
|
|
9829
9958
|
var _super31 = _createSuper(OtherWordString);
|
|
9830
9959
|
function OtherWordString() {
|
|
9831
|
-
var
|
|
9960
|
+
var _this31;
|
|
9832
9961
|
_classCallCheck(this, OtherWordString);
|
|
9833
|
-
|
|
9834
|
-
|
|
9835
|
-
|
|
9836
|
-
|
|
9837
|
-
return
|
|
9962
|
+
_this31 = _super31.call(this, "OW");
|
|
9963
|
+
_this31.maxLength = null;
|
|
9964
|
+
_this31.padByte = PADDING_NULL;
|
|
9965
|
+
_this31.noMultiple = true;
|
|
9966
|
+
return _this31;
|
|
9838
9967
|
}
|
|
9839
9968
|
return _createClass(OtherWordString);
|
|
9840
9969
|
}(BinaryRepresentation);
|
|
@@ -9842,13 +9971,13 @@ var OtherByteString = /*#__PURE__*/function (_BinaryRepresentation4) {
|
|
|
9842
9971
|
_inherits(OtherByteString, _BinaryRepresentation4);
|
|
9843
9972
|
var _super32 = _createSuper(OtherByteString);
|
|
9844
9973
|
function OtherByteString() {
|
|
9845
|
-
var
|
|
9974
|
+
var _this32;
|
|
9846
9975
|
_classCallCheck(this, OtherByteString);
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
return
|
|
9976
|
+
_this32 = _super32.call(this, "OB");
|
|
9977
|
+
_this32.maxLength = null;
|
|
9978
|
+
_this32.padByte = PADDING_NULL;
|
|
9979
|
+
_this32.noMultiple = true;
|
|
9980
|
+
return _this32;
|
|
9852
9981
|
}
|
|
9853
9982
|
return _createClass(OtherByteString);
|
|
9854
9983
|
}(BinaryRepresentation);
|
|
@@ -9856,13 +9985,13 @@ var OtherDoubleString = /*#__PURE__*/function (_BinaryRepresentation5) {
|
|
|
9856
9985
|
_inherits(OtherDoubleString, _BinaryRepresentation5);
|
|
9857
9986
|
var _super33 = _createSuper(OtherDoubleString);
|
|
9858
9987
|
function OtherDoubleString() {
|
|
9859
|
-
var
|
|
9988
|
+
var _this33;
|
|
9860
9989
|
_classCallCheck(this, OtherDoubleString);
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
return
|
|
9990
|
+
_this33 = _super33.call(this, "OD");
|
|
9991
|
+
_this33.maxLength = null;
|
|
9992
|
+
_this33.padByte = PADDING_NULL;
|
|
9993
|
+
_this33.noMultiple = true;
|
|
9994
|
+
return _this33;
|
|
9866
9995
|
}
|
|
9867
9996
|
return _createClass(OtherDoubleString);
|
|
9868
9997
|
}(BinaryRepresentation);
|
|
@@ -9870,13 +9999,13 @@ var OtherFloatString = /*#__PURE__*/function (_BinaryRepresentation6) {
|
|
|
9870
9999
|
_inherits(OtherFloatString, _BinaryRepresentation6);
|
|
9871
10000
|
var _super34 = _createSuper(OtherFloatString);
|
|
9872
10001
|
function OtherFloatString() {
|
|
9873
|
-
var
|
|
10002
|
+
var _this34;
|
|
9874
10003
|
_classCallCheck(this, OtherFloatString);
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
return
|
|
10004
|
+
_this34 = _super34.call(this, "OF");
|
|
10005
|
+
_this34.maxLength = null;
|
|
10006
|
+
_this34.padByte = PADDING_NULL;
|
|
10007
|
+
_this34.noMultiple = true;
|
|
10008
|
+
return _this34;
|
|
9880
10009
|
}
|
|
9881
10010
|
return _createClass(OtherFloatString);
|
|
9882
10011
|
}(BinaryRepresentation); // these VR instances are precreate and are reused for each requested vr/tag
|
|
@@ -10097,6 +10226,40 @@ var Tag = /*#__PURE__*/function () {
|
|
|
10097
10226
|
return Tag;
|
|
10098
10227
|
}();
|
|
10099
10228
|
|
|
10229
|
+
/**
|
|
10230
|
+
* Performs a deep equality check between two objects. Used primarily during DICOM write operations
|
|
10231
|
+
* to determine whether a data element underlying value has changed since it was initially read.
|
|
10232
|
+
*
|
|
10233
|
+
* @param {Object} obj1 - The first object to compare.
|
|
10234
|
+
* @param {Object} obj2 - The second object to compare.
|
|
10235
|
+
* @returns {boolean} - Returns `true` if the structures and values of the objects are deeply equal, `false` otherwise.
|
|
10236
|
+
*/
|
|
10237
|
+
function deepEqual(obj1, obj2) {
|
|
10238
|
+
// Use Object.is to consider for treatment of `NaN` and signed 0's i.e. `+0` or `-0` in IS/DS
|
|
10239
|
+
if (Object.is(obj1, obj2)) {
|
|
10240
|
+
return true;
|
|
10241
|
+
}
|
|
10242
|
+
|
|
10243
|
+
// expect objects or a null instance if initial check failed
|
|
10244
|
+
if (_typeof(obj1) !== 'object' || _typeof(obj2) !== 'object' || obj1 === null || obj2 === null) {
|
|
10245
|
+
return false;
|
|
10246
|
+
}
|
|
10247
|
+
|
|
10248
|
+
// all keys should match a deep equality check
|
|
10249
|
+
var keys1 = Object.keys(obj1);
|
|
10250
|
+
var keys2 = Object.keys(obj2);
|
|
10251
|
+
if (keys1.length !== keys2.length) {
|
|
10252
|
+
return false;
|
|
10253
|
+
}
|
|
10254
|
+
for (var _i = 0, _keys = keys1; _i < _keys.length; _i++) {
|
|
10255
|
+
var key = _keys[_i];
|
|
10256
|
+
if (!keys2.includes(key) || !deepEqual(obj1[key], obj2[key])) {
|
|
10257
|
+
return false;
|
|
10258
|
+
}
|
|
10259
|
+
}
|
|
10260
|
+
return true;
|
|
10261
|
+
}
|
|
10262
|
+
|
|
10100
10263
|
var singleVRs = ["SQ", "OF", "OW", "OB", "UN", "LT"];
|
|
10101
10264
|
var encodingMapping = {
|
|
10102
10265
|
"": "iso-8859-1",
|
|
@@ -10204,6 +10367,7 @@ var DicomMessage = /*#__PURE__*/function () {
|
|
|
10204
10367
|
vr: readInfo.vr.type
|
|
10205
10368
|
});
|
|
10206
10369
|
dict[cleanTagString].Value = readInfo.values;
|
|
10370
|
+
dict[cleanTagString]._rawValue = readInfo.rawValues;
|
|
10207
10371
|
if (untilTag && untilTag === cleanTagString) {
|
|
10208
10372
|
break;
|
|
10209
10373
|
}
|
|
@@ -10238,7 +10402,8 @@ var DicomMessage = /*#__PURE__*/function () {
|
|
|
10238
10402
|
ignoreErrors: false,
|
|
10239
10403
|
untilTag: null,
|
|
10240
10404
|
includeUntilTagValue: false,
|
|
10241
|
-
noCopy: false
|
|
10405
|
+
noCopy: false,
|
|
10406
|
+
forceStoreRaw: false
|
|
10242
10407
|
};
|
|
10243
10408
|
var stream = new ReadBufferStream(buffer, null, {
|
|
10244
10409
|
noCopy: options.noCopy
|
|
@@ -10288,12 +10453,32 @@ var DicomMessage = /*#__PURE__*/function () {
|
|
|
10288
10453
|
sortedTags.forEach(function (tagString) {
|
|
10289
10454
|
var tag = Tag.fromString(tagString),
|
|
10290
10455
|
tagObject = jsonObjects[tagString],
|
|
10291
|
-
vrType = tagObject.vr
|
|
10292
|
-
|
|
10456
|
+
vrType = tagObject.vr;
|
|
10457
|
+
var values = DicomMessage._getTagWriteValues(vrType, tagObject);
|
|
10293
10458
|
written += tag.write(useStream, vrType, values, syntax, writeOptions);
|
|
10294
10459
|
});
|
|
10295
10460
|
return written;
|
|
10296
10461
|
}
|
|
10462
|
+
}, {
|
|
10463
|
+
key: "_getTagWriteValues",
|
|
10464
|
+
value: function _getTagWriteValues(vrType, tagObject) {
|
|
10465
|
+
if (!tagObject._rawValue) {
|
|
10466
|
+
return tagObject.Value;
|
|
10467
|
+
}
|
|
10468
|
+
|
|
10469
|
+
// apply VR specific formatting to the original _rawValue and compare to the Value
|
|
10470
|
+
var vr = ValueRepresentation.createByTypeString(vrType);
|
|
10471
|
+
var originalValue = tagObject._rawValue.map(function (val) {
|
|
10472
|
+
return vr.applyFormatting(val);
|
|
10473
|
+
});
|
|
10474
|
+
|
|
10475
|
+
// if Value has not changed, write _rawValue unformatted back into the file
|
|
10476
|
+
if (deepEqual(tagObject.Value, originalValue)) {
|
|
10477
|
+
return tagObject._rawValue;
|
|
10478
|
+
} else {
|
|
10479
|
+
return tagObject.Value;
|
|
10480
|
+
}
|
|
10481
|
+
}
|
|
10297
10482
|
}, {
|
|
10298
10483
|
key: "_readTag",
|
|
10299
10484
|
value: function _readTag(stream, syntax) {
|
|
@@ -10356,25 +10541,37 @@ var DicomMessage = /*#__PURE__*/function () {
|
|
|
10356
10541
|
}
|
|
10357
10542
|
}
|
|
10358
10543
|
var values = [];
|
|
10544
|
+
var rawValues = [];
|
|
10359
10545
|
if (vr.isBinary() && length > vr.maxLength && !vr.noMultiple) {
|
|
10360
10546
|
var times = length / vr.maxLength,
|
|
10361
10547
|
i = 0;
|
|
10362
10548
|
while (i++ < times) {
|
|
10363
|
-
|
|
10549
|
+
var _vr$read = vr.read(stream, vr.maxLength, syntax, options),
|
|
10550
|
+
rawValue = _vr$read.rawValue,
|
|
10551
|
+
value = _vr$read.value;
|
|
10552
|
+
rawValues.push(rawValue);
|
|
10553
|
+
values.push(value);
|
|
10364
10554
|
}
|
|
10365
10555
|
} else {
|
|
10366
|
-
var
|
|
10556
|
+
var _vr$read2 = vr.read(stream, length, syntax, options),
|
|
10557
|
+
_rawValue = _vr$read2.rawValue,
|
|
10558
|
+
_value = _vr$read2.value;
|
|
10367
10559
|
if (!vr.isBinary() && singleVRs.indexOf(vr.type) == -1) {
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
10560
|
+
rawValues = _rawValue;
|
|
10561
|
+
values = _value;
|
|
10562
|
+
if (typeof _value === "string") {
|
|
10563
|
+
rawValues = _rawValue.split(String.fromCharCode(VM_DELIMITER));
|
|
10564
|
+
values = _value.split(String.fromCharCode(VM_DELIMITER));
|
|
10371
10565
|
}
|
|
10372
10566
|
} else if (vr.type == "SQ") {
|
|
10373
|
-
|
|
10567
|
+
rawValues = _rawValue;
|
|
10568
|
+
values = _value;
|
|
10374
10569
|
} else if (vr.type == "OW" || vr.type == "OB") {
|
|
10375
|
-
|
|
10570
|
+
rawValues = _rawValue;
|
|
10571
|
+
values = _value;
|
|
10376
10572
|
} else {
|
|
10377
|
-
Array.isArray(
|
|
10573
|
+
Array.isArray(_value) ? values = _value : values.push(_value);
|
|
10574
|
+
Array.isArray(_rawValue) ? rawValues = _rawValue : rawValues.push(_rawValue);
|
|
10378
10575
|
}
|
|
10379
10576
|
}
|
|
10380
10577
|
stream.setEndian(oldEndian);
|
|
@@ -10383,6 +10580,7 @@ var DicomMessage = /*#__PURE__*/function () {
|
|
|
10383
10580
|
vr: vr
|
|
10384
10581
|
});
|
|
10385
10582
|
retObj.values = values;
|
|
10583
|
+
retObj.rawValues = rawValues;
|
|
10386
10584
|
return retObj;
|
|
10387
10585
|
}
|
|
10388
10586
|
}, {
|