dicom-synth 1.0.0 → 1.1.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.
@@ -1,27 +1,3 @@
1
- import type * as Dcmjs from 'dcmjs';
2
- export type SyntheticCtVariant = 'minimal-invalid-uid' | 'valid-uid' | 'vendor-warnings';
3
- export declare function buildDicomDict(variant: SyntheticCtVariant): Dcmjs.data.DicomDict;
4
- export declare function buildSyntheticCtBuffer(variant: SyntheticCtVariant): Buffer;
5
- export declare const SYNTHETIC_FIXTURES: {
6
- filename: string;
7
- variant: SyntheticCtVariant;
8
- description: string;
9
- }[];
10
- export type MinimalDicomTags = {
11
- patientId?: string;
12
- patientName?: string;
13
- sopInstanceUid?: string;
14
- };
15
- /**
16
- * Write a minimal CT DICOM file to `filePath`.
17
- *
18
- * The output is intentionally bare: it contains no Part 10 group-0002
19
- * file-meta header (no MediaStorageSOPClassUID, TransferSyntaxUID, etc.).
20
- * Use `buildDicomDict` / `buildSyntheticCtBuffer` when a conformant
21
- * Part 10 file with a complete meta header is required.
22
- *
23
- * The parent directory is created if it does not exist.
24
- */
25
- export declare function writeMinimalDicomFile(filePath: string, tags?: MinimalDicomTags): void;
26
- /** Write all catalogue fixtures to a directory (created if missing). */
27
- export declare function writeSyntheticFixturesToDir(outDir: string): string[];
1
+ import type { FileSpec } from '../schema/types.js';
2
+ import type { UidSet } from './uid.js';
3
+ export declare function buildBufferForSpec(spec: FileSpec, uid: UidSet): Buffer;
@@ -0,0 +1,7 @@
1
+ export type UidSet = {
2
+ study: string;
3
+ series: string;
4
+ sop: string;
5
+ };
6
+ export type UidGenerator = (fileIndex: number) => UidSet;
7
+ export declare function makeUidGenerator(seed?: number): UidGenerator;
@@ -0,0 +1,2 @@
1
+ import type { ViolationClass } from '../schema/types.js';
2
+ export declare function applyViolations(buffer: Buffer, violations: ViolationClass[]): Buffer;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "dicom-synth",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Toolkit for synthetic DICOM fixtures and public fixture fetch/cache.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
- "packageManager": "pnpm@11.3.0",
7
+ "packageManager": "pnpm@11.5.2",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/clintools/dicom-synth.git"
@@ -22,7 +22,7 @@
22
22
  "module": "dist/esm/index.js",
23
23
  "types": "dist/types/index.d.ts",
24
24
  "bin": {
25
- "dicom-synth-write": "./bin/dicom-synth-write.mjs",
25
+ "dicom-synth-generate": "./bin/dicom-synth-generate.mjs",
26
26
  "dicom-synth-fetch": "./bin/dicom-synth-fetch.mjs"
27
27
  },
28
28
  "exports": {
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import { resolve } from 'node:path'
3
- import { writeSyntheticFixturesToDir } from '../dist/esm/index.js'
4
-
5
- const outDir = resolve(process.argv[2] ?? './fixtures/synthetic')
6
- const paths = writeSyntheticFixturesToDir(outDir)
7
- for (const p of paths) {
8
- console.log(`wrote ${p}`)
9
- }
@@ -1,17 +0,0 @@
1
- // src/negativeCases/index.ts
2
- import { mkdirSync, writeFileSync } from "node:fs";
3
- import { resolve } from "node:path";
4
- function writeFakeDicomSignatureFile(filePath) {
5
- const buf = Buffer.alloc(200, 0);
6
- buf.write("XXXX", 128, 4, "ascii");
7
- mkdirSync(resolve(filePath, ".."), { recursive: true });
8
- writeFileSync(filePath, buf);
9
- }
10
- function writeNonDicomFile(filePath, content = "not dicom") {
11
- mkdirSync(resolve(filePath, ".."), { recursive: true });
12
- writeFileSync(filePath, content);
13
- }
14
- export {
15
- writeFakeDicomSignatureFile,
16
- writeNonDicomFile
17
- };
@@ -1,11 +0,0 @@
1
- /**
2
- * Write a file large enough to pass size checks but with `XXXX` at
3
- * offset 128 instead of the `DICM` magic bytes.
4
- * The parent directory is created if it does not exist.
5
- */
6
- export declare function writeFakeDicomSignatureFile(filePath: string): void;
7
- /**
8
- * Write arbitrary non-DICOM content to `filePath`.
9
- * The parent directory is created if it does not exist.
10
- */
11
- export declare function writeNonDicomFile(filePath: string, content?: string): void;