@ubercode/dcmtk 1.0.0-rc.1 → 1.0.0-rc.3

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.
@@ -460,10 +460,28 @@ interface FileIOOptions {
460
460
  }
461
461
  /** Options for opening a DICOM file. Extends FileIOOptions with read-specific settings. */
462
462
  interface DicomOpenOptions extends FileIOOptions {
463
- /** Assume the specified character set when SpecificCharacterSet (0008,0005) is absent. Maps to dcm2xml `+Ca`. */
463
+ /** Assume the specified character set when SpecificCharacterSet (0008,0005) is absent. Accepts DICOM defined terms ('ISO_IR 100') or DCMTK-style aliases ('latin-1'). */
464
464
  readonly charsetAssume?: string | undefined;
465
- /** Fallback charset to retry with when UTF-8 conversion fails due to illegal byte sequences. Maps to dcm2xml `+Ca`. When set, a charset conversion failure triggers an automatic retry with this charset assumed. `'Latin1'` is recommended — it maps every byte 0x00-0xFF to a valid character, so conversion never fails. */
465
+ /** Fallback charset to decode with when the file's character set is unsupported or conversion fails. `'latin-1'` is recommended — it maps every byte 0x00-0xFF to a valid character, so decoding never fails. */
466
466
  readonly charsetFallback?: string | undefined;
467
+ /**
468
+ * Decode values detected as mislabeled UTF-8 (high bytes forming valid UTF-8 under a single-byte declared charset)
469
+ * as UTF-8 instead of the declared charset. A `possible UTF-8 mislabel` warning is surfaced either way via
470
+ * `DicomInstance.warnings`. JS engine only. Defaults to false.
471
+ */
472
+ readonly utf8MislabelPromote?: boolean | undefined;
473
+ /**
474
+ * Bounded head-read: for files above ~8 MB, read only the metadata and skip bulk value bytes.
475
+ * Output is identical; peak memory scales with metadata instead of file size. JS engine only.
476
+ * Defaults to true.
477
+ */
478
+ readonly boundedRead?: boolean | undefined;
479
+ /**
480
+ * Parse engine. `'js'` (default) parses in-process via {@link dicom2json}
481
+ * and automatically falls back to the DCMTK binaries when the JS parser
482
+ * fails; `'dcmtk'` uses the deprecated dcm2json binary path exclusively.
483
+ */
484
+ readonly engine?: 'js' | 'dcmtk' | undefined;
467
485
  }
468
486
 
469
487
  /**
@@ -499,7 +517,10 @@ declare class DicomInstance {
499
517
  private readonly changeSet;
500
518
  private readonly filepath;
501
519
  private readonly meta;
520
+ private readonly warningList;
502
521
  private constructor();
522
+ /** Creates a copy with the given fields replaced. */
523
+ private derive;
503
524
  /**
504
525
  * Opens a DICOM file and creates a DicomInstance.
505
526
  *
@@ -524,6 +545,13 @@ declare class DicomInstance {
524
545
  get hasUnsavedChanges(): boolean;
525
546
  /** The file path, or undefined if this instance has no associated file. */
526
547
  get filePath(): string | undefined;
548
+ /**
549
+ * Non-fatal parser warnings from opening the file (e.g. `possible UTF-8 mislabel: <tag>`).
550
+ *
551
+ * Empty for instances created via {@link DicomInstance.fromDataset} or opened with
552
+ * `engine: 'dcmtk'`. Preserved across fluent modifications.
553
+ */
554
+ get warnings(): readonly string[];
527
555
  /** Patient's Name (0010,0010). */
528
556
  get patientName(): string;
529
557
  /** Patient ID (0010,0020). */
@@ -460,10 +460,28 @@ interface FileIOOptions {
460
460
  }
461
461
  /** Options for opening a DICOM file. Extends FileIOOptions with read-specific settings. */
462
462
  interface DicomOpenOptions extends FileIOOptions {
463
- /** Assume the specified character set when SpecificCharacterSet (0008,0005) is absent. Maps to dcm2xml `+Ca`. */
463
+ /** Assume the specified character set when SpecificCharacterSet (0008,0005) is absent. Accepts DICOM defined terms ('ISO_IR 100') or DCMTK-style aliases ('latin-1'). */
464
464
  readonly charsetAssume?: string | undefined;
465
- /** Fallback charset to retry with when UTF-8 conversion fails due to illegal byte sequences. Maps to dcm2xml `+Ca`. When set, a charset conversion failure triggers an automatic retry with this charset assumed. `'Latin1'` is recommended — it maps every byte 0x00-0xFF to a valid character, so conversion never fails. */
465
+ /** Fallback charset to decode with when the file's character set is unsupported or conversion fails. `'latin-1'` is recommended — it maps every byte 0x00-0xFF to a valid character, so decoding never fails. */
466
466
  readonly charsetFallback?: string | undefined;
467
+ /**
468
+ * Decode values detected as mislabeled UTF-8 (high bytes forming valid UTF-8 under a single-byte declared charset)
469
+ * as UTF-8 instead of the declared charset. A `possible UTF-8 mislabel` warning is surfaced either way via
470
+ * `DicomInstance.warnings`. JS engine only. Defaults to false.
471
+ */
472
+ readonly utf8MislabelPromote?: boolean | undefined;
473
+ /**
474
+ * Bounded head-read: for files above ~8 MB, read only the metadata and skip bulk value bytes.
475
+ * Output is identical; peak memory scales with metadata instead of file size. JS engine only.
476
+ * Defaults to true.
477
+ */
478
+ readonly boundedRead?: boolean | undefined;
479
+ /**
480
+ * Parse engine. `'js'` (default) parses in-process via {@link dicom2json}
481
+ * and automatically falls back to the DCMTK binaries when the JS parser
482
+ * fails; `'dcmtk'` uses the deprecated dcm2json binary path exclusively.
483
+ */
484
+ readonly engine?: 'js' | 'dcmtk' | undefined;
467
485
  }
468
486
 
469
487
  /**
@@ -499,7 +517,10 @@ declare class DicomInstance {
499
517
  private readonly changeSet;
500
518
  private readonly filepath;
501
519
  private readonly meta;
520
+ private readonly warningList;
502
521
  private constructor();
522
+ /** Creates a copy with the given fields replaced. */
523
+ private derive;
503
524
  /**
504
525
  * Opens a DICOM file and creates a DicomInstance.
505
526
  *
@@ -524,6 +545,13 @@ declare class DicomInstance {
524
545
  get hasUnsavedChanges(): boolean;
525
546
  /** The file path, or undefined if this instance has no associated file. */
526
547
  get filePath(): string | undefined;
548
+ /**
549
+ * Non-fatal parser warnings from opening the file (e.g. `possible UTF-8 mislabel: <tag>`).
550
+ *
551
+ * Empty for instances created via {@link DicomInstance.fromDataset} or opened with
552
+ * `engine: 'dcmtk'`. Preserved across fluent modifications.
553
+ */
554
+ get warnings(): readonly string[];
527
555
  /** Patient's Name (0010,0010). */
528
556
  get patientName(): string;
529
557
  /** Patient ID (0010,0020). */