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.
- package/README.md +348 -55
- package/bin/dicom-synth-generate.mjs +85 -0
- package/dist/esm/collection/writer.js +386 -0
- package/dist/esm/index.js +498 -177
- package/dist/esm/schema/types.js +0 -0
- package/dist/esm/schema/validate.js +140 -0
- package/dist/esm/syntheticFixtures/generator.js +140 -103
- package/dist/esm/syntheticFixtures/uid.js +40 -0
- package/dist/esm/syntheticFixtures/violations.js +115 -0
- package/dist/types/collection/writer.d.ts +19 -0
- package/dist/types/index.d.ts +5 -5
- package/dist/types/schema/types.d.ts +48 -0
- package/dist/types/schema/validate.d.ts +3 -0
- package/dist/types/syntheticFixtures/generator.d.ts +3 -27
- package/dist/types/syntheticFixtures/uid.d.ts +7 -0
- package/dist/types/syntheticFixtures/violations.d.ts +2 -0
- package/package.json +3 -3
- package/bin/dicom-synth-write.mjs +0 -9
- package/dist/esm/negativeCases/index.js +0 -17
- package/dist/types/negativeCases/index.d.ts +0 -11
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dicom-synth",
|
|
3
|
-
"version": "1.
|
|
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.
|
|
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-
|
|
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;
|