@cosyte/dicom 0.0.10 → 0.0.12
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 +578 -7
- package/README.md +9 -3
- package/dist/index.cjs +212 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +107 -5
- package/dist/index.d.ts +107 -5
- package/dist/index.mjs +212 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -307,6 +307,26 @@ interface ParseOptions {
|
|
|
307
307
|
* When `true`, every Tier-2 warning is escalated to a thrown
|
|
308
308
|
* `DicomParseError` carrying the warning code. Default `false`.
|
|
309
309
|
*
|
|
310
|
+
* 🛑 **THE ESCALATED DIAGNOSTIC CARRIES SOURCE BYTES THAT THE WARNING DOES
|
|
311
|
+
* NOT.** A `DicomParseWarning.message` is a frozen registry string with only
|
|
312
|
+
* structural tokens filled in, so it is safe to log whole; the
|
|
313
|
+
* `DicomParseError` this option raises in its place also carries `snippet`,
|
|
314
|
+
* **16 raw bytes, unredacted** (D-10), read at the warning's own `byteOffset`.
|
|
315
|
+
* **Which element those bytes belong to is not contracted**: that offset's
|
|
316
|
+
* frame follows where the element was read - file-absolute at the root,
|
|
317
|
+
* relative to the enclosing slice inside a defined-length Sequence or Item,
|
|
318
|
+
* and into the inflated stream under Deflated Explicit VR LE - while the
|
|
319
|
+
* snippet is cut from whichever buffer the parse is holding, so the two can
|
|
320
|
+
* disagree and the bytes can be an unrelated element's value. Do not reason
|
|
321
|
+
* from a code's message to what its snippet holds - **measure it, and treat
|
|
322
|
+
* every one of them as document content.**
|
|
323
|
+
*
|
|
324
|
+
* That is the documented design of `snippet` rather than a defect in any one
|
|
325
|
+
* code, and turning this option on does not change what any of them means -
|
|
326
|
+
* but a message-only PHI review of the lenient path does not transfer to the
|
|
327
|
+
* strict one. Log `err.code`, `err.byteOffset` and `err.message`; treat
|
|
328
|
+
* `err.snippet` as PHI.
|
|
329
|
+
*
|
|
310
330
|
* Omit (do not pass `undefined`) to use the default.
|
|
311
331
|
*/
|
|
312
332
|
readonly strict?: boolean;
|
|
@@ -391,11 +411,14 @@ interface ParseOptions {
|
|
|
391
411
|
* ```
|
|
392
412
|
*/
|
|
393
413
|
declare const WARNING_CODES: {
|
|
414
|
+
readonly DICOM_DUPLICATE_FILE_META_ELEMENT: "DICOM_DUPLICATE_FILE_META_ELEMENT";
|
|
415
|
+
readonly DICOM_DUPLICATE_TAG_IN_DATA_SET: "DICOM_DUPLICATE_TAG_IN_DATA_SET";
|
|
394
416
|
readonly DICOM_EMPTY_ITEM_IN_SEQUENCE: "DICOM_EMPTY_ITEM_IN_SEQUENCE";
|
|
395
417
|
readonly DICOM_FILE_META_GROUP_LENGTH_MISMATCH: "DICOM_FILE_META_GROUP_LENGTH_MISMATCH";
|
|
396
418
|
readonly DICOM_FILE_META_GROUP_LENGTH_MISSING: "DICOM_FILE_META_GROUP_LENGTH_MISSING";
|
|
397
419
|
readonly DICOM_GROUP_LENGTH_IN_DATASET: "DICOM_GROUP_LENGTH_IN_DATASET";
|
|
398
420
|
readonly DICOM_IMPLICIT_VR_FOR_PRIVATE_TAG_WITHOUT_VR: "DICOM_IMPLICIT_VR_FOR_PRIVATE_TAG_WITHOUT_VR";
|
|
421
|
+
readonly DICOM_ITEM_CROSSES_SEQUENCE_END: "DICOM_ITEM_CROSSES_SEQUENCE_END";
|
|
399
422
|
readonly DICOM_MISSING_PREAMBLE: "DICOM_MISSING_PREAMBLE";
|
|
400
423
|
readonly DICOM_NONZERO_RESERVED_BYTES: "DICOM_NONZERO_RESERVED_BYTES";
|
|
401
424
|
readonly DICOM_ODD_LENGTH_VALUE_PADDED: "DICOM_ODD_LENGTH_VALUE_PADDED";
|
|
@@ -416,6 +439,9 @@ declare const WARNING_CODES: {
|
|
|
416
439
|
readonly DICOM_UNSUPPORTED_CHARSET: "DICOM_UNSUPPORTED_CHARSET";
|
|
417
440
|
readonly DICOM_BURNED_IN_ANNOTATION_NOT_REMOVED: "DICOM_BURNED_IN_ANNOTATION_NOT_REMOVED";
|
|
418
441
|
readonly DICOM_DEIDENT_EMBEDDED_ATTRIBUTE_REMOVED: "DICOM_DEIDENT_EMBEDDED_ATTRIBUTE_REMOVED";
|
|
442
|
+
readonly DICOM_DEIDENT_METHOD_NOT_ADDED: "DICOM_DEIDENT_METHOD_NOT_ADDED";
|
|
443
|
+
readonly DICOM_DEIDENT_METHOD_NOT_LO: "DICOM_DEIDENT_METHOD_NOT_LO";
|
|
444
|
+
readonly DICOM_DEIDENT_METHOD_PRIOR_RETAINED: "DICOM_DEIDENT_METHOD_PRIOR_RETAINED";
|
|
419
445
|
readonly DICOM_DEIDENT_SEQUENCE_NOT_AUDITABLE: "DICOM_DEIDENT_SEQUENCE_NOT_AUDITABLE";
|
|
420
446
|
readonly DICOM_DEIDENT_UNDEFINED_VR_NOT_AUDITABLE: "DICOM_DEIDENT_UNDEFINED_VR_NOT_AUDITABLE";
|
|
421
447
|
readonly DICOM_PRIVATE_CREATOR_UNKNOWN: "DICOM_PRIVATE_CREATOR_UNKNOWN";
|
|
@@ -2643,7 +2669,15 @@ interface DeidentifyReport {
|
|
|
2643
2669
|
readonly uidMap: ReadonlyMap<string, string>;
|
|
2644
2670
|
/** Safety warnings - notably burned-in-pixel annotation that cannot be cleaned. */
|
|
2645
2671
|
readonly warnings: readonly DicomParseWarning[];
|
|
2646
|
-
/**
|
|
2672
|
+
/**
|
|
2673
|
+
* The Retain/Clean options that were active for this run.
|
|
2674
|
+
*
|
|
2675
|
+
* **Not a list of what survived.** Attributes Table E.1-1 does not list are
|
|
2676
|
+
* kept without appearing anywhere in this field - `(0012,0063)`
|
|
2677
|
+
* De-identification Method is the one whose retention is disclosed, and it is
|
|
2678
|
+
* disclosed as `DICOM_DEIDENT_METHOD_PRIOR_RETAINED` on
|
|
2679
|
+
* {@link DeidentifyReport.warnings}, because it is not an option set.
|
|
2680
|
+
*/
|
|
2647
2681
|
readonly retained: readonly DeidentifyOption[];
|
|
2648
2682
|
}
|
|
2649
2683
|
/**
|
|
@@ -2676,8 +2710,60 @@ interface DeidentifyOptions {
|
|
|
2676
2710
|
*/
|
|
2677
2711
|
readonly profile?: Profile;
|
|
2678
2712
|
/**
|
|
2679
|
-
* Text
|
|
2713
|
+
* Text **added to** `(0012,0063)` De-identification Method. Default names the
|
|
2680
2714
|
* Basic Profile and the active options.
|
|
2715
|
+
*
|
|
2716
|
+
* **The default is multi-valued, one Value per name, and that is a conformance
|
|
2717
|
+
* fix rather than a style choice.** PS3.5 2026c Table 6.2-1 caps an `LO` at
|
|
2718
|
+
* **64 characters per Value**, and `(0012,0063)` is `1-n`; the single-value
|
|
2719
|
+
* default this replaced measured 76 characters with no options and 272 with
|
|
2720
|
+
* all nine, so every run this library ever made wrote a value no `LO` may
|
|
2721
|
+
* legally carry. The Profile name is now one Value of 61 characters and each
|
|
2722
|
+
* active option is its own, so no option subset can exceed the maximum.
|
|
2723
|
+
*
|
|
2724
|
+
* **Your string is not bounded here.** A value of your own longer than 64
|
|
2725
|
+
* characters is written through as given, with no warning: it is yours, and
|
|
2726
|
+
* splitting or truncating it would invent a record you did not write. Split it
|
|
2727
|
+
* on `\` yourself if a strict receiver is in your path.
|
|
2728
|
+
*
|
|
2729
|
+
* PS3.15 E.1.1 says this string is "inserted in or added to" the attribute, so
|
|
2730
|
+
* a value the incoming Data Set already carried is kept and this one is
|
|
2731
|
+
* appended after a `\` as a further value of the `1-n` attribute - the
|
|
2732
|
+
* provenance chain, not a replacement.
|
|
2733
|
+
*
|
|
2734
|
+
* **This string is itself a `1-n` value**: it is split on `\` and only the
|
|
2735
|
+
* values not already recorded are added.
|
|
2736
|
+
*
|
|
2737
|
+
* **Trailing SPACE and NUL are padding, not content** (PS3.5 Table 6.2-1's `LO`
|
|
2738
|
+
* row, which describes a **Value** - and `LO` is `1-n`). They are ignored when
|
|
2739
|
+
* a value here is matched against one already recorded, **per value, on both
|
|
2740
|
+
* sides**, and they are trimmed from the value written. That makes repeated
|
|
2741
|
+
* de-identification a fixed point **from the first pass**, for every string:
|
|
2742
|
+
* with or without a delimiter, and with a pad byte on any value, last or not.
|
|
2743
|
+
* A string that is padding only records nothing. Leading spaces are yours and
|
|
2744
|
+
* are written through untouched.
|
|
2745
|
+
*
|
|
2746
|
+
* One bound, and it is over the value that would be **written**, not over the
|
|
2747
|
+
* join: when that value would exceed the largest Value Length an `LO` can
|
|
2748
|
+
* encode, the prior value is **replaced** rather than added to - an element the
|
|
2749
|
+
* serializer cannot encode would take the whole de-identified object down - and
|
|
2750
|
+
* `report.warnings` carries `DICOM_DEIDENT_METHOD_NOT_ADDED`. That includes a
|
|
2751
|
+
* prior value already at the ceiling which records this method already, where
|
|
2752
|
+
* there is no join to exceed anything. A string longer than that ceiling on its
|
|
2753
|
+
* own is not bounded here and will fail to serialize, exactly as it did before
|
|
2754
|
+
* this option grew a join.
|
|
2755
|
+
*
|
|
2756
|
+
* `DICOM_DEIDENT_METHOD_NOT_ADDED` means "the length ceiling was reached", never
|
|
2757
|
+
* "every fallback is disclosed": a `(0012,0063)` a file encoded under a VR other
|
|
2758
|
+
* than `LO` is also replaced, and that one raises `DICOM_DEIDENT_METHOD_NOT_LO`.
|
|
2759
|
+
* Two codes rather than one because the causes are unrelated - the chain outgrew
|
|
2760
|
+
* the VR, or the bytes were never in that VR at all - and a prior value that is
|
|
2761
|
+
* empty or padding only raises neither, because nothing was lost.
|
|
2762
|
+
*
|
|
2763
|
+
* When the prior value **is** kept, `report.warnings` carries
|
|
2764
|
+
* `DICOM_DEIDENT_METHOD_PRIOR_RETAINED`: `(0012,0063)` is not in Table E.1-1, so
|
|
2765
|
+
* nothing in the run inspected or redacted those bytes, and a name a sender
|
|
2766
|
+
* wrote there is in output stamped `(0012,0062) = YES`.
|
|
2681
2767
|
*/
|
|
2682
2768
|
readonly deidentificationMethod?: string;
|
|
2683
2769
|
}
|
|
@@ -2775,8 +2861,10 @@ declare class DeidentifyError extends Error {
|
|
|
2775
2861
|
* {@link Profile}, keeps the private data elements the profile's overlay names
|
|
2776
2862
|
* as safe (and the private-creator elements the profile recognizes).
|
|
2777
2863
|
* - Remaps `(0002,0003)` Media Storage SOP Instance UID consistently (unless
|
|
2778
|
-
* `RetainUIDs`), writes `(0012,0062)` Patient Identity Removed = `YES
|
|
2779
|
-
* `(0012,0063)` De-identification Method
|
|
2864
|
+
* `RetainUIDs`), writes `(0012,0062)` Patient Identity Removed = `YES`, **adds**
|
|
2865
|
+
* its method text to `(0012,0063)` De-identification Method rather than
|
|
2866
|
+
* replacing what the file already recorded there (PS3.15 E.1.1 - see
|
|
2867
|
+
* `addDeidentificationMethod`), and warns
|
|
2780
2868
|
* (`DICOM_BURNED_IN_ANNOTATION_NOT_REMOVED`) when Pixel Data is present and not
|
|
2781
2869
|
* marked free of burned-in annotation - this metadata-only pass cannot clean
|
|
2782
2870
|
* pixels (deferred to `@cosyte/dicom-pixel`).
|
|
@@ -2851,7 +2939,21 @@ declare class DeidentifyError extends Error {
|
|
|
2851
2939
|
* private value the sender wrote **outside** the sequence was retained on the
|
|
2852
2940
|
* Item's reservation and written into output stamped `PatientIdentityRemoved =
|
|
2853
2941
|
* YES` with `removedPrivateTags: []` (`DICOM-PRIVATE-CREATOR-RESERVATION-LEAK`,
|
|
2854
|
-
*
|
|
2942
|
+
* measured on the published `0.0.8` tarball and fixed on `0.0.10`; there is no `0.0.9` on
|
|
2943
|
+
* the registry). See {@link itemStreamOverrunsSequence}.
|
|
2944
|
+
* - `RetainSafePrivate` **retains nothing that a Data Set holds after a sequence
|
|
2945
|
+
* whose own contents contradict the extent it declared** - the mirror
|
|
2946
|
+
* direction, where an Item that *under*-declares **ejects** its trailing
|
|
2947
|
+
* elements out and a Private Creator landing in the enclosing Data Set reserves
|
|
2948
|
+
* a block for elements the sender never put beside it. The same false
|
|
2949
|
+
* attestation, and it applies **in every Data Set, not just the root**: an
|
|
2950
|
+
* inner sequence ejecting a creator into the still-usable Item that encloses it
|
|
2951
|
+
* is measured and pinned. The cut is positional, so a reservation the sender
|
|
2952
|
+
* wrote **ahead of** the offending sequence is untouched. Every private element
|
|
2953
|
+
* after that point is removed and named in `report.removedPrivateTags`, and the
|
|
2954
|
+
* **private-`SQ` carve-out above still applies**: a private `SQ` inside the
|
|
2955
|
+
* settled run that the profile vouches for is kept verbatim and never walked.
|
|
2956
|
+
* See {@link settledBound}.
|
|
2855
2957
|
*
|
|
2856
2958
|
* @module
|
|
2857
2959
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -307,6 +307,26 @@ interface ParseOptions {
|
|
|
307
307
|
* When `true`, every Tier-2 warning is escalated to a thrown
|
|
308
308
|
* `DicomParseError` carrying the warning code. Default `false`.
|
|
309
309
|
*
|
|
310
|
+
* 🛑 **THE ESCALATED DIAGNOSTIC CARRIES SOURCE BYTES THAT THE WARNING DOES
|
|
311
|
+
* NOT.** A `DicomParseWarning.message` is a frozen registry string with only
|
|
312
|
+
* structural tokens filled in, so it is safe to log whole; the
|
|
313
|
+
* `DicomParseError` this option raises in its place also carries `snippet`,
|
|
314
|
+
* **16 raw bytes, unredacted** (D-10), read at the warning's own `byteOffset`.
|
|
315
|
+
* **Which element those bytes belong to is not contracted**: that offset's
|
|
316
|
+
* frame follows where the element was read - file-absolute at the root,
|
|
317
|
+
* relative to the enclosing slice inside a defined-length Sequence or Item,
|
|
318
|
+
* and into the inflated stream under Deflated Explicit VR LE - while the
|
|
319
|
+
* snippet is cut from whichever buffer the parse is holding, so the two can
|
|
320
|
+
* disagree and the bytes can be an unrelated element's value. Do not reason
|
|
321
|
+
* from a code's message to what its snippet holds - **measure it, and treat
|
|
322
|
+
* every one of them as document content.**
|
|
323
|
+
*
|
|
324
|
+
* That is the documented design of `snippet` rather than a defect in any one
|
|
325
|
+
* code, and turning this option on does not change what any of them means -
|
|
326
|
+
* but a message-only PHI review of the lenient path does not transfer to the
|
|
327
|
+
* strict one. Log `err.code`, `err.byteOffset` and `err.message`; treat
|
|
328
|
+
* `err.snippet` as PHI.
|
|
329
|
+
*
|
|
310
330
|
* Omit (do not pass `undefined`) to use the default.
|
|
311
331
|
*/
|
|
312
332
|
readonly strict?: boolean;
|
|
@@ -391,11 +411,14 @@ interface ParseOptions {
|
|
|
391
411
|
* ```
|
|
392
412
|
*/
|
|
393
413
|
declare const WARNING_CODES: {
|
|
414
|
+
readonly DICOM_DUPLICATE_FILE_META_ELEMENT: "DICOM_DUPLICATE_FILE_META_ELEMENT";
|
|
415
|
+
readonly DICOM_DUPLICATE_TAG_IN_DATA_SET: "DICOM_DUPLICATE_TAG_IN_DATA_SET";
|
|
394
416
|
readonly DICOM_EMPTY_ITEM_IN_SEQUENCE: "DICOM_EMPTY_ITEM_IN_SEQUENCE";
|
|
395
417
|
readonly DICOM_FILE_META_GROUP_LENGTH_MISMATCH: "DICOM_FILE_META_GROUP_LENGTH_MISMATCH";
|
|
396
418
|
readonly DICOM_FILE_META_GROUP_LENGTH_MISSING: "DICOM_FILE_META_GROUP_LENGTH_MISSING";
|
|
397
419
|
readonly DICOM_GROUP_LENGTH_IN_DATASET: "DICOM_GROUP_LENGTH_IN_DATASET";
|
|
398
420
|
readonly DICOM_IMPLICIT_VR_FOR_PRIVATE_TAG_WITHOUT_VR: "DICOM_IMPLICIT_VR_FOR_PRIVATE_TAG_WITHOUT_VR";
|
|
421
|
+
readonly DICOM_ITEM_CROSSES_SEQUENCE_END: "DICOM_ITEM_CROSSES_SEQUENCE_END";
|
|
399
422
|
readonly DICOM_MISSING_PREAMBLE: "DICOM_MISSING_PREAMBLE";
|
|
400
423
|
readonly DICOM_NONZERO_RESERVED_BYTES: "DICOM_NONZERO_RESERVED_BYTES";
|
|
401
424
|
readonly DICOM_ODD_LENGTH_VALUE_PADDED: "DICOM_ODD_LENGTH_VALUE_PADDED";
|
|
@@ -416,6 +439,9 @@ declare const WARNING_CODES: {
|
|
|
416
439
|
readonly DICOM_UNSUPPORTED_CHARSET: "DICOM_UNSUPPORTED_CHARSET";
|
|
417
440
|
readonly DICOM_BURNED_IN_ANNOTATION_NOT_REMOVED: "DICOM_BURNED_IN_ANNOTATION_NOT_REMOVED";
|
|
418
441
|
readonly DICOM_DEIDENT_EMBEDDED_ATTRIBUTE_REMOVED: "DICOM_DEIDENT_EMBEDDED_ATTRIBUTE_REMOVED";
|
|
442
|
+
readonly DICOM_DEIDENT_METHOD_NOT_ADDED: "DICOM_DEIDENT_METHOD_NOT_ADDED";
|
|
443
|
+
readonly DICOM_DEIDENT_METHOD_NOT_LO: "DICOM_DEIDENT_METHOD_NOT_LO";
|
|
444
|
+
readonly DICOM_DEIDENT_METHOD_PRIOR_RETAINED: "DICOM_DEIDENT_METHOD_PRIOR_RETAINED";
|
|
419
445
|
readonly DICOM_DEIDENT_SEQUENCE_NOT_AUDITABLE: "DICOM_DEIDENT_SEQUENCE_NOT_AUDITABLE";
|
|
420
446
|
readonly DICOM_DEIDENT_UNDEFINED_VR_NOT_AUDITABLE: "DICOM_DEIDENT_UNDEFINED_VR_NOT_AUDITABLE";
|
|
421
447
|
readonly DICOM_PRIVATE_CREATOR_UNKNOWN: "DICOM_PRIVATE_CREATOR_UNKNOWN";
|
|
@@ -2643,7 +2669,15 @@ interface DeidentifyReport {
|
|
|
2643
2669
|
readonly uidMap: ReadonlyMap<string, string>;
|
|
2644
2670
|
/** Safety warnings - notably burned-in-pixel annotation that cannot be cleaned. */
|
|
2645
2671
|
readonly warnings: readonly DicomParseWarning[];
|
|
2646
|
-
/**
|
|
2672
|
+
/**
|
|
2673
|
+
* The Retain/Clean options that were active for this run.
|
|
2674
|
+
*
|
|
2675
|
+
* **Not a list of what survived.** Attributes Table E.1-1 does not list are
|
|
2676
|
+
* kept without appearing anywhere in this field - `(0012,0063)`
|
|
2677
|
+
* De-identification Method is the one whose retention is disclosed, and it is
|
|
2678
|
+
* disclosed as `DICOM_DEIDENT_METHOD_PRIOR_RETAINED` on
|
|
2679
|
+
* {@link DeidentifyReport.warnings}, because it is not an option set.
|
|
2680
|
+
*/
|
|
2647
2681
|
readonly retained: readonly DeidentifyOption[];
|
|
2648
2682
|
}
|
|
2649
2683
|
/**
|
|
@@ -2676,8 +2710,60 @@ interface DeidentifyOptions {
|
|
|
2676
2710
|
*/
|
|
2677
2711
|
readonly profile?: Profile;
|
|
2678
2712
|
/**
|
|
2679
|
-
* Text
|
|
2713
|
+
* Text **added to** `(0012,0063)` De-identification Method. Default names the
|
|
2680
2714
|
* Basic Profile and the active options.
|
|
2715
|
+
*
|
|
2716
|
+
* **The default is multi-valued, one Value per name, and that is a conformance
|
|
2717
|
+
* fix rather than a style choice.** PS3.5 2026c Table 6.2-1 caps an `LO` at
|
|
2718
|
+
* **64 characters per Value**, and `(0012,0063)` is `1-n`; the single-value
|
|
2719
|
+
* default this replaced measured 76 characters with no options and 272 with
|
|
2720
|
+
* all nine, so every run this library ever made wrote a value no `LO` may
|
|
2721
|
+
* legally carry. The Profile name is now one Value of 61 characters and each
|
|
2722
|
+
* active option is its own, so no option subset can exceed the maximum.
|
|
2723
|
+
*
|
|
2724
|
+
* **Your string is not bounded here.** A value of your own longer than 64
|
|
2725
|
+
* characters is written through as given, with no warning: it is yours, and
|
|
2726
|
+
* splitting or truncating it would invent a record you did not write. Split it
|
|
2727
|
+
* on `\` yourself if a strict receiver is in your path.
|
|
2728
|
+
*
|
|
2729
|
+
* PS3.15 E.1.1 says this string is "inserted in or added to" the attribute, so
|
|
2730
|
+
* a value the incoming Data Set already carried is kept and this one is
|
|
2731
|
+
* appended after a `\` as a further value of the `1-n` attribute - the
|
|
2732
|
+
* provenance chain, not a replacement.
|
|
2733
|
+
*
|
|
2734
|
+
* **This string is itself a `1-n` value**: it is split on `\` and only the
|
|
2735
|
+
* values not already recorded are added.
|
|
2736
|
+
*
|
|
2737
|
+
* **Trailing SPACE and NUL are padding, not content** (PS3.5 Table 6.2-1's `LO`
|
|
2738
|
+
* row, which describes a **Value** - and `LO` is `1-n`). They are ignored when
|
|
2739
|
+
* a value here is matched against one already recorded, **per value, on both
|
|
2740
|
+
* sides**, and they are trimmed from the value written. That makes repeated
|
|
2741
|
+
* de-identification a fixed point **from the first pass**, for every string:
|
|
2742
|
+
* with or without a delimiter, and with a pad byte on any value, last or not.
|
|
2743
|
+
* A string that is padding only records nothing. Leading spaces are yours and
|
|
2744
|
+
* are written through untouched.
|
|
2745
|
+
*
|
|
2746
|
+
* One bound, and it is over the value that would be **written**, not over the
|
|
2747
|
+
* join: when that value would exceed the largest Value Length an `LO` can
|
|
2748
|
+
* encode, the prior value is **replaced** rather than added to - an element the
|
|
2749
|
+
* serializer cannot encode would take the whole de-identified object down - and
|
|
2750
|
+
* `report.warnings` carries `DICOM_DEIDENT_METHOD_NOT_ADDED`. That includes a
|
|
2751
|
+
* prior value already at the ceiling which records this method already, where
|
|
2752
|
+
* there is no join to exceed anything. A string longer than that ceiling on its
|
|
2753
|
+
* own is not bounded here and will fail to serialize, exactly as it did before
|
|
2754
|
+
* this option grew a join.
|
|
2755
|
+
*
|
|
2756
|
+
* `DICOM_DEIDENT_METHOD_NOT_ADDED` means "the length ceiling was reached", never
|
|
2757
|
+
* "every fallback is disclosed": a `(0012,0063)` a file encoded under a VR other
|
|
2758
|
+
* than `LO` is also replaced, and that one raises `DICOM_DEIDENT_METHOD_NOT_LO`.
|
|
2759
|
+
* Two codes rather than one because the causes are unrelated - the chain outgrew
|
|
2760
|
+
* the VR, or the bytes were never in that VR at all - and a prior value that is
|
|
2761
|
+
* empty or padding only raises neither, because nothing was lost.
|
|
2762
|
+
*
|
|
2763
|
+
* When the prior value **is** kept, `report.warnings` carries
|
|
2764
|
+
* `DICOM_DEIDENT_METHOD_PRIOR_RETAINED`: `(0012,0063)` is not in Table E.1-1, so
|
|
2765
|
+
* nothing in the run inspected or redacted those bytes, and a name a sender
|
|
2766
|
+
* wrote there is in output stamped `(0012,0062) = YES`.
|
|
2681
2767
|
*/
|
|
2682
2768
|
readonly deidentificationMethod?: string;
|
|
2683
2769
|
}
|
|
@@ -2775,8 +2861,10 @@ declare class DeidentifyError extends Error {
|
|
|
2775
2861
|
* {@link Profile}, keeps the private data elements the profile's overlay names
|
|
2776
2862
|
* as safe (and the private-creator elements the profile recognizes).
|
|
2777
2863
|
* - Remaps `(0002,0003)` Media Storage SOP Instance UID consistently (unless
|
|
2778
|
-
* `RetainUIDs`), writes `(0012,0062)` Patient Identity Removed = `YES
|
|
2779
|
-
* `(0012,0063)` De-identification Method
|
|
2864
|
+
* `RetainUIDs`), writes `(0012,0062)` Patient Identity Removed = `YES`, **adds**
|
|
2865
|
+
* its method text to `(0012,0063)` De-identification Method rather than
|
|
2866
|
+
* replacing what the file already recorded there (PS3.15 E.1.1 - see
|
|
2867
|
+
* `addDeidentificationMethod`), and warns
|
|
2780
2868
|
* (`DICOM_BURNED_IN_ANNOTATION_NOT_REMOVED`) when Pixel Data is present and not
|
|
2781
2869
|
* marked free of burned-in annotation - this metadata-only pass cannot clean
|
|
2782
2870
|
* pixels (deferred to `@cosyte/dicom-pixel`).
|
|
@@ -2851,7 +2939,21 @@ declare class DeidentifyError extends Error {
|
|
|
2851
2939
|
* private value the sender wrote **outside** the sequence was retained on the
|
|
2852
2940
|
* Item's reservation and written into output stamped `PatientIdentityRemoved =
|
|
2853
2941
|
* YES` with `removedPrivateTags: []` (`DICOM-PRIVATE-CREATOR-RESERVATION-LEAK`,
|
|
2854
|
-
*
|
|
2942
|
+
* measured on the published `0.0.8` tarball and fixed on `0.0.10`; there is no `0.0.9` on
|
|
2943
|
+
* the registry). See {@link itemStreamOverrunsSequence}.
|
|
2944
|
+
* - `RetainSafePrivate` **retains nothing that a Data Set holds after a sequence
|
|
2945
|
+
* whose own contents contradict the extent it declared** - the mirror
|
|
2946
|
+
* direction, where an Item that *under*-declares **ejects** its trailing
|
|
2947
|
+
* elements out and a Private Creator landing in the enclosing Data Set reserves
|
|
2948
|
+
* a block for elements the sender never put beside it. The same false
|
|
2949
|
+
* attestation, and it applies **in every Data Set, not just the root**: an
|
|
2950
|
+
* inner sequence ejecting a creator into the still-usable Item that encloses it
|
|
2951
|
+
* is measured and pinned. The cut is positional, so a reservation the sender
|
|
2952
|
+
* wrote **ahead of** the offending sequence is untouched. Every private element
|
|
2953
|
+
* after that point is removed and named in `report.removedPrivateTags`, and the
|
|
2954
|
+
* **private-`SQ` carve-out above still applies**: a private `SQ` inside the
|
|
2955
|
+
* settled run that the profile vouches for is kept verbatim and never walked.
|
|
2956
|
+
* See {@link settledBound}.
|
|
2855
2957
|
*
|
|
2856
2958
|
* @module
|
|
2857
2959
|
*/
|