@cosyte/dicom 0.0.14 → 0.0.16
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/CHANGELOG.md +339 -0
- package/README.md +2 -2
- package/dist/index.cjs +87 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -13
- package/dist/index.d.ts +52 -13
- package/dist/index.mjs +87 -69
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -11,7 +11,7 @@ var __export = (target, all) => {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
// src/version.ts
|
|
14
|
-
var VERSION = "0.0.
|
|
14
|
+
var VERSION = "0.0.16";
|
|
15
15
|
|
|
16
16
|
// src/dictionary/index.ts
|
|
17
17
|
var dictionary_exports = {};
|
|
@@ -11787,6 +11787,11 @@ function safePrivateCreator(creator, profile) {
|
|
|
11787
11787
|
function renderVr(vr) {
|
|
11788
11788
|
return vr !== void 0 && KNOWN_VRS.has(vr) ? vr : WITHHELD;
|
|
11789
11789
|
}
|
|
11790
|
+
var TAG_SHAPE = /^[0-9A-F]{8}$/u;
|
|
11791
|
+
function renderTag(tag) {
|
|
11792
|
+
if (tag === void 0 || !TAG_SHAPE.test(tag)) return WITHHELD;
|
|
11793
|
+
return lookup(tag) === void 0 ? WITHHELD : tag;
|
|
11794
|
+
}
|
|
11790
11795
|
|
|
11791
11796
|
// src/parser/fatals.ts
|
|
11792
11797
|
var SUPPORTED_TRANSFER_SYNTAXES = "1.2.840.10008.1.2, 1.2.840.10008.1.2.1, 1.2.840.10008.1.2.2, 1.2.840.10008.1.2.1.99";
|
|
@@ -11835,7 +11840,7 @@ var FATAL_MESSAGES = Object.freeze({
|
|
|
11835
11840
|
// four bytes are not what they claim to be.
|
|
11836
11841
|
FILE_META_GROUP_LENGTH_OVERRUNS: {
|
|
11837
11842
|
code: FATAL_CODES.INVALID_FILE_META,
|
|
11838
|
-
message: "(0002,0000) FileMetaInformationGroupLength declares more bytes than remain in the input
|
|
11843
|
+
message: "(0002,0000) FileMetaInformationGroupLength declares more bytes than remain in the input. The declared length and the count of bytes that remain are withheld; the byte offset locates the group."
|
|
11839
11844
|
},
|
|
11840
11845
|
FILE_META_TRANSFER_SYNTAX_MISSING: {
|
|
11841
11846
|
code: FATAL_CODES.INVALID_FILE_META,
|
|
@@ -11878,7 +11883,7 @@ var FATAL_MESSAGES = Object.freeze({
|
|
|
11878
11883
|
},
|
|
11879
11884
|
ELEMENT_LENGTH_EXCEEDS_BUFFER: {
|
|
11880
11885
|
code: FATAL_CODES.INVALID_FILE_META,
|
|
11881
|
-
message: "An element declares a Value Length reaching past the end of the bytes being read
|
|
11886
|
+
message: "An element declares a Value Length reaching past the end of the bytes being read. Its tag, its declared length and the count of bytes that remain are withheld; the byte offset locates it."
|
|
11882
11887
|
},
|
|
11883
11888
|
UNEXPECTED_TAG_INSIDE_SEQUENCE: {
|
|
11884
11889
|
code: FATAL_CODES.INVALID_FILE_META,
|
|
@@ -11949,8 +11954,8 @@ function unsupportedTransferSyntax(buffer, offset, ts) {
|
|
|
11949
11954
|
function fileMetaTruncated(buffer, offset) {
|
|
11950
11955
|
return at("FILE_META_TRUNCATED", buffer, offset);
|
|
11951
11956
|
}
|
|
11952
|
-
function fileMetaGroupLengthOverruns(buffer, offset
|
|
11953
|
-
return at("FILE_META_GROUP_LENGTH_OVERRUNS", buffer, offset
|
|
11957
|
+
function fileMetaGroupLengthOverruns(buffer, offset) {
|
|
11958
|
+
return at("FILE_META_GROUP_LENGTH_OVERRUNS", buffer, offset);
|
|
11954
11959
|
}
|
|
11955
11960
|
function fileMetaTransferSyntaxMissing(buffer, offset) {
|
|
11956
11961
|
return at("FILE_META_TRANSFER_SYNTAX_MISSING", buffer, offset);
|
|
@@ -11979,8 +11984,8 @@ function undefinedLengthOnNonSqExplicit(buffer, offset, vr) {
|
|
|
11979
11984
|
function undefinedLengthOnNonSqImplicit(buffer, offset, vr) {
|
|
11980
11985
|
return at("UNDEFINED_LENGTH_ON_NON_SQ_IMPLICIT", buffer, offset, { vr });
|
|
11981
11986
|
}
|
|
11982
|
-
function elementLengthExceedsBuffer(buffer, offset
|
|
11983
|
-
return at("ELEMENT_LENGTH_EXCEEDS_BUFFER", buffer, offset
|
|
11987
|
+
function elementLengthExceedsBuffer(buffer, offset) {
|
|
11988
|
+
return at("ELEMENT_LENGTH_EXCEEDS_BUFFER", buffer, offset);
|
|
11984
11989
|
}
|
|
11985
11990
|
function unexpectedTagInsideSequence(buffer, offset) {
|
|
11986
11991
|
return at("UNEXPECTED_TAG_INSIDE_SEQUENCE", buffer, offset);
|
|
@@ -12206,19 +12211,38 @@ var WARNING_MESSAGES = Object.freeze({
|
|
|
12206
12211
|
DICOM_FILE_META_GROUP_LENGTH_MISSING: "(0002,0000) FileMetaInformationGroupLength missing; scanning forward to first non-(0002,xxxx) element.",
|
|
12207
12212
|
DICOM_FILE_META_GROUP_LENGTH_MISMATCH: "(0002,0000) FileMetaInformationGroupLength declared {n} bytes; actual File Meta group size is {n2} bytes. Trusting actual.",
|
|
12208
12213
|
DICOM_UNDEFINED_LENGTH_IN_EXPLICIT_VR: "Element ({tag}) uses undefined length (0xFFFFFFFF) under an Explicit VR transfer syntax.",
|
|
12209
|
-
|
|
12214
|
+
// The declared length is gone from this string and the reason is measured, not
|
|
12215
|
+
// cautious: this code fires on ANY element header, including one a lying Value
|
|
12216
|
+
// Length upstream composed out of somebody's value, and it then rendered four
|
|
12217
|
+
// payload bytes as {tag} and four more as the decimal {n} - eight consecutive
|
|
12218
|
+
// bytes of a name in one message. See `oddLengthValuePadded`.
|
|
12219
|
+
DICOM_ODD_LENGTH_VALUE_PADDED: "Element ({tag}) has an odd declared length; cursor advanced by one padding byte to maintain alignment. The declared length is withheld; the byte offset identifies the element.",
|
|
12210
12220
|
DICOM_VR_MISMATCH: "Element ({tag}) on-wire VR is {vr2}; dictionary lists {vr}. Trusting on-wire VR.",
|
|
12211
12221
|
// No tag, and the reason is the one `nonzeroReservedBytes` states: this code's
|
|
12212
12222
|
// three siblings below fire only on an ODD group, and an odd group is the one
|
|
12213
12223
|
// class of tag no closed table this library holds can ever vouch for. See
|
|
12214
12224
|
// `privateTagNoCreator`.
|
|
12215
12225
|
DICOM_PRIVATE_TAG_NO_CREATOR: "A private element has no Private Creator registered for its block; treating as VR=UN. Its tag is withheld; the byte offset identifies the element.",
|
|
12216
|
-
|
|
12226
|
+
// No tag, and it is the membership bound in `renderTag` that made the slot
|
|
12227
|
+
// dead rather than a judgement here: this code fires on a (gggg,0000), the
|
|
12228
|
+
// element number is a constant of the code, and PS3.6 carries a literal row
|
|
12229
|
+
// for exactly one such tag - (0002,0000), which is File Meta and never
|
|
12230
|
+
// reaches this code. So every tag this slot could ever have rendered was one
|
|
12231
|
+
// no closed table names, leaving the group number as sixteen free bits of a
|
|
12232
|
+
// header that may itself be fabricated. See `groupLengthInDataset`.
|
|
12233
|
+
DICOM_GROUP_LENGTH_IN_DATASET: "A retired Group Length element (gggg,0000) was encountered in the dataset; preserved as-is. Its group number is withheld; the byte offset identifies the element.",
|
|
12217
12234
|
// The tag is deliberately absent, and this is the only *parser* message where
|
|
12218
12235
|
// that is true. See `nonzeroReservedBytes`. Kept terse for the same reason the
|
|
12219
12236
|
// de-identify messages are: it is emitted once per element, and element count
|
|
12220
12237
|
// is attacker-chosen.
|
|
12221
|
-
|
|
12238
|
+
// 🩺 THE TWO BYTE VALUES ARE GONE FOR THE REASON THE TAG WAS ALREADY GONE, AND
|
|
12239
|
+
// LEAVING THEM MADE THAT BOUND HALF A BOUND. This code's trigger is "these two
|
|
12240
|
+
// bytes are not what PS3.5 7.1.2 says they must be", so the header may not be
|
|
12241
|
+
// a header - and then the reserved pair is two bytes from inside some
|
|
12242
|
+
// element's value, printed as two decimals that reverse with no work at all.
|
|
12243
|
+
// Measured on a name-bearing payload across six under-declare deltas. See
|
|
12244
|
+
// `nonzeroReservedBytes`.
|
|
12245
|
+
DICOM_NONZERO_RESERVED_BYTES: "Non-zero reserved bytes between VR and length; ignoring. Their two values are withheld with the tag; the byte offset identifies the element.",
|
|
12222
12246
|
DICOM_SQ_NOT_DESCENDED: "Element ({tag}) resolved to VR=SQ from the dictionary but its defined-length value is not a valid item stream; kept as opaque bytes and NOT descended, so nothing nested inside it is visible to navigation, and deidentify() cannot audit it. See DICOM_DEIDENT_SEQUENCE_NOT_AUDITABLE.",
|
|
12223
12247
|
DICOM_UN_PARSED_AS_SQ: "Element ({tag}) has VR=UN with undefined length; descended as Implicit VR LE sequence per CP-246.",
|
|
12224
12248
|
DICOM_EMPTY_ITEM_IN_SEQUENCE: "Sequence ({tag}) contains an empty item (length=0); tolerated.",
|
|
@@ -12253,11 +12277,18 @@ var WARNING_MESSAGES = Object.freeze({
|
|
|
12253
12277
|
// No value and no length, for the same reason as the code above: the retained
|
|
12254
12278
|
// text is the file's own. The tag is a constant of this code.
|
|
12255
12279
|
DICOM_DEIDENT_METHOD_PRIOR_RETAINED: "A De-identification Method (0012,0063) value the source file already carried was kept beside the one this run recorded, as PS3.15 E.1.1 requires. That attribute is not in Table E.1-1, so no rule in this run inspected, audited or redacted those bytes: if the sender wrote identifying text there it is in the de-identified output, under (0012,0062) = YES. The text is withheld from this message.",
|
|
12256
|
-
//
|
|
12257
|
-
//
|
|
12258
|
-
//
|
|
12259
|
-
|
|
12260
|
-
|
|
12280
|
+
// BOTH of the disagreeing length fields are deliberately absent, and the
|
|
12281
|
+
// second one is the eighth instance of `DICOM-DIAGNOSTIC-PHI-RESIDUALS`: the
|
|
12282
|
+
// remaining-bytes count this string used to carry was the enclosing sequence's
|
|
12283
|
+
// declared Value Length less the bytes of that sequence already consumed. See
|
|
12284
|
+
// `itemCrossesSequenceEnd`.
|
|
12285
|
+
DICOM_ITEM_CROSSES_SEQUENCE_END: "Item ({tag}) declares a length reaching past its enclosing sequence's declared end, so it reads the enclosing Data Set's bytes. The file's two length fields disagree (PS3.5 7.5.1 and 7.5.2 govern them); the item's is used. Both declared lengths are withheld; the byte offset locates the item.",
|
|
12286
|
+
// Declared but not emitted by this build. The declared length is bound out
|
|
12287
|
+
// anyway: it is a raw 32-bit read off a header, so activating this code later
|
|
12288
|
+
// with the slot still here would ship the leak this slice closed one code
|
|
12289
|
+
// over. `{n2}` stays - it is the product this parser computed from the image
|
|
12290
|
+
// description attributes, not a number it read. The tag is a constant.
|
|
12291
|
+
DICOM_PIXEL_DATA_LENGTH_MISMATCH: "(7FE0,0010) PixelData declared length does not match the computed {n2} bytes. The declared length is withheld; the byte offset identifies the element.",
|
|
12261
12292
|
DICOM_IMPLICIT_VR_FOR_PRIVATE_TAG_WITHOUT_VR: "A private element under Implicit VR LE has no VR override; falling back to UN. Its tag is withheld; the byte offset identifies the element.",
|
|
12262
12293
|
DICOM_PRIVATE_CREATOR_UNKNOWN: "A private element has a Private Creator the active profile's private dictionary does not name; falling back to UN. The creator string is not reproduced here - read the (gggg,00EE) element if you need it. Its tag is withheld; the byte offset identifies the element.",
|
|
12263
12294
|
DICOM_BURNED_IN_ANNOTATION_NOT_REMOVED: "Pixel Data is present and Burned In Annotation is not 'NO'; this metadata-only de-identifier cannot inspect or clean pixels. Recognizable text may remain burned into the image.",
|
|
@@ -12269,19 +12300,31 @@ var WARNING_MESSAGES = Object.freeze({
|
|
|
12269
12300
|
// its two producers is an element the profile declares a Sequence while the
|
|
12270
12301
|
// wire says UN or OB, so naming a VR here would state a fact about the file
|
|
12271
12302
|
// that the file contradicts - on the one channel this class designates.
|
|
12272
|
-
|
|
12303
|
+
// The recorded byte count is gone from this string, and the reason is the same
|
|
12304
|
+
// one that took the declared length out of `DICOM_ODD_LENGTH_VALUE_PADDED`:
|
|
12305
|
+
// `Element.rawBytes.length` EQUALS the Value Length off the element header, so
|
|
12306
|
+
// when that header is fabricated the decimal is four document bytes. See
|
|
12307
|
+
// `sequenceNotAuditable`. `report.unauditableSequences[].byteLength` still
|
|
12308
|
+
// carries it, on a type documented as not value-free.
|
|
12309
|
+
DICOM_DEIDENT_SEQUENCE_NOT_AUDITABLE: "Element ({tag}) is a Sequence carrier with no parsed items, so its recorded bytes could not be audited (PS3.15 E.1.1); emptied. The byte count is withheld; see report.unauditableSequences.",
|
|
12273
12310
|
// Deliberately short for the same reason as the code above: one per element,
|
|
12274
12311
|
// and the element count is chosen by the input.
|
|
12275
12312
|
//
|
|
12276
|
-
// NEITHER THE TAG NOR THE VR IS ECHOED, and that is
|
|
12277
|
-
// rather than caution. Every other factory's {tag} is
|
|
12278
|
-
// Data Element header; the condition that raises THIS one
|
|
12279
|
-
// was fabricated from bytes inside some element's value, so
|
|
12280
|
-
//
|
|
12281
|
-
//
|
|
12313
|
+
// NEITHER THE TAG NOR THE VR NOR THE BYTE COUNT IS ECHOED, and that is
|
|
12314
|
+
// specific to this code rather than caution. Every other factory's {tag} is
|
|
12315
|
+
// composed from a real Data Element header; the condition that raises THIS one
|
|
12316
|
+
// is that the header was fabricated from bytes inside some element's value, so
|
|
12317
|
+
// its four tag bytes, its two VR bytes AND its four length bytes are document
|
|
12318
|
+
// content. `renderTag` is a membership test against PS3.6's registry and would
|
|
12319
|
+
// refuse this one - but a slot that has to rely on that is a slot a future
|
|
12320
|
+
// call site can still be handed, so the withholding stays at the call site
|
|
12321
|
+
// where it does not depend on a table. The length had no table to fall back on
|
|
12322
|
+
// at all: the message withheld the two fields a renderer could check and then
|
|
12323
|
+
// printed the one it could not, which is the shape this code was already
|
|
12324
|
+
// written to refuse.
|
|
12282
12325
|
// The byte offset locates the element instead, and is a position this parser
|
|
12283
12326
|
// counted rather than anything the document said.
|
|
12284
|
-
DICOM_DEIDENT_UNDEFINED_VR_NOT_AUDITABLE: "An element at byte offset {n2} carries an on-wire VR that is not one of the 34 PS3.5 6.2 defines, so its
|
|
12327
|
+
DICOM_DEIDENT_UNDEFINED_VR_NOT_AUDITABLE: "An element at byte offset {n2} carries an on-wire VR that is not one of the 34 PS3.5 6.2 defines, so its value bytes are not a Value Field this library decoded; emptied (PS3.15 E.1.1). Its tag, VR and byte count are withheld: an earlier under-declared length can make them fragments of some element's value. See report.undefinedVrElements.",
|
|
12285
12328
|
DICOM_BOM_IN_TEXT_VR: "Element ({tag}) {vr} value begins with a UTF-8 BOM; stripped on decode.",
|
|
12286
12329
|
DICOM_TRAILING_NULL_IN_TEXT_VR: "Element ({tag}) {vr} value has a trailing NULL pad where SPACE is expected; trimmed.",
|
|
12287
12330
|
DICOM_UI_TRAILING_SPACE: "Element ({tag}) UI value is SPACE-padded; UI requires NULL padding (PS3.5 \xA76.2). Trimmed.",
|
|
@@ -12292,10 +12335,6 @@ var WARNING_MESSAGES = Object.freeze({
|
|
|
12292
12335
|
DICOM_UNSUPPORTED_CHARSET: "(0008,0005) Specific Character Set value {n} names a defined term this build does not support; decoding text as UTF-8 best-effort. The term is not reproduced here - read the element if you need it.",
|
|
12293
12336
|
DICOM_CHARSET_AMBIGUOUS_SEPARATOR: "(0008,0005) Specific Character Set value {n} is ambiguous under the active code extensions; decoding text as UTF-8 best-effort."
|
|
12294
12337
|
});
|
|
12295
|
-
var TAG_SHAPE = /^[0-9A-F]{8}$/u;
|
|
12296
|
-
function renderTag(tag) {
|
|
12297
|
-
return tag !== void 0 && TAG_SHAPE.test(tag) ? tag : WITHHELD;
|
|
12298
|
-
}
|
|
12299
12338
|
function build2(code, position, tokens = {}) {
|
|
12300
12339
|
const message = WARNING_MESSAGES[code].replace("{tag}", renderTag(tokens.tag)).replace("{vr2}", renderVr(tokens.vr2)).replace("{vr}", renderVr(tokens.vr)).replace("{n2}", String(tokens.n2 ?? 0)).replace("{n}", String(tokens.n ?? 0));
|
|
12301
12340
|
return { code, message, position };
|
|
@@ -12315,11 +12354,8 @@ function fileMetaGroupLengthMismatch(position, declared, actual) {
|
|
|
12315
12354
|
function undefinedLengthInExplicitVR(position, tag) {
|
|
12316
12355
|
return build2(WARNING_CODES.DICOM_UNDEFINED_LENGTH_IN_EXPLICIT_VR, position, { tag });
|
|
12317
12356
|
}
|
|
12318
|
-
function oddLengthValuePadded(position, tag
|
|
12319
|
-
return build2(WARNING_CODES.DICOM_ODD_LENGTH_VALUE_PADDED, position, {
|
|
12320
|
-
tag,
|
|
12321
|
-
n: declaredLength
|
|
12322
|
-
});
|
|
12357
|
+
function oddLengthValuePadded(position, tag) {
|
|
12358
|
+
return build2(WARNING_CODES.DICOM_ODD_LENGTH_VALUE_PADDED, position, { tag });
|
|
12323
12359
|
}
|
|
12324
12360
|
function vrMismatch(position, tag, dictVR, fileVR) {
|
|
12325
12361
|
return build2(WARNING_CODES.DICOM_VR_MISMATCH, position, { tag, vr: dictVR, vr2: fileVR });
|
|
@@ -12327,14 +12363,11 @@ function vrMismatch(position, tag, dictVR, fileVR) {
|
|
|
12327
12363
|
function privateTagNoCreator(position) {
|
|
12328
12364
|
return build2(WARNING_CODES.DICOM_PRIVATE_TAG_NO_CREATOR, position);
|
|
12329
12365
|
}
|
|
12330
|
-
function groupLengthInDataset(position
|
|
12331
|
-
return build2(WARNING_CODES.DICOM_GROUP_LENGTH_IN_DATASET, position
|
|
12366
|
+
function groupLengthInDataset(position) {
|
|
12367
|
+
return build2(WARNING_CODES.DICOM_GROUP_LENGTH_IN_DATASET, position);
|
|
12332
12368
|
}
|
|
12333
|
-
function nonzeroReservedBytes(position
|
|
12334
|
-
return build2(WARNING_CODES.DICOM_NONZERO_RESERVED_BYTES, position
|
|
12335
|
-
n: first,
|
|
12336
|
-
n2: second
|
|
12337
|
-
});
|
|
12369
|
+
function nonzeroReservedBytes(position) {
|
|
12370
|
+
return build2(WARNING_CODES.DICOM_NONZERO_RESERVED_BYTES, position);
|
|
12338
12371
|
}
|
|
12339
12372
|
function unParsedAsSQ(position, tag) {
|
|
12340
12373
|
return build2(WARNING_CODES.DICOM_UN_PARSED_AS_SQ, position, { tag });
|
|
@@ -12342,11 +12375,8 @@ function unParsedAsSQ(position, tag) {
|
|
|
12342
12375
|
function sqNotDescended(position, tag) {
|
|
12343
12376
|
return build2(WARNING_CODES.DICOM_SQ_NOT_DESCENDED, position, { tag });
|
|
12344
12377
|
}
|
|
12345
|
-
function itemCrossesSequenceEnd(position, tag
|
|
12346
|
-
return build2(WARNING_CODES.DICOM_ITEM_CROSSES_SEQUENCE_END, position, {
|
|
12347
|
-
tag,
|
|
12348
|
-
n2: availableLength
|
|
12349
|
-
});
|
|
12378
|
+
function itemCrossesSequenceEnd(position, tag) {
|
|
12379
|
+
return build2(WARNING_CODES.DICOM_ITEM_CROSSES_SEQUENCE_END, position, { tag });
|
|
12350
12380
|
}
|
|
12351
12381
|
function emptyItemInSequence(position, tag) {
|
|
12352
12382
|
return build2(WARNING_CODES.DICOM_EMPTY_ITEM_IN_SEQUENCE, position, { tag });
|
|
@@ -12382,15 +12412,11 @@ function embeddedAttributeRemoved(position, tag, vr, count) {
|
|
|
12382
12412
|
n: count
|
|
12383
12413
|
});
|
|
12384
12414
|
}
|
|
12385
|
-
function sequenceNotAuditable(position, tag
|
|
12386
|
-
return build2(WARNING_CODES.DICOM_DEIDENT_SEQUENCE_NOT_AUDITABLE, position, {
|
|
12387
|
-
tag,
|
|
12388
|
-
n: byteLength
|
|
12389
|
-
});
|
|
12415
|
+
function sequenceNotAuditable(position, tag) {
|
|
12416
|
+
return build2(WARNING_CODES.DICOM_DEIDENT_SEQUENCE_NOT_AUDITABLE, position, { tag });
|
|
12390
12417
|
}
|
|
12391
|
-
function undefinedVrNotAuditable(position
|
|
12418
|
+
function undefinedVrNotAuditable(position) {
|
|
12392
12419
|
return build2(WARNING_CODES.DICOM_DEIDENT_UNDEFINED_VR_NOT_AUDITABLE, position, {
|
|
12393
|
-
n: byteLength,
|
|
12394
12420
|
n2: position.byteOffset
|
|
12395
12421
|
});
|
|
12396
12422
|
}
|
|
@@ -12561,7 +12587,7 @@ function readExplicitElementHeader(cursor, _ctx, emit) {
|
|
|
12561
12587
|
const reserved1 = cursor.buffer[cursor.position + 1];
|
|
12562
12588
|
cursor.position += 2;
|
|
12563
12589
|
if ((reserved0 ?? 0) !== 0 || (reserved1 ?? 0) !== 0) {
|
|
12564
|
-
emit(nonzeroReservedBytes({ byteOffset: headerStart }
|
|
12590
|
+
emit(nonzeroReservedBytes({ byteOffset: headerStart }));
|
|
12565
12591
|
}
|
|
12566
12592
|
length = cursor.readUInt32();
|
|
12567
12593
|
headerLength = 12;
|
|
@@ -12601,7 +12627,7 @@ function parseFileMeta(buffer$1, datasetStart, ctx, emit) {
|
|
|
12601
12627
|
if (firstElement.tag === "00020000" && firstElement.vr === "UL" && firstElement.value.length === 4) {
|
|
12602
12628
|
declaredFmLength = firstElement.value.readUInt32LE(0);
|
|
12603
12629
|
if (cursor.position + declaredFmLength > buffer$1.length) {
|
|
12604
|
-
throw fileMetaGroupLengthOverruns(buffer$1, fmStart
|
|
12630
|
+
throw fileMetaGroupLengthOverruns(buffer$1, fmStart);
|
|
12605
12631
|
}
|
|
12606
12632
|
} else {
|
|
12607
12633
|
emit(fileMetaGroupLengthMissing({ byteOffset: fmStart, fileMeta: true }));
|
|
@@ -13240,13 +13266,7 @@ function parseSequence(buffer, valueStart, ctx, emit, opts) {
|
|
|
13240
13266
|
cursor.position = inner.endOffset;
|
|
13241
13267
|
} else {
|
|
13242
13268
|
if (opts.explicitLength !== void 0 && endLimit < buffer.length && cursor.position + itemLength > endLimit) {
|
|
13243
|
-
emit(
|
|
13244
|
-
itemCrossesSequenceEnd(
|
|
13245
|
-
{ byteOffset: itemHeaderStart },
|
|
13246
|
-
itemTag,
|
|
13247
|
-
Math.max(0, endLimit - cursor.position)
|
|
13248
|
-
)
|
|
13249
|
-
);
|
|
13269
|
+
emit(itemCrossesSequenceEnd({ byteOffset: itemHeaderStart }, itemTag));
|
|
13250
13270
|
}
|
|
13251
13271
|
if (cursor.position + itemLength > buffer.length) {
|
|
13252
13272
|
throw itemLengthExceedsBuffer(buffer, itemHeaderStart);
|
|
@@ -13444,7 +13464,7 @@ function parseImplicitLE(buffer, datasetStart, ctx, emit, opts = {}) {
|
|
|
13444
13464
|
throw undefinedLengthOnNonSqImplicit(buffer, headerStart, vr);
|
|
13445
13465
|
}
|
|
13446
13466
|
if (cursor.position + length > buffer.length) {
|
|
13447
|
-
throw elementLengthExceedsBuffer(buffer, headerStart
|
|
13467
|
+
throw elementLengthExceedsBuffer(buffer, headerStart);
|
|
13448
13468
|
}
|
|
13449
13469
|
const valueStart = cursor.position;
|
|
13450
13470
|
const valueEnd = valueStart + length;
|
|
@@ -13481,7 +13501,7 @@ function parseImplicitLE(buffer, datasetStart, ctx, emit, opts = {}) {
|
|
|
13481
13501
|
}
|
|
13482
13502
|
}
|
|
13483
13503
|
if (element === 0 && group !== 2) {
|
|
13484
|
-
emit(groupLengthInDataset(position
|
|
13504
|
+
emit(groupLengthInDataset(position));
|
|
13485
13505
|
}
|
|
13486
13506
|
if (group % 2 === 1 && element >= 16 && element <= 255) {
|
|
13487
13507
|
registerPrivateCreator(tag, valueSlice, ctx);
|
|
@@ -13564,7 +13584,7 @@ function _parseExplicit(buffer, datasetStart, ctx, emit, mode, opts = {}) {
|
|
|
13564
13584
|
}
|
|
13565
13585
|
}
|
|
13566
13586
|
if (length !== UNDEFINED_LENGTH2 && length % 2 === 1) {
|
|
13567
|
-
emit(oddLengthValuePadded(position, tag
|
|
13587
|
+
emit(oddLengthValuePadded(position, tag));
|
|
13568
13588
|
}
|
|
13569
13589
|
if (vr === "SQ") {
|
|
13570
13590
|
const valueStart2 = cursor.position;
|
|
@@ -13691,7 +13711,7 @@ function _parseExplicit(buffer, datasetStart, ctx, emit, mode, opts = {}) {
|
|
|
13691
13711
|
throw undefinedLengthOnNonSqExplicit(buffer, headerStart, vr);
|
|
13692
13712
|
}
|
|
13693
13713
|
if (cursor.position + length > buffer.length) {
|
|
13694
|
-
throw elementLengthExceedsBuffer(buffer, headerStart
|
|
13714
|
+
throw elementLengthExceedsBuffer(buffer, headerStart);
|
|
13695
13715
|
}
|
|
13696
13716
|
const valueStart = cursor.position;
|
|
13697
13717
|
const valueEnd = valueStart + length;
|
|
@@ -13699,7 +13719,7 @@ function _parseExplicit(buffer, datasetStart, ctx, emit, mode, opts = {}) {
|
|
|
13699
13719
|
cursor.position = valueEnd;
|
|
13700
13720
|
const elementHexNum = parseInt(tag.slice(4, 8), 16);
|
|
13701
13721
|
if (elementHexNum === 0 && groupNum !== 2) {
|
|
13702
|
-
emit(groupLengthInDataset(position
|
|
13722
|
+
emit(groupLengthInDataset(position));
|
|
13703
13723
|
}
|
|
13704
13724
|
if (groupNum % 2 === 1 && elementHexNum >= 16 && elementHexNum <= 255) {
|
|
13705
13725
|
registerPrivateCreator(tag, valueSlice, ctx);
|
|
@@ -15499,7 +15519,7 @@ function emptyUndefinedVrElement(el, ctx, contextPath, out) {
|
|
|
15499
15519
|
byteLength: el.rawBytes.length,
|
|
15500
15520
|
...contextPath.length > 0 ? { contextPath: [...contextPath] } : {}
|
|
15501
15521
|
});
|
|
15502
|
-
out.warnings.push(undefinedVrNotAuditable({ byteOffset: el.byteOffset }
|
|
15522
|
+
out.warnings.push(undefinedVrNotAuditable({ byteOffset: el.byteOffset }));
|
|
15503
15523
|
}
|
|
15504
15524
|
function isUnauditableSequence(el) {
|
|
15505
15525
|
return el.vr === "SQ" && el.items === void 0;
|
|
@@ -15516,9 +15536,7 @@ function emptyUnauditableCarrier(el, ctx, contextPath, out, replacement) {
|
|
|
15516
15536
|
byteLength: el.rawBytes.length,
|
|
15517
15537
|
...contextPath.length > 0 ? { contextPath: [...contextPath] } : {}
|
|
15518
15538
|
});
|
|
15519
|
-
out.warnings.push(
|
|
15520
|
-
sequenceNotAuditable({ byteOffset: el.byteOffset }, el.tag, el.rawBytes.length)
|
|
15521
|
-
);
|
|
15539
|
+
out.warnings.push(sequenceNotAuditable({ byteOffset: el.byteOffset }, el.tag));
|
|
15522
15540
|
}
|
|
15523
15541
|
function creatorsInScope(source) {
|
|
15524
15542
|
const byBlock = /* @__PURE__ */ new Map();
|