dicom-synth 1.17.0 → 1.19.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/README.md CHANGED
@@ -24,7 +24,7 @@ for await (const file of generateCollectionFromSpec({
24
24
  entries: [{ type: 'valid-image', count: 5 }],
25
25
  seed: 42,
26
26
  })) {
27
- console.log(file.filename, file.buffer.length) // Buffer ready to parse or pipe
27
+ console.log(file.filename, file.buffer.length) // Uint8Array ready to parse or pipe
28
28
  }
29
29
  ```
30
30
 
@@ -6,7 +6,7 @@ import { describeDirectory } from '../dist/esm/index.js'
6
6
 
7
7
  function usage() {
8
8
  console.error(
9
- 'Usage: dicom-synth-describe <dir> [--out <spec.json[.gz]>] [--tree] [--keep-tags <a,b,...>] [--keep-tags-file <path>] [--size-tolerance <fraction>] [--no-preserve-uids] [--uid-salt <hex>] [--gzip]\n' +
9
+ 'Usage: dicom-synth-describe <dir> [--out <spec.json[.gz]>] [--tree] [--keep-tags <a,b,...>] [--keep-tags-file <path>] [--keep-private-tags] [--size-tolerance <fraction>] [--no-preserve-uids] [--uid-salt <hex>] [--gzip]\n' +
10
10
  '\n' +
11
11
  'Scans a DICOM tree and emits a DatasetSpec describing its shape\n' +
12
12
  '(studies/series, per-file size, modality).\n' +
@@ -22,6 +22,13 @@ function usage() {
22
22
  "responsibility, not this tool's.\n" +
23
23
  '--keep-tags-file reads the same allow-list from a file (one tag per\n' +
24
24
  'line, # comments); merged with any --keep-tags.\n' +
25
+ '--keep-private-tags captures ALL private (odd-group) elements as-is as\n' +
26
+ 'raw { vr, value } tag forms — creators, scalars, nested private\n' +
27
+ 'sequences. Private blocks routinely carry PHI/device detail: handling\n' +
28
+ "that is the caller's responsibility. UID-valued leaves are still\n" +
29
+ 'hashed unless --no-preserve-uids. Individual private tags can instead\n' +
30
+ 'be named (8-hex) in --keep-tags. Binary/unparseable payloads are\n' +
31
+ 'skipped and counted.\n' +
25
32
  '--size-tolerance folds near-identical file sizes (fraction, e.g. 0.05\n' +
26
33
  '= ±5%) into one entry; default exact.\n' +
27
34
  '--no-preserve-uids emits shape only with freshly minted UIDs (no link\n' +
@@ -52,6 +59,7 @@ let preserveUids = true
52
59
  let uidSalt
53
60
  let gzip = false
54
61
  let captureTree = false
62
+ let keepPrivateTags = false
55
63
  const keepTags = []
56
64
 
57
65
  for (let i = 0; i < args.length; i++) {
@@ -77,6 +85,8 @@ for (let i = 0; i < args.length; i++) {
77
85
  console.error('--size-tolerance must be a non-negative number')
78
86
  process.exit(1)
79
87
  }
88
+ } else if (args[i] === '--keep-private-tags') {
89
+ keepPrivateTags = true
80
90
  } else if (args[i] === '--no-preserve-uids') {
81
91
  preserveUids = false
82
92
  } else if (args[i] === '--tree') {
@@ -107,6 +117,7 @@ let result
107
117
  try {
108
118
  result = describeDirectory(dir, {
109
119
  ...(keepTags.length ? { keepTags } : {}),
120
+ ...(keepPrivateTags ? { keepPrivateTags: true } : {}),
110
121
  ...(sizeTolerance !== undefined ? { sizeTolerance } : {}),
111
122
  preserveUids,
112
123
  ...(uidSalt !== undefined ? { uidSalt } : {}),