@ubercode/dcmtk 0.2.0 → 0.4.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 +17 -12
- package/dist/{DicomInstance-CQEIuF_x.d.ts → DicomInstance-CGBr3a-C.d.ts} +2 -2
- package/dist/{DicomInstance-By9zd7GM.d.cts → DicomInstance-DWOjhccQ.d.cts} +2 -2
- package/dist/{dcmodify-Gds9u5Vj.d.cts → dcmodify-B9js5K1f.d.cts} +2 -0
- package/dist/{dcmodify-B-_uUIKB.d.ts → dcmodify-BvaIeyJg.d.ts} +2 -0
- package/dist/dicom.cjs +27 -11
- package/dist/dicom.cjs.map +1 -1
- package/dist/dicom.d.cts +3 -3
- package/dist/dicom.d.ts +3 -3
- package/dist/dicom.js +27 -11
- package/dist/dicom.js.map +1 -1
- package/dist/index.cjs +1299 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +320 -7
- package/dist/index.d.ts +320 -7
- package/dist/index.js +1297 -173
- package/dist/index.js.map +1 -1
- package/dist/servers.cjs +28 -12
- package/dist/servers.cjs.map +1 -1
- package/dist/servers.d.cts +2 -2
- package/dist/servers.d.ts +2 -2
- package/dist/servers.js +28 -12
- package/dist/servers.js.map +1 -1
- package/dist/tools.cjs +755 -157
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.d.cts +226 -10
- package/dist/tools.d.ts +226 -10
- package/dist/tools.js +755 -157
- package/dist/tools.js.map +1 -1
- package/package.json +17 -1
package/dist/tools.cjs
CHANGED
|
@@ -97,7 +97,7 @@ async function spawnCommand(binary, args, options) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
// src/patterns.ts
|
|
100
|
-
var AE_TITLE_PATTERN = /^[
|
|
100
|
+
var AE_TITLE_PATTERN = /^[\x20-\x5b\x5d-\x7e]+$/;
|
|
101
101
|
var DICOM_QUERY_KEY_PATTERN = /^[0-9A-Fa-f]{4},[0-9A-Fa-f]{4}(?:[\[.\]0-9A-Fa-f,]*)?(?:=.*)?$/;
|
|
102
102
|
function isValidDicomKey(key) {
|
|
103
103
|
return DICOM_QUERY_KEY_PATTERN.test(key);
|
|
@@ -249,19 +249,17 @@ var Dcm2xmlCharset = {
|
|
|
249
249
|
/** Use ASCII encoding. */
|
|
250
250
|
ASCII: "ascii"
|
|
251
251
|
};
|
|
252
|
+
var VERBOSITY_FLAGS = { verbose: "-v", debug: "-d" };
|
|
252
253
|
var Dcm2xmlOptionsSchema = zod.z.object({
|
|
253
254
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
254
255
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
255
256
|
namespace: zod.z.boolean().optional(),
|
|
256
257
|
charset: zod.z.enum(["utf8", "latin1", "ascii"]).optional(),
|
|
257
258
|
writeBinaryData: zod.z.boolean().optional(),
|
|
258
|
-
encodeBinaryBase64: zod.z.boolean().optional()
|
|
259
|
+
encodeBinaryBase64: zod.z.boolean().optional(),
|
|
260
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
259
261
|
}).strict().optional();
|
|
260
|
-
function
|
|
261
|
-
const args = [];
|
|
262
|
-
if (options?.namespace === true) {
|
|
263
|
-
args.push("+Xn");
|
|
264
|
-
}
|
|
262
|
+
function pushEncodingArgs(args, options) {
|
|
265
263
|
if (options?.charset === "latin1") {
|
|
266
264
|
args.push("+Cl");
|
|
267
265
|
} else if (options?.charset === "ascii") {
|
|
@@ -273,6 +271,16 @@ function buildArgs(inputPath, options) {
|
|
|
273
271
|
args.push("+Eb");
|
|
274
272
|
}
|
|
275
273
|
}
|
|
274
|
+
}
|
|
275
|
+
function buildArgs(inputPath, options) {
|
|
276
|
+
const args = [];
|
|
277
|
+
if (options?.verbosity !== void 0) {
|
|
278
|
+
args.push(VERBOSITY_FLAGS[options.verbosity]);
|
|
279
|
+
}
|
|
280
|
+
if (options?.namespace === true) {
|
|
281
|
+
args.push("+Xn");
|
|
282
|
+
}
|
|
283
|
+
pushEncodingArgs(args, options);
|
|
276
284
|
args.push(inputPath);
|
|
277
285
|
return args;
|
|
278
286
|
}
|
|
@@ -503,19 +511,28 @@ function repairJson(raw) {
|
|
|
503
511
|
var Dcm2jsonOptionsSchema = zod.z.object({
|
|
504
512
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
505
513
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
506
|
-
directOnly: zod.z.boolean().optional()
|
|
514
|
+
directOnly: zod.z.boolean().optional(),
|
|
515
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
507
516
|
}).strict().optional();
|
|
508
|
-
|
|
517
|
+
var VERBOSITY_FLAGS2 = { verbose: "-v", debug: "-d" };
|
|
518
|
+
function buildVerbosityArgs(verbosity) {
|
|
519
|
+
if (verbosity !== void 0) {
|
|
520
|
+
return [VERBOSITY_FLAGS2[verbosity]];
|
|
521
|
+
}
|
|
522
|
+
return [];
|
|
523
|
+
}
|
|
524
|
+
async function tryXmlPath(inputPath, timeoutMs, signal, verbosity) {
|
|
509
525
|
const xmlBinary = resolveBinary("dcm2xml");
|
|
510
526
|
if (!xmlBinary.ok) {
|
|
511
527
|
return err(xmlBinary.error);
|
|
512
528
|
}
|
|
513
|
-
const
|
|
529
|
+
const xmlArgs = [...buildVerbosityArgs(verbosity), "-nat", inputPath];
|
|
530
|
+
const xmlResult = await execCommand(xmlBinary.value, xmlArgs, { timeoutMs, signal });
|
|
514
531
|
if (!xmlResult.ok) {
|
|
515
532
|
return err(xmlResult.error);
|
|
516
533
|
}
|
|
517
534
|
if (xmlResult.value.exitCode !== 0) {
|
|
518
|
-
return err(createToolError("dcm2xml",
|
|
535
|
+
return err(createToolError("dcm2xml", xmlArgs, xmlResult.value.exitCode, xmlResult.value.stderr));
|
|
519
536
|
}
|
|
520
537
|
const jsonResult = xmlToJson(xmlResult.value.stdout);
|
|
521
538
|
if (!jsonResult.ok) {
|
|
@@ -523,17 +540,18 @@ async function tryXmlPath(inputPath, timeoutMs, signal) {
|
|
|
523
540
|
}
|
|
524
541
|
return ok({ data: jsonResult.value, source: "xml" });
|
|
525
542
|
}
|
|
526
|
-
async function tryDirectPath(inputPath, timeoutMs, signal) {
|
|
543
|
+
async function tryDirectPath(inputPath, timeoutMs, signal, verbosity) {
|
|
527
544
|
const jsonBinary = resolveBinary("dcm2json");
|
|
528
545
|
if (!jsonBinary.ok) {
|
|
529
546
|
return err(jsonBinary.error);
|
|
530
547
|
}
|
|
531
|
-
const
|
|
548
|
+
const directArgs = [...buildVerbosityArgs(verbosity), inputPath];
|
|
549
|
+
const result = await execCommand(jsonBinary.value, directArgs, { timeoutMs, signal });
|
|
532
550
|
if (!result.ok) {
|
|
533
551
|
return err(result.error);
|
|
534
552
|
}
|
|
535
553
|
if (result.value.exitCode !== 0) {
|
|
536
|
-
return err(createToolError("dcm2json",
|
|
554
|
+
return err(createToolError("dcm2json", directArgs, result.value.exitCode, result.value.stderr));
|
|
537
555
|
}
|
|
538
556
|
try {
|
|
539
557
|
const repaired = repairJson(result.value.stdout);
|
|
@@ -550,14 +568,15 @@ async function dcm2json(inputPath, options) {
|
|
|
550
568
|
}
|
|
551
569
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
552
570
|
const signal = options?.signal;
|
|
571
|
+
const verbosity = options?.verbosity;
|
|
553
572
|
if (options?.directOnly === true) {
|
|
554
|
-
return tryDirectPath(inputPath, timeoutMs, signal);
|
|
573
|
+
return tryDirectPath(inputPath, timeoutMs, signal, verbosity);
|
|
555
574
|
}
|
|
556
|
-
const xmlResult = await tryXmlPath(inputPath, timeoutMs, signal);
|
|
575
|
+
const xmlResult = await tryXmlPath(inputPath, timeoutMs, signal, verbosity);
|
|
557
576
|
if (xmlResult.ok) {
|
|
558
577
|
return xmlResult;
|
|
559
578
|
}
|
|
560
|
-
return tryDirectPath(inputPath, timeoutMs, signal);
|
|
579
|
+
return tryDirectPath(inputPath, timeoutMs, signal, verbosity);
|
|
561
580
|
}
|
|
562
581
|
var DcmdumpFormat = {
|
|
563
582
|
/** Print standard DCMTK format. */
|
|
@@ -565,16 +584,17 @@ var DcmdumpFormat = {
|
|
|
565
584
|
/** Print tag and value only. */
|
|
566
585
|
SHORT: "short"
|
|
567
586
|
};
|
|
587
|
+
var VERBOSITY_FLAGS3 = { verbose: "-v", debug: "-d" };
|
|
568
588
|
var DcmdumpOptionsSchema = zod.z.object({
|
|
569
589
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
570
590
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
571
591
|
format: zod.z.enum(["standard", "short"]).optional(),
|
|
572
592
|
allTags: zod.z.boolean().optional(),
|
|
573
593
|
searchTag: zod.z.string().regex(/^\([0-9A-Fa-f]{4},[0-9A-Fa-f]{4}\)$/).optional(),
|
|
574
|
-
printValues: zod.z.boolean().optional()
|
|
594
|
+
printValues: zod.z.boolean().optional(),
|
|
595
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
575
596
|
}).strict().optional();
|
|
576
|
-
function
|
|
577
|
-
const args = [];
|
|
597
|
+
function pushDisplayArgs(args, options) {
|
|
578
598
|
if (options?.format === "short") {
|
|
579
599
|
args.push("+L");
|
|
580
600
|
}
|
|
@@ -588,6 +608,13 @@ function buildArgs2(inputPath, options) {
|
|
|
588
608
|
if (options?.printValues === true) {
|
|
589
609
|
args.push("+Vr");
|
|
590
610
|
}
|
|
611
|
+
}
|
|
612
|
+
function buildArgs2(inputPath, options) {
|
|
613
|
+
const args = [];
|
|
614
|
+
if (options?.verbosity !== void 0) {
|
|
615
|
+
args.push(VERBOSITY_FLAGS3[options.verbosity]);
|
|
616
|
+
}
|
|
617
|
+
pushDisplayArgs(args, options);
|
|
591
618
|
args.push(inputPath);
|
|
592
619
|
return args;
|
|
593
620
|
}
|
|
@@ -634,7 +661,8 @@ var VALID_TRANSFER_SYNTAXES = ["+ti", "+te", "+tb", "+tl", "+t2", "+tr", "+td"];
|
|
|
634
661
|
var DcmconvOptionsSchema = zod.z.object({
|
|
635
662
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
636
663
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
637
|
-
transferSyntax: zod.z.enum(VALID_TRANSFER_SYNTAXES)
|
|
664
|
+
transferSyntax: zod.z.enum(VALID_TRANSFER_SYNTAXES),
|
|
665
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
638
666
|
}).strict();
|
|
639
667
|
async function dcmconv(inputPath, outputPath, options) {
|
|
640
668
|
const validation = DcmconvOptionsSchema.safeParse(options);
|
|
@@ -645,7 +673,13 @@ async function dcmconv(inputPath, outputPath, options) {
|
|
|
645
673
|
if (!binaryResult.ok) {
|
|
646
674
|
return err(binaryResult.error);
|
|
647
675
|
}
|
|
648
|
-
const args = [
|
|
676
|
+
const args = [];
|
|
677
|
+
if (options.verbosity === "verbose") {
|
|
678
|
+
args.push("-v");
|
|
679
|
+
} else if (options.verbosity === "debug") {
|
|
680
|
+
args.push("-d");
|
|
681
|
+
}
|
|
682
|
+
args.push(options.transferSyntax, inputPath, outputPath);
|
|
649
683
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
650
684
|
const result = await execCommand(binaryResult.value, args, {
|
|
651
685
|
timeoutMs,
|
|
@@ -664,6 +698,7 @@ var TagModificationSchema = zod.z.object({
|
|
|
664
698
|
tag: zod.z.string().regex(TAG_OR_PATH_PATTERN),
|
|
665
699
|
value: zod.z.string()
|
|
666
700
|
});
|
|
701
|
+
var VERBOSITY_FLAGS4 = { verbose: "-v", debug: "-d" };
|
|
667
702
|
var DcmodifyOptionsSchema = zod.z.object({
|
|
668
703
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
669
704
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
@@ -672,12 +707,16 @@ var DcmodifyOptionsSchema = zod.z.object({
|
|
|
672
707
|
erasePrivateTags: zod.z.boolean().optional(),
|
|
673
708
|
noBackup: zod.z.boolean().optional(),
|
|
674
709
|
insertIfMissing: zod.z.boolean().optional(),
|
|
675
|
-
ignoreMissingTags: zod.z.boolean().optional()
|
|
710
|
+
ignoreMissingTags: zod.z.boolean().optional(),
|
|
711
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
676
712
|
}).strict().refine((data) => data.modifications.length > 0 || data.erasures !== void 0 && data.erasures.length > 0 || data.erasePrivateTags === true, {
|
|
677
713
|
message: "At least one of modifications, erasures, or erasePrivateTags is required"
|
|
678
714
|
});
|
|
679
715
|
function buildArgs3(inputPath, options) {
|
|
680
716
|
const args = [];
|
|
717
|
+
if (options.verbosity !== void 0) {
|
|
718
|
+
args.push(VERBOSITY_FLAGS4[options.verbosity]);
|
|
719
|
+
}
|
|
681
720
|
if (options.noBackup !== false) {
|
|
682
721
|
args.push("-nb");
|
|
683
722
|
}
|
|
@@ -725,8 +764,18 @@ async function dcmodify(inputPath, options) {
|
|
|
725
764
|
}
|
|
726
765
|
var DcmftestOptionsSchema = zod.z.object({
|
|
727
766
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
728
|
-
signal: zod.z.instanceof(AbortSignal).optional()
|
|
767
|
+
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
768
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
729
769
|
}).strict().optional();
|
|
770
|
+
var VERBOSITY_FLAGS5 = { verbose: "-v", debug: "-d" };
|
|
771
|
+
function buildArgs4(inputPath, options) {
|
|
772
|
+
const args = [];
|
|
773
|
+
if (options?.verbosity !== void 0) {
|
|
774
|
+
args.push(VERBOSITY_FLAGS5[options.verbosity]);
|
|
775
|
+
}
|
|
776
|
+
args.push(inputPath);
|
|
777
|
+
return args;
|
|
778
|
+
}
|
|
730
779
|
async function dcmftest(inputPath, options) {
|
|
731
780
|
const validation = DcmftestOptionsSchema.safeParse(options);
|
|
732
781
|
if (!validation.success) {
|
|
@@ -736,7 +785,7 @@ async function dcmftest(inputPath, options) {
|
|
|
736
785
|
if (!binaryResult.ok) {
|
|
737
786
|
return err(binaryResult.error);
|
|
738
787
|
}
|
|
739
|
-
const args =
|
|
788
|
+
const args = buildArgs4(inputPath, options);
|
|
740
789
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
741
790
|
const result = await execCommand(binaryResult.value, args, {
|
|
742
791
|
timeoutMs,
|
|
@@ -760,10 +809,16 @@ var DcmgpdirOptionsSchema = zod.z.object({
|
|
|
760
809
|
filesetId: zod.z.string().min(1).optional(),
|
|
761
810
|
inputDirectory: zod.z.string().min(1).optional(),
|
|
762
811
|
mapFilenames: zod.z.boolean().optional(),
|
|
763
|
-
inventAttributes: zod.z.boolean().optional()
|
|
812
|
+
inventAttributes: zod.z.boolean().optional(),
|
|
813
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
764
814
|
}).strict();
|
|
765
|
-
function
|
|
815
|
+
function buildArgs5(options) {
|
|
766
816
|
const args = [];
|
|
817
|
+
if (options.verbosity === "verbose") {
|
|
818
|
+
args.push("-v");
|
|
819
|
+
} else if (options.verbosity === "debug") {
|
|
820
|
+
args.push("-d");
|
|
821
|
+
}
|
|
767
822
|
if (options.outputFile !== void 0) {
|
|
768
823
|
args.push("+D", options.outputFile);
|
|
769
824
|
}
|
|
@@ -791,7 +846,7 @@ async function dcmgpdir(options) {
|
|
|
791
846
|
if (!binaryResult.ok) {
|
|
792
847
|
return err(binaryResult.error);
|
|
793
848
|
}
|
|
794
|
-
const args =
|
|
849
|
+
const args = buildArgs5(options);
|
|
795
850
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
796
851
|
const result = await execCommand(binaryResult.value, args, {
|
|
797
852
|
timeoutMs,
|
|
@@ -816,10 +871,16 @@ var DcmmkdirOptionsSchema = zod.z.object({
|
|
|
816
871
|
append: zod.z.boolean().optional(),
|
|
817
872
|
inputDirectory: zod.z.string().min(1).optional(),
|
|
818
873
|
mapFilenames: zod.z.boolean().optional(),
|
|
819
|
-
inventAttributes: zod.z.boolean().optional()
|
|
874
|
+
inventAttributes: zod.z.boolean().optional(),
|
|
875
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
820
876
|
}).strict();
|
|
821
|
-
function
|
|
877
|
+
function buildArgs6(options) {
|
|
822
878
|
const args = [];
|
|
879
|
+
if (options.verbosity === "verbose") {
|
|
880
|
+
args.push("-v");
|
|
881
|
+
} else if (options.verbosity === "debug") {
|
|
882
|
+
args.push("-d");
|
|
883
|
+
}
|
|
823
884
|
if (options.outputFile !== void 0) {
|
|
824
885
|
args.push("+D", options.outputFile);
|
|
825
886
|
}
|
|
@@ -850,7 +911,7 @@ async function dcmmkdir(options) {
|
|
|
850
911
|
if (!binaryResult.ok) {
|
|
851
912
|
return err(binaryResult.error);
|
|
852
913
|
}
|
|
853
|
-
const args =
|
|
914
|
+
const args = buildArgs6(options);
|
|
854
915
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
855
916
|
const result = await execCommand(binaryResult.value, args, {
|
|
856
917
|
timeoutMs,
|
|
@@ -871,12 +932,18 @@ var DcmqridxOptionsSchema = zod.z.object({
|
|
|
871
932
|
indexDirectory: zod.z.string().min(1),
|
|
872
933
|
inputFiles: zod.z.array(zod.z.string().min(1)).min(1).optional(),
|
|
873
934
|
print: zod.z.boolean().optional(),
|
|
874
|
-
notNew: zod.z.boolean().optional()
|
|
935
|
+
notNew: zod.z.boolean().optional(),
|
|
936
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
875
937
|
}).strict().refine((data) => data.inputFiles !== void 0 && data.inputFiles.length > 0 || data.print === true, {
|
|
876
938
|
message: "Either inputFiles (non-empty) or print must be specified"
|
|
877
939
|
});
|
|
878
|
-
function
|
|
940
|
+
function buildArgs7(options) {
|
|
879
941
|
const args = [];
|
|
942
|
+
if (options.verbosity === "verbose") {
|
|
943
|
+
args.push("-v");
|
|
944
|
+
} else if (options.verbosity === "debug") {
|
|
945
|
+
args.push("-d");
|
|
946
|
+
}
|
|
880
947
|
if (options.print === true) {
|
|
881
948
|
args.push("-p");
|
|
882
949
|
}
|
|
@@ -898,7 +965,7 @@ async function dcmqridx(options) {
|
|
|
898
965
|
if (!binaryResult.ok) {
|
|
899
966
|
return err(binaryResult.error);
|
|
900
967
|
}
|
|
901
|
-
const args =
|
|
968
|
+
const args = buildArgs7(options);
|
|
902
969
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
903
970
|
const result = await execCommand(binaryResult.value, args, {
|
|
904
971
|
timeoutMs,
|
|
@@ -918,11 +985,17 @@ async function dcmqridx(options) {
|
|
|
918
985
|
var Xml2dcmOptionsSchema = zod.z.object({
|
|
919
986
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
920
987
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
988
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional(),
|
|
921
989
|
generateNewUIDs: zod.z.boolean().optional(),
|
|
922
990
|
validateDocument: zod.z.boolean().optional()
|
|
923
991
|
}).strict().optional();
|
|
924
|
-
function
|
|
992
|
+
function buildArgs8(inputPath, outputPath, options) {
|
|
925
993
|
const args = [];
|
|
994
|
+
if (options?.verbosity === "verbose") {
|
|
995
|
+
args.push("-v");
|
|
996
|
+
} else if (options?.verbosity === "debug") {
|
|
997
|
+
args.push("-d");
|
|
998
|
+
}
|
|
926
999
|
if (options?.generateNewUIDs === true) {
|
|
927
1000
|
args.push("+Ug");
|
|
928
1001
|
}
|
|
@@ -941,7 +1014,7 @@ async function xml2dcm(inputPath, outputPath, options) {
|
|
|
941
1014
|
if (!binaryResult.ok) {
|
|
942
1015
|
return err(binaryResult.error);
|
|
943
1016
|
}
|
|
944
|
-
const args =
|
|
1017
|
+
const args = buildArgs8(inputPath, outputPath, options);
|
|
945
1018
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
946
1019
|
const result = await execCommand(binaryResult.value, args, {
|
|
947
1020
|
timeoutMs,
|
|
@@ -957,8 +1030,18 @@ async function xml2dcm(inputPath, outputPath, options) {
|
|
|
957
1030
|
}
|
|
958
1031
|
var Json2dcmOptionsSchema = zod.z.object({
|
|
959
1032
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
960
|
-
signal: zod.z.instanceof(AbortSignal).optional()
|
|
1033
|
+
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1034
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
961
1035
|
}).strict().optional();
|
|
1036
|
+
var VERBOSITY_FLAGS6 = { verbose: "-v", debug: "-d" };
|
|
1037
|
+
function buildArgs9(inputPath, outputPath, options) {
|
|
1038
|
+
const args = [];
|
|
1039
|
+
if (options?.verbosity !== void 0) {
|
|
1040
|
+
args.push(VERBOSITY_FLAGS6[options.verbosity]);
|
|
1041
|
+
}
|
|
1042
|
+
args.push(inputPath, outputPath);
|
|
1043
|
+
return args;
|
|
1044
|
+
}
|
|
962
1045
|
async function json2dcm(inputPath, outputPath, options) {
|
|
963
1046
|
const validation = Json2dcmOptionsSchema.safeParse(options);
|
|
964
1047
|
if (!validation.success) {
|
|
@@ -968,7 +1051,7 @@ async function json2dcm(inputPath, outputPath, options) {
|
|
|
968
1051
|
if (!binaryResult.ok) {
|
|
969
1052
|
return err(binaryResult.error);
|
|
970
1053
|
}
|
|
971
|
-
const args =
|
|
1054
|
+
const args = buildArgs9(inputPath, outputPath, options);
|
|
972
1055
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
973
1056
|
const result = await execCommand(binaryResult.value, args, {
|
|
974
1057
|
timeoutMs,
|
|
@@ -985,11 +1068,17 @@ async function json2dcm(inputPath, outputPath, options) {
|
|
|
985
1068
|
var Dump2dcmOptionsSchema = zod.z.object({
|
|
986
1069
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
987
1070
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1071
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional(),
|
|
988
1072
|
generateNewUIDs: zod.z.boolean().optional(),
|
|
989
1073
|
writeFileFormat: zod.z.boolean().optional()
|
|
990
1074
|
}).strict().optional();
|
|
991
|
-
function
|
|
1075
|
+
function buildArgs10(inputPath, outputPath, options) {
|
|
992
1076
|
const args = [];
|
|
1077
|
+
if (options?.verbosity === "verbose") {
|
|
1078
|
+
args.push("-v");
|
|
1079
|
+
} else if (options?.verbosity === "debug") {
|
|
1080
|
+
args.push("-d");
|
|
1081
|
+
}
|
|
993
1082
|
if (options?.generateNewUIDs === true) {
|
|
994
1083
|
args.push("+Ug");
|
|
995
1084
|
}
|
|
@@ -1008,7 +1097,7 @@ async function dump2dcm(inputPath, outputPath, options) {
|
|
|
1008
1097
|
if (!binaryResult.ok) {
|
|
1009
1098
|
return err(binaryResult.error);
|
|
1010
1099
|
}
|
|
1011
|
-
const args =
|
|
1100
|
+
const args = buildArgs10(inputPath, outputPath, options);
|
|
1012
1101
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1013
1102
|
const result = await execCommand(binaryResult.value, args, {
|
|
1014
1103
|
timeoutMs,
|
|
@@ -1031,6 +1120,7 @@ var Img2dcmInputFormat = {
|
|
|
1031
1120
|
var Img2dcmOptionsSchema = zod.z.object({
|
|
1032
1121
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1033
1122
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1123
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional(),
|
|
1034
1124
|
inputFormat: zod.z.enum(["jpeg", "bmp"]).optional(),
|
|
1035
1125
|
datasetFrom: zod.z.string().min(1).optional()
|
|
1036
1126
|
}).strict().optional();
|
|
@@ -1038,8 +1128,13 @@ var FORMAT_FLAG_MAP = {
|
|
|
1038
1128
|
jpeg: "JPEG",
|
|
1039
1129
|
bmp: "BMP"
|
|
1040
1130
|
};
|
|
1041
|
-
function
|
|
1131
|
+
function buildArgs11(inputPath, outputPath, options) {
|
|
1042
1132
|
const args = [];
|
|
1133
|
+
if (options?.verbosity === "verbose") {
|
|
1134
|
+
args.push("-v");
|
|
1135
|
+
} else if (options?.verbosity === "debug") {
|
|
1136
|
+
args.push("-d");
|
|
1137
|
+
}
|
|
1043
1138
|
if (options?.inputFormat !== void 0) {
|
|
1044
1139
|
args.push("-i", FORMAT_FLAG_MAP[options.inputFormat]);
|
|
1045
1140
|
}
|
|
@@ -1058,7 +1153,7 @@ async function img2dcm(inputPath, outputPath, options) {
|
|
|
1058
1153
|
if (!binaryResult.ok) {
|
|
1059
1154
|
return err(binaryResult.error);
|
|
1060
1155
|
}
|
|
1061
|
-
const args =
|
|
1156
|
+
const args = buildArgs11(inputPath, outputPath, options);
|
|
1062
1157
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1063
1158
|
const result = await execCommand(binaryResult.value, args, {
|
|
1064
1159
|
timeoutMs,
|
|
@@ -1074,8 +1169,18 @@ async function img2dcm(inputPath, outputPath, options) {
|
|
|
1074
1169
|
}
|
|
1075
1170
|
var Pdf2dcmOptionsSchema = zod.z.object({
|
|
1076
1171
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1077
|
-
signal: zod.z.instanceof(AbortSignal).optional()
|
|
1172
|
+
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1173
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1078
1174
|
}).strict().optional();
|
|
1175
|
+
var VERBOSITY_FLAGS7 = { verbose: "-v", debug: "-d" };
|
|
1176
|
+
function buildArgs12(inputPath, outputPath, options) {
|
|
1177
|
+
const args = [];
|
|
1178
|
+
if (options?.verbosity !== void 0) {
|
|
1179
|
+
args.push(VERBOSITY_FLAGS7[options.verbosity]);
|
|
1180
|
+
}
|
|
1181
|
+
args.push(inputPath, outputPath);
|
|
1182
|
+
return args;
|
|
1183
|
+
}
|
|
1079
1184
|
async function pdf2dcm(inputPath, outputPath, options) {
|
|
1080
1185
|
const validation = Pdf2dcmOptionsSchema.safeParse(options);
|
|
1081
1186
|
if (!validation.success) {
|
|
@@ -1085,7 +1190,7 @@ async function pdf2dcm(inputPath, outputPath, options) {
|
|
|
1085
1190
|
if (!binaryResult.ok) {
|
|
1086
1191
|
return err(binaryResult.error);
|
|
1087
1192
|
}
|
|
1088
|
-
const args =
|
|
1193
|
+
const args = buildArgs12(inputPath, outputPath, options);
|
|
1089
1194
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1090
1195
|
const result = await execCommand(binaryResult.value, args, {
|
|
1091
1196
|
timeoutMs,
|
|
@@ -1101,8 +1206,18 @@ async function pdf2dcm(inputPath, outputPath, options) {
|
|
|
1101
1206
|
}
|
|
1102
1207
|
var Dcm2pdfOptionsSchema = zod.z.object({
|
|
1103
1208
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1104
|
-
signal: zod.z.instanceof(AbortSignal).optional()
|
|
1209
|
+
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1210
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1105
1211
|
}).strict().optional();
|
|
1212
|
+
var VERBOSITY_FLAGS8 = { verbose: "-v", debug: "-d" };
|
|
1213
|
+
function buildArgs13(inputPath, outputPath, options) {
|
|
1214
|
+
const args = [];
|
|
1215
|
+
if (options?.verbosity !== void 0) {
|
|
1216
|
+
args.push(VERBOSITY_FLAGS8[options.verbosity]);
|
|
1217
|
+
}
|
|
1218
|
+
args.push(inputPath, outputPath);
|
|
1219
|
+
return args;
|
|
1220
|
+
}
|
|
1106
1221
|
async function dcm2pdf(inputPath, outputPath, options) {
|
|
1107
1222
|
const validation = Dcm2pdfOptionsSchema.safeParse(options);
|
|
1108
1223
|
if (!validation.success) {
|
|
@@ -1112,7 +1227,7 @@ async function dcm2pdf(inputPath, outputPath, options) {
|
|
|
1112
1227
|
if (!binaryResult.ok) {
|
|
1113
1228
|
return err(binaryResult.error);
|
|
1114
1229
|
}
|
|
1115
|
-
const args =
|
|
1230
|
+
const args = buildArgs13(inputPath, outputPath, options);
|
|
1116
1231
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1117
1232
|
const result = await execCommand(binaryResult.value, args, {
|
|
1118
1233
|
timeoutMs,
|
|
@@ -1128,8 +1243,18 @@ async function dcm2pdf(inputPath, outputPath, options) {
|
|
|
1128
1243
|
}
|
|
1129
1244
|
var Cda2dcmOptionsSchema = zod.z.object({
|
|
1130
1245
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1131
|
-
signal: zod.z.instanceof(AbortSignal).optional()
|
|
1246
|
+
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1247
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1132
1248
|
}).strict().optional();
|
|
1249
|
+
var VERBOSITY_FLAGS9 = { verbose: "-v", debug: "-d" };
|
|
1250
|
+
function buildArgs14(inputPath, outputPath, options) {
|
|
1251
|
+
const args = [];
|
|
1252
|
+
if (options?.verbosity !== void 0) {
|
|
1253
|
+
args.push(VERBOSITY_FLAGS9[options.verbosity]);
|
|
1254
|
+
}
|
|
1255
|
+
args.push(inputPath, outputPath);
|
|
1256
|
+
return args;
|
|
1257
|
+
}
|
|
1133
1258
|
async function cda2dcm(inputPath, outputPath, options) {
|
|
1134
1259
|
const validation = Cda2dcmOptionsSchema.safeParse(options);
|
|
1135
1260
|
if (!validation.success) {
|
|
@@ -1139,7 +1264,7 @@ async function cda2dcm(inputPath, outputPath, options) {
|
|
|
1139
1264
|
if (!binaryResult.ok) {
|
|
1140
1265
|
return err(binaryResult.error);
|
|
1141
1266
|
}
|
|
1142
|
-
const args =
|
|
1267
|
+
const args = buildArgs14(inputPath, outputPath, options);
|
|
1143
1268
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1144
1269
|
const result = await execCommand(binaryResult.value, args, {
|
|
1145
1270
|
timeoutMs,
|
|
@@ -1155,8 +1280,18 @@ async function cda2dcm(inputPath, outputPath, options) {
|
|
|
1155
1280
|
}
|
|
1156
1281
|
var Dcm2cdaOptionsSchema = zod.z.object({
|
|
1157
1282
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1158
|
-
signal: zod.z.instanceof(AbortSignal).optional()
|
|
1283
|
+
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1284
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1159
1285
|
}).strict().optional();
|
|
1286
|
+
var VERBOSITY_FLAGS10 = { verbose: "-v", debug: "-d" };
|
|
1287
|
+
function buildArgs15(inputPath, outputPath, options) {
|
|
1288
|
+
const args = [];
|
|
1289
|
+
if (options?.verbosity !== void 0) {
|
|
1290
|
+
args.push(VERBOSITY_FLAGS10[options.verbosity]);
|
|
1291
|
+
}
|
|
1292
|
+
args.push(inputPath, outputPath);
|
|
1293
|
+
return args;
|
|
1294
|
+
}
|
|
1160
1295
|
async function dcm2cda(inputPath, outputPath, options) {
|
|
1161
1296
|
const validation = Dcm2cdaOptionsSchema.safeParse(options);
|
|
1162
1297
|
if (!validation.success) {
|
|
@@ -1166,7 +1301,7 @@ async function dcm2cda(inputPath, outputPath, options) {
|
|
|
1166
1301
|
if (!binaryResult.ok) {
|
|
1167
1302
|
return err(binaryResult.error);
|
|
1168
1303
|
}
|
|
1169
|
-
const args =
|
|
1304
|
+
const args = buildArgs15(inputPath, outputPath, options);
|
|
1170
1305
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1171
1306
|
const result = await execCommand(binaryResult.value, args, {
|
|
1172
1307
|
timeoutMs,
|
|
@@ -1182,8 +1317,18 @@ async function dcm2cda(inputPath, outputPath, options) {
|
|
|
1182
1317
|
}
|
|
1183
1318
|
var Stl2dcmOptionsSchema = zod.z.object({
|
|
1184
1319
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1185
|
-
signal: zod.z.instanceof(AbortSignal).optional()
|
|
1320
|
+
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1321
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1186
1322
|
}).strict().optional();
|
|
1323
|
+
var VERBOSITY_FLAGS11 = { verbose: "-v", debug: "-d" };
|
|
1324
|
+
function buildArgs16(inputPath, outputPath, options) {
|
|
1325
|
+
const args = [];
|
|
1326
|
+
if (options?.verbosity !== void 0) {
|
|
1327
|
+
args.push(VERBOSITY_FLAGS11[options.verbosity]);
|
|
1328
|
+
}
|
|
1329
|
+
args.push(inputPath, outputPath);
|
|
1330
|
+
return args;
|
|
1331
|
+
}
|
|
1187
1332
|
async function stl2dcm(inputPath, outputPath, options) {
|
|
1188
1333
|
const validation = Stl2dcmOptionsSchema.safeParse(options);
|
|
1189
1334
|
if (!validation.success) {
|
|
@@ -1193,7 +1338,7 @@ async function stl2dcm(inputPath, outputPath, options) {
|
|
|
1193
1338
|
if (!binaryResult.ok) {
|
|
1194
1339
|
return err(binaryResult.error);
|
|
1195
1340
|
}
|
|
1196
|
-
const args =
|
|
1341
|
+
const args = buildArgs16(inputPath, outputPath, options);
|
|
1197
1342
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1198
1343
|
const result = await execCommand(binaryResult.value, args, {
|
|
1199
1344
|
timeoutMs,
|
|
@@ -1210,10 +1355,16 @@ async function stl2dcm(inputPath, outputPath, options) {
|
|
|
1210
1355
|
var DcmcrleOptionsSchema = zod.z.object({
|
|
1211
1356
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1212
1357
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1213
|
-
uidAlways: zod.z.boolean().optional()
|
|
1358
|
+
uidAlways: zod.z.boolean().optional(),
|
|
1359
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1214
1360
|
}).strict().optional();
|
|
1215
|
-
function
|
|
1361
|
+
function buildArgs17(inputPath, outputPath, options) {
|
|
1216
1362
|
const args = [];
|
|
1363
|
+
if (options?.verbosity === "verbose") {
|
|
1364
|
+
args.push("-v");
|
|
1365
|
+
} else if (options?.verbosity === "debug") {
|
|
1366
|
+
args.push("-d");
|
|
1367
|
+
}
|
|
1217
1368
|
if (options?.uidAlways === true) {
|
|
1218
1369
|
args.push("+ua");
|
|
1219
1370
|
}
|
|
@@ -1229,7 +1380,7 @@ async function dcmcrle(inputPath, outputPath, options) {
|
|
|
1229
1380
|
if (!binaryResult.ok) {
|
|
1230
1381
|
return err(binaryResult.error);
|
|
1231
1382
|
}
|
|
1232
|
-
const args =
|
|
1383
|
+
const args = buildArgs17(inputPath, outputPath, options);
|
|
1233
1384
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1234
1385
|
const result = await execCommand(binaryResult.value, args, {
|
|
1235
1386
|
timeoutMs,
|
|
@@ -1246,10 +1397,16 @@ async function dcmcrle(inputPath, outputPath, options) {
|
|
|
1246
1397
|
var DcmdrleOptionsSchema = zod.z.object({
|
|
1247
1398
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1248
1399
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1249
|
-
uidAlways: zod.z.boolean().optional()
|
|
1400
|
+
uidAlways: zod.z.boolean().optional(),
|
|
1401
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1250
1402
|
}).strict().optional();
|
|
1251
|
-
function
|
|
1403
|
+
function buildArgs18(inputPath, outputPath, options) {
|
|
1252
1404
|
const args = [];
|
|
1405
|
+
if (options?.verbosity === "verbose") {
|
|
1406
|
+
args.push("-v");
|
|
1407
|
+
} else if (options?.verbosity === "debug") {
|
|
1408
|
+
args.push("-d");
|
|
1409
|
+
}
|
|
1253
1410
|
if (options?.uidAlways === true) {
|
|
1254
1411
|
args.push("+ua");
|
|
1255
1412
|
}
|
|
@@ -1265,7 +1422,7 @@ async function dcmdrle(inputPath, outputPath, options) {
|
|
|
1265
1422
|
if (!binaryResult.ok) {
|
|
1266
1423
|
return err(binaryResult.error);
|
|
1267
1424
|
}
|
|
1268
|
-
const args =
|
|
1425
|
+
const args = buildArgs18(inputPath, outputPath, options);
|
|
1269
1426
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1270
1427
|
const result = await execCommand(binaryResult.value, args, {
|
|
1271
1428
|
timeoutMs,
|
|
@@ -1282,10 +1439,16 @@ async function dcmdrle(inputPath, outputPath, options) {
|
|
|
1282
1439
|
var DcmencapOptionsSchema = zod.z.object({
|
|
1283
1440
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1284
1441
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1285
|
-
documentTitle: zod.z.string().optional()
|
|
1442
|
+
documentTitle: zod.z.string().optional(),
|
|
1443
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1286
1444
|
}).strict().optional();
|
|
1287
|
-
function
|
|
1445
|
+
function buildArgs19(inputPath, outputPath, options) {
|
|
1288
1446
|
const args = [];
|
|
1447
|
+
if (options?.verbosity === "verbose") {
|
|
1448
|
+
args.push("-v");
|
|
1449
|
+
} else if (options?.verbosity === "debug") {
|
|
1450
|
+
args.push("-d");
|
|
1451
|
+
}
|
|
1289
1452
|
if (options?.documentTitle !== void 0) {
|
|
1290
1453
|
args.push("--title", options.documentTitle);
|
|
1291
1454
|
}
|
|
@@ -1301,7 +1464,7 @@ async function dcmencap(inputPath, outputPath, options) {
|
|
|
1301
1464
|
if (!binaryResult.ok) {
|
|
1302
1465
|
return err(binaryResult.error);
|
|
1303
1466
|
}
|
|
1304
|
-
const args =
|
|
1467
|
+
const args = buildArgs19(inputPath, outputPath, options);
|
|
1305
1468
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1306
1469
|
const result = await execCommand(binaryResult.value, args, {
|
|
1307
1470
|
timeoutMs,
|
|
@@ -1317,8 +1480,19 @@ async function dcmencap(inputPath, outputPath, options) {
|
|
|
1317
1480
|
}
|
|
1318
1481
|
var DcmdecapOptionsSchema = zod.z.object({
|
|
1319
1482
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1320
|
-
signal: zod.z.instanceof(AbortSignal).optional()
|
|
1483
|
+
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1484
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1321
1485
|
}).strict().optional();
|
|
1486
|
+
function buildArgs20(inputPath, outputPath, options) {
|
|
1487
|
+
const args = [];
|
|
1488
|
+
if (options?.verbosity === "verbose") {
|
|
1489
|
+
args.push("-v");
|
|
1490
|
+
} else if (options?.verbosity === "debug") {
|
|
1491
|
+
args.push("-d");
|
|
1492
|
+
}
|
|
1493
|
+
args.push(inputPath, outputPath);
|
|
1494
|
+
return args;
|
|
1495
|
+
}
|
|
1322
1496
|
async function dcmdecap(inputPath, outputPath, options) {
|
|
1323
1497
|
const validation = DcmdecapOptionsSchema.safeParse(options);
|
|
1324
1498
|
if (!validation.success) {
|
|
@@ -1328,7 +1502,7 @@ async function dcmdecap(inputPath, outputPath, options) {
|
|
|
1328
1502
|
if (!binaryResult.ok) {
|
|
1329
1503
|
return err(binaryResult.error);
|
|
1330
1504
|
}
|
|
1331
|
-
const args =
|
|
1505
|
+
const args = buildArgs20(inputPath, outputPath, options);
|
|
1332
1506
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1333
1507
|
const result = await execCommand(binaryResult.value, args, {
|
|
1334
1508
|
timeoutMs,
|
|
@@ -1346,10 +1520,19 @@ var DcmcjpegOptionsSchema = zod.z.object({
|
|
|
1346
1520
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1347
1521
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1348
1522
|
quality: zod.z.number().int().min(1).max(100).optional(),
|
|
1349
|
-
lossless: zod.z.boolean().optional()
|
|
1523
|
+
lossless: zod.z.boolean().optional(),
|
|
1524
|
+
progressive: zod.z.boolean().optional(),
|
|
1525
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1350
1526
|
}).strict().optional();
|
|
1351
|
-
|
|
1527
|
+
var VERBOSITY_FLAGS12 = { verbose: "-v", debug: "-d" };
|
|
1528
|
+
function buildArgs21(inputPath, outputPath, options) {
|
|
1352
1529
|
const args = [];
|
|
1530
|
+
if (options?.verbosity !== void 0) {
|
|
1531
|
+
args.push(VERBOSITY_FLAGS12[options.verbosity]);
|
|
1532
|
+
}
|
|
1533
|
+
if (options?.progressive === true) {
|
|
1534
|
+
args.push("+p");
|
|
1535
|
+
}
|
|
1353
1536
|
if (options?.lossless === true) {
|
|
1354
1537
|
args.push("+e1");
|
|
1355
1538
|
}
|
|
@@ -1368,7 +1551,7 @@ async function dcmcjpeg(inputPath, outputPath, options) {
|
|
|
1368
1551
|
if (!binaryResult.ok) {
|
|
1369
1552
|
return err(binaryResult.error);
|
|
1370
1553
|
}
|
|
1371
|
-
const args =
|
|
1554
|
+
const args = buildArgs21(inputPath, outputPath, options);
|
|
1372
1555
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1373
1556
|
const result = await execCommand(binaryResult.value, args, {
|
|
1374
1557
|
timeoutMs,
|
|
@@ -1398,10 +1581,16 @@ var COLOR_CONVERSION_FLAGS = {
|
|
|
1398
1581
|
var DcmdjpegOptionsSchema = zod.z.object({
|
|
1399
1582
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1400
1583
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1401
|
-
colorConversion: zod.z.enum(["photometric", "always", "never"]).optional()
|
|
1584
|
+
colorConversion: zod.z.enum(["photometric", "always", "never"]).optional(),
|
|
1585
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1402
1586
|
}).strict().optional();
|
|
1403
|
-
function
|
|
1587
|
+
function buildArgs22(inputPath, outputPath, options) {
|
|
1404
1588
|
const args = [];
|
|
1589
|
+
if (options?.verbosity === "verbose") {
|
|
1590
|
+
args.push("-v");
|
|
1591
|
+
} else if (options?.verbosity === "debug") {
|
|
1592
|
+
args.push("-d");
|
|
1593
|
+
}
|
|
1405
1594
|
if (options?.colorConversion !== void 0) {
|
|
1406
1595
|
args.push(COLOR_CONVERSION_FLAGS[options.colorConversion]);
|
|
1407
1596
|
}
|
|
@@ -1417,7 +1606,7 @@ async function dcmdjpeg(inputPath, outputPath, options) {
|
|
|
1417
1606
|
if (!binaryResult.ok) {
|
|
1418
1607
|
return err(binaryResult.error);
|
|
1419
1608
|
}
|
|
1420
|
-
const args =
|
|
1609
|
+
const args = buildArgs22(inputPath, outputPath, options);
|
|
1421
1610
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1422
1611
|
const result = await execCommand(binaryResult.value, args, {
|
|
1423
1612
|
timeoutMs,
|
|
@@ -1435,10 +1624,15 @@ var DcmcjplsOptionsSchema = zod.z.object({
|
|
|
1435
1624
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1436
1625
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1437
1626
|
lossless: zod.z.boolean().optional(),
|
|
1438
|
-
maxDeviation: zod.z.number().int().min(0).optional()
|
|
1627
|
+
maxDeviation: zod.z.number().int().min(0).optional(),
|
|
1628
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1439
1629
|
}).strict().optional();
|
|
1440
|
-
|
|
1630
|
+
var VERBOSITY_FLAGS13 = { verbose: "-v", debug: "-d" };
|
|
1631
|
+
function buildArgs23(inputPath, outputPath, options) {
|
|
1441
1632
|
const args = [];
|
|
1633
|
+
if (options?.verbosity !== void 0) {
|
|
1634
|
+
args.push(VERBOSITY_FLAGS13[options.verbosity]);
|
|
1635
|
+
}
|
|
1442
1636
|
if (options?.lossless === false) {
|
|
1443
1637
|
args.push("+en");
|
|
1444
1638
|
} else if (options?.lossless === true) {
|
|
@@ -1459,7 +1653,7 @@ async function dcmcjpls(inputPath, outputPath, options) {
|
|
|
1459
1653
|
if (!binaryResult.ok) {
|
|
1460
1654
|
return err(binaryResult.error);
|
|
1461
1655
|
}
|
|
1462
|
-
const args =
|
|
1656
|
+
const args = buildArgs23(inputPath, outputPath, options);
|
|
1463
1657
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1464
1658
|
const result = await execCommand(binaryResult.value, args, {
|
|
1465
1659
|
timeoutMs,
|
|
@@ -1489,10 +1683,16 @@ var JPLS_COLOR_CONVERSION_FLAGS = {
|
|
|
1489
1683
|
var DcmdjplsOptionsSchema = zod.z.object({
|
|
1490
1684
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1491
1685
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1492
|
-
colorConversion: zod.z.enum(["photometric", "always", "never"]).optional()
|
|
1686
|
+
colorConversion: zod.z.enum(["photometric", "always", "never"]).optional(),
|
|
1687
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1493
1688
|
}).strict().optional();
|
|
1494
|
-
function
|
|
1689
|
+
function buildArgs24(inputPath, outputPath, options) {
|
|
1495
1690
|
const args = [];
|
|
1691
|
+
if (options?.verbosity === "verbose") {
|
|
1692
|
+
args.push("-v");
|
|
1693
|
+
} else if (options?.verbosity === "debug") {
|
|
1694
|
+
args.push("-d");
|
|
1695
|
+
}
|
|
1496
1696
|
if (options?.colorConversion !== void 0) {
|
|
1497
1697
|
args.push(JPLS_COLOR_CONVERSION_FLAGS[options.colorConversion]);
|
|
1498
1698
|
}
|
|
@@ -1508,7 +1708,7 @@ async function dcmdjpls(inputPath, outputPath, options) {
|
|
|
1508
1708
|
if (!binaryResult.ok) {
|
|
1509
1709
|
return err(binaryResult.error);
|
|
1510
1710
|
}
|
|
1511
|
-
const args =
|
|
1711
|
+
const args = buildArgs24(inputPath, outputPath, options);
|
|
1512
1712
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1513
1713
|
const result = await execCommand(binaryResult.value, args, {
|
|
1514
1714
|
timeoutMs,
|
|
@@ -1527,6 +1727,8 @@ var Dcmj2pnmOutputFormat = {
|
|
|
1527
1727
|
PNM: "pnm",
|
|
1528
1728
|
/** PNG format. */
|
|
1529
1729
|
PNG: "png",
|
|
1730
|
+
/** 16-bit PNG format. */
|
|
1731
|
+
PNG_16BIT: "png16",
|
|
1530
1732
|
/** BMP format. */
|
|
1531
1733
|
BMP: "bmp",
|
|
1532
1734
|
/** TIFF format. */
|
|
@@ -1537,6 +1739,7 @@ var Dcmj2pnmOutputFormat = {
|
|
|
1537
1739
|
var OUTPUT_FORMAT_FLAGS = {
|
|
1538
1740
|
pnm: "+op",
|
|
1539
1741
|
png: "+on",
|
|
1742
|
+
png16: "+on2",
|
|
1540
1743
|
bmp: "+ob",
|
|
1541
1744
|
tiff: "+ot",
|
|
1542
1745
|
jpeg: "+oj"
|
|
@@ -1544,17 +1747,32 @@ var OUTPUT_FORMAT_FLAGS = {
|
|
|
1544
1747
|
var Dcmj2pnmOptionsSchema = zod.z.object({
|
|
1545
1748
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1546
1749
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1547
|
-
outputFormat: zod.z.enum(["pnm", "png", "bmp", "tiff", "jpeg"]).optional(),
|
|
1548
|
-
frame: zod.z.number().int().min(0).max(65535).optional()
|
|
1549
|
-
|
|
1550
|
-
|
|
1750
|
+
outputFormat: zod.z.enum(["pnm", "png", "png16", "bmp", "tiff", "jpeg"]).optional(),
|
|
1751
|
+
frame: zod.z.number().int().min(0).max(65535).optional(),
|
|
1752
|
+
windowCenter: zod.z.number().optional(),
|
|
1753
|
+
windowWidth: zod.z.number().optional(),
|
|
1754
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1755
|
+
}).strict().refine((data) => data?.windowCenter === void 0 === (data?.windowWidth === void 0), {
|
|
1756
|
+
message: "windowCenter and windowWidth must be provided together"
|
|
1757
|
+
}).optional();
|
|
1758
|
+
var VERBOSITY_FLAGS14 = { verbose: "-v", debug: "-d" };
|
|
1759
|
+
function pushWindowArgs(args, options) {
|
|
1760
|
+
if (options?.windowCenter !== void 0 && options?.windowWidth !== void 0) {
|
|
1761
|
+
args.push("+Wl", String(options.windowCenter), String(options.windowWidth));
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
function buildArgs25(inputPath, outputPath, options) {
|
|
1551
1765
|
const args = [];
|
|
1766
|
+
if (options?.verbosity !== void 0) {
|
|
1767
|
+
args.push(VERBOSITY_FLAGS14[options.verbosity]);
|
|
1768
|
+
}
|
|
1552
1769
|
if (options?.outputFormat !== void 0) {
|
|
1553
1770
|
args.push(OUTPUT_FORMAT_FLAGS[options.outputFormat]);
|
|
1554
1771
|
}
|
|
1555
1772
|
if (options?.frame !== void 0) {
|
|
1556
1773
|
args.push("+F", String(options.frame));
|
|
1557
1774
|
}
|
|
1775
|
+
pushWindowArgs(args, options);
|
|
1558
1776
|
args.push(inputPath, outputPath);
|
|
1559
1777
|
return args;
|
|
1560
1778
|
}
|
|
@@ -1563,11 +1781,12 @@ async function dcmj2pnm(inputPath, outputPath, options) {
|
|
|
1563
1781
|
if (!validation.success) {
|
|
1564
1782
|
return err(createValidationError("dcmj2pnm", validation.error));
|
|
1565
1783
|
}
|
|
1566
|
-
const
|
|
1784
|
+
const dcm2imgResult = resolveBinary("dcm2img");
|
|
1785
|
+
const binaryResult = dcm2imgResult.ok ? dcm2imgResult : resolveBinary("dcmj2pnm");
|
|
1567
1786
|
if (!binaryResult.ok) {
|
|
1568
1787
|
return err(binaryResult.error);
|
|
1569
1788
|
}
|
|
1570
|
-
const args =
|
|
1789
|
+
const args = buildArgs25(inputPath, outputPath, options);
|
|
1571
1790
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1572
1791
|
const result = await execCommand(binaryResult.value, args, {
|
|
1573
1792
|
timeoutMs,
|
|
@@ -1586,6 +1805,8 @@ var Dcm2pnmOutputFormat = {
|
|
|
1586
1805
|
PNM: "pnm",
|
|
1587
1806
|
/** PNG format. */
|
|
1588
1807
|
PNG: "png",
|
|
1808
|
+
/** 16-bit PNG format. */
|
|
1809
|
+
PNG_16BIT: "png16",
|
|
1589
1810
|
/** BMP format. */
|
|
1590
1811
|
BMP: "bmp",
|
|
1591
1812
|
/** TIFF format. */
|
|
@@ -1594,23 +1815,39 @@ var Dcm2pnmOutputFormat = {
|
|
|
1594
1815
|
var DCM2PNM_FORMAT_FLAGS = {
|
|
1595
1816
|
pnm: "+op",
|
|
1596
1817
|
png: "+on",
|
|
1818
|
+
png16: "+on2",
|
|
1597
1819
|
bmp: "+ob",
|
|
1598
1820
|
tiff: "+ot"
|
|
1599
1821
|
};
|
|
1600
1822
|
var Dcm2pnmOptionsSchema = zod.z.object({
|
|
1601
1823
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1602
1824
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1603
|
-
outputFormat: zod.z.enum(["pnm", "png", "bmp", "tiff"]).optional(),
|
|
1604
|
-
frame: zod.z.number().int().min(0).max(65535).optional()
|
|
1605
|
-
|
|
1606
|
-
|
|
1825
|
+
outputFormat: zod.z.enum(["pnm", "png", "png16", "bmp", "tiff"]).optional(),
|
|
1826
|
+
frame: zod.z.number().int().min(0).max(65535).optional(),
|
|
1827
|
+
windowCenter: zod.z.number().optional(),
|
|
1828
|
+
windowWidth: zod.z.number().optional(),
|
|
1829
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1830
|
+
}).strict().refine((data) => data?.windowCenter === void 0 === (data?.windowWidth === void 0), {
|
|
1831
|
+
message: "windowCenter and windowWidth must be provided together"
|
|
1832
|
+
}).optional();
|
|
1833
|
+
var VERBOSITY_FLAGS15 = { verbose: "-v", debug: "-d" };
|
|
1834
|
+
function pushWindowArgs2(args, options) {
|
|
1835
|
+
if (options?.windowCenter !== void 0 && options?.windowWidth !== void 0) {
|
|
1836
|
+
args.push("+Wl", String(options.windowCenter), String(options.windowWidth));
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
function buildArgs26(inputPath, outputPath, options) {
|
|
1607
1840
|
const args = [];
|
|
1841
|
+
if (options?.verbosity !== void 0) {
|
|
1842
|
+
args.push(VERBOSITY_FLAGS15[options.verbosity]);
|
|
1843
|
+
}
|
|
1608
1844
|
if (options?.outputFormat !== void 0) {
|
|
1609
1845
|
args.push(DCM2PNM_FORMAT_FLAGS[options.outputFormat]);
|
|
1610
1846
|
}
|
|
1611
1847
|
if (options?.frame !== void 0) {
|
|
1612
1848
|
args.push("+F", String(options.frame));
|
|
1613
1849
|
}
|
|
1850
|
+
pushWindowArgs2(args, options);
|
|
1614
1851
|
args.push(inputPath, outputPath);
|
|
1615
1852
|
return args;
|
|
1616
1853
|
}
|
|
@@ -1619,11 +1856,12 @@ async function dcm2pnm(inputPath, outputPath, options) {
|
|
|
1619
1856
|
if (!validation.success) {
|
|
1620
1857
|
return err(createValidationError("dcm2pnm", validation.error));
|
|
1621
1858
|
}
|
|
1622
|
-
const
|
|
1859
|
+
const dcm2imgResult = resolveBinary("dcm2img");
|
|
1860
|
+
const binaryResult = dcm2imgResult.ok ? dcm2imgResult : resolveBinary("dcm2pnm");
|
|
1623
1861
|
if (!binaryResult.ok) {
|
|
1624
1862
|
return err(binaryResult.error);
|
|
1625
1863
|
}
|
|
1626
|
-
const args =
|
|
1864
|
+
const args = buildArgs26(inputPath, outputPath, options);
|
|
1627
1865
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1628
1866
|
const result = await execCommand(binaryResult.value, args, {
|
|
1629
1867
|
timeoutMs,
|
|
@@ -1643,10 +1881,11 @@ var DcmscaleOptionsSchema = zod.z.object({
|
|
|
1643
1881
|
xFactor: zod.z.number().positive().max(100).optional(),
|
|
1644
1882
|
yFactor: zod.z.number().positive().max(100).optional(),
|
|
1645
1883
|
xSize: zod.z.number().int().positive().optional(),
|
|
1646
|
-
ySize: zod.z.number().int().positive().optional()
|
|
1884
|
+
ySize: zod.z.number().int().positive().optional(),
|
|
1885
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1647
1886
|
}).strict().optional();
|
|
1648
|
-
|
|
1649
|
-
|
|
1887
|
+
var VERBOSITY_FLAGS16 = { verbose: "-v", debug: "-d" };
|
|
1888
|
+
function pushScalingArgs(args, options) {
|
|
1650
1889
|
if (options?.xFactor !== void 0) {
|
|
1651
1890
|
args.push("+Sxf", String(options.xFactor));
|
|
1652
1891
|
}
|
|
@@ -1659,6 +1898,13 @@ function buildArgs19(inputPath, outputPath, options) {
|
|
|
1659
1898
|
if (options?.ySize !== void 0) {
|
|
1660
1899
|
args.push("+Syv", String(options.ySize));
|
|
1661
1900
|
}
|
|
1901
|
+
}
|
|
1902
|
+
function buildArgs27(inputPath, outputPath, options) {
|
|
1903
|
+
const args = [];
|
|
1904
|
+
if (options?.verbosity !== void 0) {
|
|
1905
|
+
args.push(VERBOSITY_FLAGS16[options.verbosity]);
|
|
1906
|
+
}
|
|
1907
|
+
pushScalingArgs(args, options);
|
|
1662
1908
|
args.push(inputPath, outputPath);
|
|
1663
1909
|
return args;
|
|
1664
1910
|
}
|
|
@@ -1671,7 +1917,7 @@ async function dcmscale(inputPath, outputPath, options) {
|
|
|
1671
1917
|
if (!binaryResult.ok) {
|
|
1672
1918
|
return err(binaryResult.error);
|
|
1673
1919
|
}
|
|
1674
|
-
const args =
|
|
1920
|
+
const args = buildArgs27(inputPath, outputPath, options);
|
|
1675
1921
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1676
1922
|
const result = await execCommand(binaryResult.value, args, {
|
|
1677
1923
|
timeoutMs,
|
|
@@ -1689,10 +1935,16 @@ var DcmquantOptionsSchema = zod.z.object({
|
|
|
1689
1935
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1690
1936
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1691
1937
|
colors: zod.z.number().int().min(2).max(65536).optional(),
|
|
1692
|
-
frame: zod.z.number().int().min(0).max(65535).optional()
|
|
1938
|
+
frame: zod.z.number().int().min(0).max(65535).optional(),
|
|
1939
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1693
1940
|
}).strict().optional();
|
|
1694
|
-
function
|
|
1941
|
+
function buildArgs28(inputPath, outputPath, options) {
|
|
1695
1942
|
const args = [];
|
|
1943
|
+
if (options?.verbosity === "verbose") {
|
|
1944
|
+
args.push("-v");
|
|
1945
|
+
} else if (options?.verbosity === "debug") {
|
|
1946
|
+
args.push("-d");
|
|
1947
|
+
}
|
|
1696
1948
|
if (options?.colors !== void 0) {
|
|
1697
1949
|
args.push("+pc", String(options.colors));
|
|
1698
1950
|
}
|
|
@@ -1711,7 +1963,7 @@ async function dcmquant(inputPath, outputPath, options) {
|
|
|
1711
1963
|
if (!binaryResult.ok) {
|
|
1712
1964
|
return err(binaryResult.error);
|
|
1713
1965
|
}
|
|
1714
|
-
const args =
|
|
1966
|
+
const args = buildArgs28(inputPath, outputPath, options);
|
|
1715
1967
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1716
1968
|
const result = await execCommand(binaryResult.value, args, {
|
|
1717
1969
|
timeoutMs,
|
|
@@ -1731,10 +1983,11 @@ var DcmdspfnOptionsSchema = zod.z.object({
|
|
|
1731
1983
|
monitorFile: zod.z.string().min(1).optional(),
|
|
1732
1984
|
cameraFile: zod.z.string().min(1).optional(),
|
|
1733
1985
|
printerFile: zod.z.string().min(1).optional(),
|
|
1734
|
-
ambientLight: zod.z.number().positive().optional()
|
|
1986
|
+
ambientLight: zod.z.number().positive().optional(),
|
|
1987
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1735
1988
|
}).strict().optional();
|
|
1736
|
-
|
|
1737
|
-
|
|
1989
|
+
var VERBOSITY_FLAGS17 = { verbose: "-v", debug: "-d" };
|
|
1990
|
+
function pushDeviceArgs(args, options) {
|
|
1738
1991
|
if (options?.monitorFile !== void 0) {
|
|
1739
1992
|
args.push("+Im", options.monitorFile);
|
|
1740
1993
|
}
|
|
@@ -1747,6 +2000,13 @@ function buildArgs21(options) {
|
|
|
1747
2000
|
if (options?.ambientLight !== void 0) {
|
|
1748
2001
|
args.push("+Ca", String(options.ambientLight));
|
|
1749
2002
|
}
|
|
2003
|
+
}
|
|
2004
|
+
function buildArgs29(options) {
|
|
2005
|
+
const args = [];
|
|
2006
|
+
if (options?.verbosity !== void 0) {
|
|
2007
|
+
args.push(VERBOSITY_FLAGS17[options.verbosity]);
|
|
2008
|
+
}
|
|
2009
|
+
pushDeviceArgs(args, options);
|
|
1750
2010
|
return args;
|
|
1751
2011
|
}
|
|
1752
2012
|
async function dcmdspfn(options) {
|
|
@@ -1758,7 +2018,7 @@ async function dcmdspfn(options) {
|
|
|
1758
2018
|
if (!binaryResult.ok) {
|
|
1759
2019
|
return err(binaryResult.error);
|
|
1760
2020
|
}
|
|
1761
|
-
const args =
|
|
2021
|
+
const args = buildArgs29(options);
|
|
1762
2022
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1763
2023
|
const result = await execCommand(binaryResult.value, args, {
|
|
1764
2024
|
timeoutMs,
|
|
@@ -1774,8 +2034,19 @@ async function dcmdspfn(options) {
|
|
|
1774
2034
|
}
|
|
1775
2035
|
var Dcod2lumOptionsSchema = zod.z.object({
|
|
1776
2036
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1777
|
-
signal: zod.z.instanceof(AbortSignal).optional()
|
|
2037
|
+
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
2038
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1778
2039
|
}).strict().optional();
|
|
2040
|
+
function buildArgs30(inputPath, outputPath, options) {
|
|
2041
|
+
const args = [];
|
|
2042
|
+
if (options?.verbosity === "verbose") {
|
|
2043
|
+
args.push("-v");
|
|
2044
|
+
} else if (options?.verbosity === "debug") {
|
|
2045
|
+
args.push("-d");
|
|
2046
|
+
}
|
|
2047
|
+
args.push(inputPath, outputPath);
|
|
2048
|
+
return args;
|
|
2049
|
+
}
|
|
1779
2050
|
async function dcod2lum(inputPath, outputPath, options) {
|
|
1780
2051
|
const validation = Dcod2lumOptionsSchema.safeParse(options);
|
|
1781
2052
|
if (!validation.success) {
|
|
@@ -1785,7 +2056,7 @@ async function dcod2lum(inputPath, outputPath, options) {
|
|
|
1785
2056
|
if (!binaryResult.ok) {
|
|
1786
2057
|
return err(binaryResult.error);
|
|
1787
2058
|
}
|
|
1788
|
-
const args =
|
|
2059
|
+
const args = buildArgs30(inputPath, outputPath, options);
|
|
1789
2060
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1790
2061
|
const result = await execCommand(binaryResult.value, args, {
|
|
1791
2062
|
timeoutMs,
|
|
@@ -1802,10 +2073,16 @@ async function dcod2lum(inputPath, outputPath, options) {
|
|
|
1802
2073
|
var DconvlumOptionsSchema = zod.z.object({
|
|
1803
2074
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1804
2075
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
1805
|
-
ambientLight: zod.z.number().positive().optional()
|
|
2076
|
+
ambientLight: zod.z.number().positive().optional(),
|
|
2077
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
1806
2078
|
}).strict().optional();
|
|
1807
|
-
function
|
|
2079
|
+
function buildArgs31(inputPath, outputPath, options) {
|
|
1808
2080
|
const args = [];
|
|
2081
|
+
if (options?.verbosity === "verbose") {
|
|
2082
|
+
args.push("-v");
|
|
2083
|
+
} else if (options?.verbosity === "debug") {
|
|
2084
|
+
args.push("-d");
|
|
2085
|
+
}
|
|
1809
2086
|
if (options?.ambientLight !== void 0) {
|
|
1810
2087
|
args.push("+Ca", String(options.ambientLight));
|
|
1811
2088
|
}
|
|
@@ -1821,7 +2098,7 @@ async function dconvlum(inputPath, outputPath, options) {
|
|
|
1821
2098
|
if (!binaryResult.ok) {
|
|
1822
2099
|
return err(binaryResult.error);
|
|
1823
2100
|
}
|
|
1824
|
-
const args =
|
|
2101
|
+
const args = buildArgs31(inputPath, outputPath, options);
|
|
1825
2102
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1826
2103
|
const result = await execCommand(binaryResult.value, args, {
|
|
1827
2104
|
timeoutMs,
|
|
@@ -1841,10 +2118,42 @@ var EchoscuOptionsSchema = zod.z.object({
|
|
|
1841
2118
|
host: zod.z.string().min(1),
|
|
1842
2119
|
port: zod.z.number().int().min(1).max(65535),
|
|
1843
2120
|
callingAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
|
|
1844
|
-
calledAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional()
|
|
2121
|
+
calledAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
|
|
2122
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional(),
|
|
2123
|
+
maxPduReceive: zod.z.number().int().min(4096).max(131072).optional(),
|
|
2124
|
+
maxPduSend: zod.z.number().int().min(4096).max(131072).optional(),
|
|
2125
|
+
associationTimeout: zod.z.number().int().positive().optional(),
|
|
2126
|
+
acseTimeout: zod.z.number().int().positive().optional(),
|
|
2127
|
+
dimseTimeout: zod.z.number().int().positive().optional(),
|
|
2128
|
+
noHostnameLookup: zod.z.boolean().optional()
|
|
1845
2129
|
}).strict();
|
|
1846
|
-
|
|
2130
|
+
var VERBOSITY_FLAGS18 = { verbose: "-v", debug: "-d" };
|
|
2131
|
+
function pushNetworkArgs(args, options) {
|
|
2132
|
+
if (options.verbosity !== void 0) {
|
|
2133
|
+
args.push(VERBOSITY_FLAGS18[options.verbosity]);
|
|
2134
|
+
}
|
|
2135
|
+
if (options.maxPduReceive !== void 0) {
|
|
2136
|
+
args.push("--max-pdu", String(options.maxPduReceive));
|
|
2137
|
+
}
|
|
2138
|
+
if (options.maxPduSend !== void 0) {
|
|
2139
|
+
args.push("--max-send-pdu", String(options.maxPduSend));
|
|
2140
|
+
}
|
|
2141
|
+
if (options.associationTimeout !== void 0) {
|
|
2142
|
+
args.push("-to", String(options.associationTimeout));
|
|
2143
|
+
}
|
|
2144
|
+
if (options.acseTimeout !== void 0) {
|
|
2145
|
+
args.push("-ta", String(options.acseTimeout));
|
|
2146
|
+
}
|
|
2147
|
+
if (options.dimseTimeout !== void 0) {
|
|
2148
|
+
args.push("-td", String(options.dimseTimeout));
|
|
2149
|
+
}
|
|
2150
|
+
if (options.noHostnameLookup === true) {
|
|
2151
|
+
args.push("-nh");
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
function buildArgs32(options) {
|
|
1847
2155
|
const args = [];
|
|
2156
|
+
pushNetworkArgs(args, options);
|
|
1848
2157
|
if (options.callingAETitle !== void 0) {
|
|
1849
2158
|
args.push("-aet", options.callingAETitle);
|
|
1850
2159
|
}
|
|
@@ -1863,7 +2172,7 @@ async function echoscu(options) {
|
|
|
1863
2172
|
if (!binaryResult.ok) {
|
|
1864
2173
|
return err(binaryResult.error);
|
|
1865
2174
|
}
|
|
1866
|
-
const args =
|
|
2175
|
+
const args = buildArgs32(options);
|
|
1867
2176
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1868
2177
|
const result = await execCommand(binaryResult.value, args, {
|
|
1869
2178
|
timeoutMs,
|
|
@@ -1877,6 +2186,7 @@ async function echoscu(options) {
|
|
|
1877
2186
|
}
|
|
1878
2187
|
return ok({ success: true, stderr: result.value.stderr });
|
|
1879
2188
|
}
|
|
2189
|
+
var VERBOSITY_FLAGS19 = { verbose: "-v", debug: "-d" };
|
|
1880
2190
|
var DcmsendOptionsSchema = zod.z.object({
|
|
1881
2191
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
1882
2192
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
@@ -1885,16 +2195,51 @@ var DcmsendOptionsSchema = zod.z.object({
|
|
|
1885
2195
|
files: zod.z.array(zod.z.string().min(1).refine(isSafePath, { message: "path traversal detected in file path" })).min(1),
|
|
1886
2196
|
callingAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
|
|
1887
2197
|
calledAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
|
|
1888
|
-
scanDirectory: zod.z.boolean().optional()
|
|
2198
|
+
scanDirectory: zod.z.boolean().optional(),
|
|
2199
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional(),
|
|
2200
|
+
noUidChecks: zod.z.boolean().optional(),
|
|
2201
|
+
maxPduReceive: zod.z.number().int().min(4096).max(131072).optional(),
|
|
2202
|
+
maxPduSend: zod.z.number().int().min(4096).max(131072).optional(),
|
|
2203
|
+
noHostnameLookup: zod.z.boolean().optional(),
|
|
2204
|
+
associationTimeout: zod.z.number().int().positive().optional(),
|
|
2205
|
+
acseTimeout: zod.z.number().int().positive().optional(),
|
|
2206
|
+
dimseTimeout: zod.z.number().int().positive().optional()
|
|
1889
2207
|
}).strict();
|
|
1890
|
-
function
|
|
1891
|
-
const args = [];
|
|
2208
|
+
function pushNetworkArgs2(args, options) {
|
|
1892
2209
|
if (options.callingAETitle !== void 0) {
|
|
1893
2210
|
args.push("-aet", options.callingAETitle);
|
|
1894
2211
|
}
|
|
1895
2212
|
if (options.calledAETitle !== void 0) {
|
|
1896
2213
|
args.push("-aec", options.calledAETitle);
|
|
1897
2214
|
}
|
|
2215
|
+
if (options.noUidChecks === true) {
|
|
2216
|
+
args.push("--no-uid-checks");
|
|
2217
|
+
}
|
|
2218
|
+
if (options.maxPduReceive !== void 0) {
|
|
2219
|
+
args.push("--max-pdu", String(options.maxPduReceive));
|
|
2220
|
+
}
|
|
2221
|
+
if (options.maxPduSend !== void 0) {
|
|
2222
|
+
args.push("--max-send-pdu", String(options.maxPduSend));
|
|
2223
|
+
}
|
|
2224
|
+
if (options.noHostnameLookup === true) {
|
|
2225
|
+
args.push("-nh");
|
|
2226
|
+
}
|
|
2227
|
+
if (options.associationTimeout !== void 0) {
|
|
2228
|
+
args.push("-to", String(options.associationTimeout));
|
|
2229
|
+
}
|
|
2230
|
+
if (options.acseTimeout !== void 0) {
|
|
2231
|
+
args.push("-ta", String(options.acseTimeout));
|
|
2232
|
+
}
|
|
2233
|
+
if (options.dimseTimeout !== void 0) {
|
|
2234
|
+
args.push("-td", String(options.dimseTimeout));
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
function buildArgs33(options) {
|
|
2238
|
+
const args = [];
|
|
2239
|
+
if (options.verbosity !== void 0) {
|
|
2240
|
+
args.push(VERBOSITY_FLAGS19[options.verbosity]);
|
|
2241
|
+
}
|
|
2242
|
+
pushNetworkArgs2(args, options);
|
|
1898
2243
|
if (options.scanDirectory === true) {
|
|
1899
2244
|
args.push("--scan-directories");
|
|
1900
2245
|
}
|
|
@@ -1911,7 +2256,7 @@ async function dcmsend(options) {
|
|
|
1911
2256
|
if (!binaryResult.ok) {
|
|
1912
2257
|
return err(binaryResult.error);
|
|
1913
2258
|
}
|
|
1914
|
-
const args =
|
|
2259
|
+
const args = buildArgs33(options);
|
|
1915
2260
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1916
2261
|
const result = await execCommand(binaryResult.value, args, {
|
|
1917
2262
|
timeoutMs,
|
|
@@ -1923,7 +2268,7 @@ async function dcmsend(options) {
|
|
|
1923
2268
|
if (result.value.exitCode !== 0) {
|
|
1924
2269
|
return err(createToolError("dcmsend", args, result.value.exitCode, result.value.stderr));
|
|
1925
2270
|
}
|
|
1926
|
-
return ok({ success: true, stderr: result.value.stderr });
|
|
2271
|
+
return ok({ success: true, stdout: result.value.stdout, stderr: result.value.stderr });
|
|
1927
2272
|
}
|
|
1928
2273
|
var ProposedTransferSyntax = {
|
|
1929
2274
|
UNCOMPRESSED: "uncompressed",
|
|
@@ -1961,6 +2306,14 @@ var StorescuOptionsSchema = zod.z.object({
|
|
|
1961
2306
|
calledAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
|
|
1962
2307
|
scanDirectories: zod.z.boolean().optional(),
|
|
1963
2308
|
recurse: zod.z.boolean().optional(),
|
|
2309
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional(),
|
|
2310
|
+
maxPduReceive: zod.z.number().int().min(4096).max(131072).optional(),
|
|
2311
|
+
maxPduSend: zod.z.number().int().min(4096).max(131072).optional(),
|
|
2312
|
+
associationTimeout: zod.z.number().int().positive().optional(),
|
|
2313
|
+
acseTimeout: zod.z.number().int().positive().optional(),
|
|
2314
|
+
dimseTimeout: zod.z.number().int().positive().optional(),
|
|
2315
|
+
noHostnameLookup: zod.z.boolean().optional(),
|
|
2316
|
+
noUidChecks: zod.z.boolean().optional(),
|
|
1964
2317
|
proposedTransferSyntax: zod.z.enum([
|
|
1965
2318
|
"uncompressed",
|
|
1966
2319
|
"littleEndian",
|
|
@@ -1975,8 +2328,36 @@ var StorescuOptionsSchema = zod.z.object({
|
|
|
1975
2328
|
"jlsLossy"
|
|
1976
2329
|
]).optional()
|
|
1977
2330
|
}).strict();
|
|
1978
|
-
|
|
2331
|
+
var VERBOSITY_FLAGS20 = { verbose: "-v", debug: "-d" };
|
|
2332
|
+
function pushNetworkArgs3(args, options) {
|
|
2333
|
+
if (options.verbosity !== void 0) {
|
|
2334
|
+
args.push(VERBOSITY_FLAGS20[options.verbosity]);
|
|
2335
|
+
}
|
|
2336
|
+
if (options.maxPduReceive !== void 0) {
|
|
2337
|
+
args.push("--max-pdu", String(options.maxPduReceive));
|
|
2338
|
+
}
|
|
2339
|
+
if (options.maxPduSend !== void 0) {
|
|
2340
|
+
args.push("--max-send-pdu", String(options.maxPduSend));
|
|
2341
|
+
}
|
|
2342
|
+
if (options.associationTimeout !== void 0) {
|
|
2343
|
+
args.push("-to", String(options.associationTimeout));
|
|
2344
|
+
}
|
|
2345
|
+
if (options.acseTimeout !== void 0) {
|
|
2346
|
+
args.push("-ta", String(options.acseTimeout));
|
|
2347
|
+
}
|
|
2348
|
+
if (options.dimseTimeout !== void 0) {
|
|
2349
|
+
args.push("-td", String(options.dimseTimeout));
|
|
2350
|
+
}
|
|
2351
|
+
if (options.noHostnameLookup === true) {
|
|
2352
|
+
args.push("-nh");
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
function buildArgs34(options) {
|
|
1979
2356
|
const args = [];
|
|
2357
|
+
pushNetworkArgs3(args, options);
|
|
2358
|
+
if (options.noUidChecks === true) {
|
|
2359
|
+
args.push("--no-uid-checks");
|
|
2360
|
+
}
|
|
1980
2361
|
if (options.callingAETitle !== void 0) {
|
|
1981
2362
|
args.push("-aet", options.callingAETitle);
|
|
1982
2363
|
}
|
|
@@ -2005,7 +2386,7 @@ async function storescu(options) {
|
|
|
2005
2386
|
if (!binaryResult.ok) {
|
|
2006
2387
|
return err(binaryResult.error);
|
|
2007
2388
|
}
|
|
2008
|
-
const args =
|
|
2389
|
+
const args = buildArgs34(options);
|
|
2009
2390
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2010
2391
|
const result = await execCommand(binaryResult.value, args, {
|
|
2011
2392
|
timeoutMs,
|
|
@@ -2039,12 +2420,44 @@ var FindscuOptionsSchema = zod.z.object({
|
|
|
2039
2420
|
queryModel: zod.z.enum(["worklist", "patient", "study"]).optional(),
|
|
2040
2421
|
keys: zod.z.array(zod.z.string().min(1).refine(isValidDicomKey, { message: "invalid DICOM query key format (expected XXXX,XXXX[=value])" })).optional(),
|
|
2041
2422
|
extract: zod.z.boolean().optional(),
|
|
2042
|
-
outputDirectory: zod.z.string().min(1).refine(isSafePath, { message: "path traversal detected in outputDirectory" }).optional()
|
|
2423
|
+
outputDirectory: zod.z.string().min(1).refine(isSafePath, { message: "path traversal detected in outputDirectory" }).optional(),
|
|
2424
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional(),
|
|
2425
|
+
maxPduReceive: zod.z.number().int().min(4096).max(131072).optional(),
|
|
2426
|
+
maxPduSend: zod.z.number().int().min(4096).max(131072).optional(),
|
|
2427
|
+
associationTimeout: zod.z.number().int().positive().optional(),
|
|
2428
|
+
acseTimeout: zod.z.number().int().positive().optional(),
|
|
2429
|
+
dimseTimeout: zod.z.number().int().positive().optional(),
|
|
2430
|
+
noHostnameLookup: zod.z.boolean().optional()
|
|
2043
2431
|
}).strict().refine((data) => data.extract !== true || data.outputDirectory !== void 0, {
|
|
2044
2432
|
message: "outputDirectory is required when extract is true"
|
|
2045
2433
|
});
|
|
2046
|
-
|
|
2434
|
+
var VERBOSITY_FLAGS21 = { verbose: "-v", debug: "-d" };
|
|
2435
|
+
function pushNetworkArgs4(args, options) {
|
|
2436
|
+
if (options.verbosity !== void 0) {
|
|
2437
|
+
args.push(VERBOSITY_FLAGS21[options.verbosity]);
|
|
2438
|
+
}
|
|
2439
|
+
if (options.maxPduReceive !== void 0) {
|
|
2440
|
+
args.push("--max-pdu", String(options.maxPduReceive));
|
|
2441
|
+
}
|
|
2442
|
+
if (options.maxPduSend !== void 0) {
|
|
2443
|
+
args.push("--max-send-pdu", String(options.maxPduSend));
|
|
2444
|
+
}
|
|
2445
|
+
if (options.associationTimeout !== void 0) {
|
|
2446
|
+
args.push("-to", String(options.associationTimeout));
|
|
2447
|
+
}
|
|
2448
|
+
if (options.acseTimeout !== void 0) {
|
|
2449
|
+
args.push("-ta", String(options.acseTimeout));
|
|
2450
|
+
}
|
|
2451
|
+
if (options.dimseTimeout !== void 0) {
|
|
2452
|
+
args.push("-td", String(options.dimseTimeout));
|
|
2453
|
+
}
|
|
2454
|
+
if (options.noHostnameLookup === true) {
|
|
2455
|
+
args.push("-nh");
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
function buildArgs35(options) {
|
|
2047
2459
|
const args = [];
|
|
2460
|
+
pushNetworkArgs4(args, options);
|
|
2048
2461
|
if (options.callingAETitle !== void 0) {
|
|
2049
2462
|
args.push("-aet", options.callingAETitle);
|
|
2050
2463
|
}
|
|
@@ -2077,7 +2490,7 @@ async function findscu(options) {
|
|
|
2077
2490
|
if (!binaryResult.ok) {
|
|
2078
2491
|
return err(binaryResult.error);
|
|
2079
2492
|
}
|
|
2080
|
-
const args =
|
|
2493
|
+
const args = buildArgs35(options);
|
|
2081
2494
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2082
2495
|
const result = await execCommand(binaryResult.value, args, {
|
|
2083
2496
|
timeoutMs,
|
|
@@ -2109,10 +2522,42 @@ var MovescuOptionsSchema = zod.z.object({
|
|
|
2109
2522
|
queryModel: zod.z.enum(["patient", "study"]).optional(),
|
|
2110
2523
|
keys: zod.z.array(zod.z.string().min(1).refine(isValidDicomKey, { message: "invalid DICOM query key format (expected XXXX,XXXX[=value])" })).optional(),
|
|
2111
2524
|
moveDestination: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
|
|
2112
|
-
outputDirectory: zod.z.string().min(1).refine(isSafePath, { message: "path traversal detected in outputDirectory" }).optional()
|
|
2525
|
+
outputDirectory: zod.z.string().min(1).refine(isSafePath, { message: "path traversal detected in outputDirectory" }).optional(),
|
|
2526
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional(),
|
|
2527
|
+
maxPduReceive: zod.z.number().int().min(4096).max(131072).optional(),
|
|
2528
|
+
maxPduSend: zod.z.number().int().min(4096).max(131072).optional(),
|
|
2529
|
+
associationTimeout: zod.z.number().int().positive().optional(),
|
|
2530
|
+
acseTimeout: zod.z.number().int().positive().optional(),
|
|
2531
|
+
dimseTimeout: zod.z.number().int().positive().optional(),
|
|
2532
|
+
noHostnameLookup: zod.z.boolean().optional()
|
|
2113
2533
|
}).strict();
|
|
2114
|
-
|
|
2534
|
+
var VERBOSITY_FLAGS22 = { verbose: "-v", debug: "-d" };
|
|
2535
|
+
function pushNetworkArgs5(args, options) {
|
|
2536
|
+
if (options.verbosity !== void 0) {
|
|
2537
|
+
args.push(VERBOSITY_FLAGS22[options.verbosity]);
|
|
2538
|
+
}
|
|
2539
|
+
if (options.maxPduReceive !== void 0) {
|
|
2540
|
+
args.push("--max-pdu", String(options.maxPduReceive));
|
|
2541
|
+
}
|
|
2542
|
+
if (options.maxPduSend !== void 0) {
|
|
2543
|
+
args.push("--max-send-pdu", String(options.maxPduSend));
|
|
2544
|
+
}
|
|
2545
|
+
if (options.associationTimeout !== void 0) {
|
|
2546
|
+
args.push("-to", String(options.associationTimeout));
|
|
2547
|
+
}
|
|
2548
|
+
if (options.acseTimeout !== void 0) {
|
|
2549
|
+
args.push("-ta", String(options.acseTimeout));
|
|
2550
|
+
}
|
|
2551
|
+
if (options.dimseTimeout !== void 0) {
|
|
2552
|
+
args.push("-td", String(options.dimseTimeout));
|
|
2553
|
+
}
|
|
2554
|
+
if (options.noHostnameLookup === true) {
|
|
2555
|
+
args.push("-nh");
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
function buildArgs36(options) {
|
|
2115
2559
|
const args = [];
|
|
2560
|
+
pushNetworkArgs5(args, options);
|
|
2116
2561
|
if (options.callingAETitle !== void 0) {
|
|
2117
2562
|
args.push("-aet", options.callingAETitle);
|
|
2118
2563
|
}
|
|
@@ -2145,7 +2590,7 @@ async function movescu(options) {
|
|
|
2145
2590
|
if (!binaryResult.ok) {
|
|
2146
2591
|
return err(binaryResult.error);
|
|
2147
2592
|
}
|
|
2148
|
-
const args =
|
|
2593
|
+
const args = buildArgs36(options);
|
|
2149
2594
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2150
2595
|
const result = await execCommand(binaryResult.value, args, {
|
|
2151
2596
|
timeoutMs,
|
|
@@ -2176,10 +2621,42 @@ var GetscuOptionsSchema = zod.z.object({
|
|
|
2176
2621
|
calledAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
|
|
2177
2622
|
queryModel: zod.z.enum(["patient", "study"]).optional(),
|
|
2178
2623
|
keys: zod.z.array(zod.z.string().min(1).refine(isValidDicomKey, { message: "invalid DICOM query key format (expected XXXX,XXXX[=value])" })).optional(),
|
|
2179
|
-
outputDirectory: zod.z.string().min(1).refine(isSafePath, { message: "path traversal detected in outputDirectory" }).optional()
|
|
2624
|
+
outputDirectory: zod.z.string().min(1).refine(isSafePath, { message: "path traversal detected in outputDirectory" }).optional(),
|
|
2625
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional(),
|
|
2626
|
+
maxPduReceive: zod.z.number().int().min(4096).max(131072).optional(),
|
|
2627
|
+
maxPduSend: zod.z.number().int().min(4096).max(131072).optional(),
|
|
2628
|
+
associationTimeout: zod.z.number().int().positive().optional(),
|
|
2629
|
+
acseTimeout: zod.z.number().int().positive().optional(),
|
|
2630
|
+
dimseTimeout: zod.z.number().int().positive().optional(),
|
|
2631
|
+
noHostnameLookup: zod.z.boolean().optional()
|
|
2180
2632
|
}).strict();
|
|
2181
|
-
|
|
2633
|
+
var VERBOSITY_FLAGS23 = { verbose: "-v", debug: "-d" };
|
|
2634
|
+
function pushNetworkArgs6(args, options) {
|
|
2635
|
+
if (options.verbosity !== void 0) {
|
|
2636
|
+
args.push(VERBOSITY_FLAGS23[options.verbosity]);
|
|
2637
|
+
}
|
|
2638
|
+
if (options.maxPduReceive !== void 0) {
|
|
2639
|
+
args.push("--max-pdu", String(options.maxPduReceive));
|
|
2640
|
+
}
|
|
2641
|
+
if (options.maxPduSend !== void 0) {
|
|
2642
|
+
args.push("--max-send-pdu", String(options.maxPduSend));
|
|
2643
|
+
}
|
|
2644
|
+
if (options.associationTimeout !== void 0) {
|
|
2645
|
+
args.push("-to", String(options.associationTimeout));
|
|
2646
|
+
}
|
|
2647
|
+
if (options.acseTimeout !== void 0) {
|
|
2648
|
+
args.push("-ta", String(options.acseTimeout));
|
|
2649
|
+
}
|
|
2650
|
+
if (options.dimseTimeout !== void 0) {
|
|
2651
|
+
args.push("-td", String(options.dimseTimeout));
|
|
2652
|
+
}
|
|
2653
|
+
if (options.noHostnameLookup === true) {
|
|
2654
|
+
args.push("-nh");
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
function buildArgs37(options) {
|
|
2182
2658
|
const args = [];
|
|
2659
|
+
pushNetworkArgs6(args, options);
|
|
2183
2660
|
if (options.callingAETitle !== void 0) {
|
|
2184
2661
|
args.push("-aet", options.callingAETitle);
|
|
2185
2662
|
}
|
|
@@ -2209,7 +2686,7 @@ async function getscu(options) {
|
|
|
2209
2686
|
if (!binaryResult.ok) {
|
|
2210
2687
|
return err(binaryResult.error);
|
|
2211
2688
|
}
|
|
2212
|
-
const args =
|
|
2689
|
+
const args = buildArgs37(options);
|
|
2213
2690
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2214
2691
|
const result = await execCommand(binaryResult.value, args, {
|
|
2215
2692
|
timeoutMs,
|
|
@@ -2229,10 +2706,42 @@ var TermscuOptionsSchema = zod.z.object({
|
|
|
2229
2706
|
host: zod.z.string().min(1),
|
|
2230
2707
|
port: zod.z.number().int().min(1).max(65535),
|
|
2231
2708
|
callingAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
|
|
2232
|
-
calledAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional()
|
|
2709
|
+
calledAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
|
|
2710
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional(),
|
|
2711
|
+
maxPduReceive: zod.z.number().int().min(4096).max(131072).optional(),
|
|
2712
|
+
maxPduSend: zod.z.number().int().min(4096).max(131072).optional(),
|
|
2713
|
+
associationTimeout: zod.z.number().int().positive().optional(),
|
|
2714
|
+
acseTimeout: zod.z.number().int().positive().optional(),
|
|
2715
|
+
dimseTimeout: zod.z.number().int().positive().optional(),
|
|
2716
|
+
noHostnameLookup: zod.z.boolean().optional()
|
|
2233
2717
|
}).strict();
|
|
2234
|
-
|
|
2718
|
+
var VERBOSITY_FLAGS24 = { verbose: "-v", debug: "-d" };
|
|
2719
|
+
function pushNetworkArgs7(args, options) {
|
|
2720
|
+
if (options.verbosity !== void 0) {
|
|
2721
|
+
args.push(VERBOSITY_FLAGS24[options.verbosity]);
|
|
2722
|
+
}
|
|
2723
|
+
if (options.maxPduReceive !== void 0) {
|
|
2724
|
+
args.push("--max-pdu", String(options.maxPduReceive));
|
|
2725
|
+
}
|
|
2726
|
+
if (options.maxPduSend !== void 0) {
|
|
2727
|
+
args.push("--max-send-pdu", String(options.maxPduSend));
|
|
2728
|
+
}
|
|
2729
|
+
if (options.associationTimeout !== void 0) {
|
|
2730
|
+
args.push("-to", String(options.associationTimeout));
|
|
2731
|
+
}
|
|
2732
|
+
if (options.acseTimeout !== void 0) {
|
|
2733
|
+
args.push("-ta", String(options.acseTimeout));
|
|
2734
|
+
}
|
|
2735
|
+
if (options.dimseTimeout !== void 0) {
|
|
2736
|
+
args.push("-td", String(options.dimseTimeout));
|
|
2737
|
+
}
|
|
2738
|
+
if (options.noHostnameLookup === true) {
|
|
2739
|
+
args.push("-nh");
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
function buildArgs38(options) {
|
|
2235
2743
|
const args = [];
|
|
2744
|
+
pushNetworkArgs7(args, options);
|
|
2236
2745
|
if (options.callingAETitle !== void 0) {
|
|
2237
2746
|
args.push("-aet", options.callingAETitle);
|
|
2238
2747
|
}
|
|
@@ -2251,7 +2760,7 @@ async function termscu(options) {
|
|
|
2251
2760
|
if (!binaryResult.ok) {
|
|
2252
2761
|
return err(binaryResult.error);
|
|
2253
2762
|
}
|
|
2254
|
-
const args =
|
|
2763
|
+
const args = buildArgs38(options);
|
|
2255
2764
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2256
2765
|
const result = await execCommand(binaryResult.value, args, {
|
|
2257
2766
|
timeoutMs,
|
|
@@ -2265,15 +2774,17 @@ async function termscu(options) {
|
|
|
2265
2774
|
}
|
|
2266
2775
|
return ok({ success: true, stderr: result.value.stderr });
|
|
2267
2776
|
}
|
|
2777
|
+
var VERBOSITY_FLAGS25 = { verbose: "-v", debug: "-d" };
|
|
2268
2778
|
var DsrdumpOptionsSchema = zod.z.object({
|
|
2269
2779
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
2270
2780
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
2271
2781
|
printFilename: zod.z.boolean().optional(),
|
|
2272
2782
|
printLong: zod.z.boolean().optional(),
|
|
2273
|
-
printCodes: zod.z.boolean().optional()
|
|
2783
|
+
printCodes: zod.z.boolean().optional(),
|
|
2784
|
+
charsetAssume: zod.z.string().min(1).optional(),
|
|
2785
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
2274
2786
|
}).strict().optional();
|
|
2275
|
-
function
|
|
2276
|
-
const args = [];
|
|
2787
|
+
function pushDisplayArgs2(args, options) {
|
|
2277
2788
|
if (options?.printFilename === true) {
|
|
2278
2789
|
args.push("+Pf");
|
|
2279
2790
|
}
|
|
@@ -2283,6 +2794,16 @@ function buildArgs30(inputPath, options) {
|
|
|
2283
2794
|
if (options?.printCodes === true) {
|
|
2284
2795
|
args.push("+Pc");
|
|
2285
2796
|
}
|
|
2797
|
+
if (options?.charsetAssume !== void 0) {
|
|
2798
|
+
args.push("+Ca", options.charsetAssume);
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
function buildArgs39(inputPath, options) {
|
|
2802
|
+
const args = [];
|
|
2803
|
+
if (options?.verbosity !== void 0) {
|
|
2804
|
+
args.push(VERBOSITY_FLAGS25[options.verbosity]);
|
|
2805
|
+
}
|
|
2806
|
+
pushDisplayArgs2(args, options);
|
|
2286
2807
|
args.push(inputPath);
|
|
2287
2808
|
return args;
|
|
2288
2809
|
}
|
|
@@ -2295,7 +2816,7 @@ async function dsrdump(inputPath, options) {
|
|
|
2295
2816
|
if (!binaryResult.ok) {
|
|
2296
2817
|
return err(binaryResult.error);
|
|
2297
2818
|
}
|
|
2298
|
-
const args =
|
|
2819
|
+
const args = buildArgs39(inputPath, options);
|
|
2299
2820
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2300
2821
|
const result = await execCommand(binaryResult.value, args, {
|
|
2301
2822
|
timeoutMs,
|
|
@@ -2309,20 +2830,29 @@ async function dsrdump(inputPath, options) {
|
|
|
2309
2830
|
}
|
|
2310
2831
|
return ok({ text: result.value.stdout });
|
|
2311
2832
|
}
|
|
2833
|
+
var VERBOSITY_FLAGS26 = { verbose: "-v", debug: "-d" };
|
|
2312
2834
|
var Dsr2xmlOptionsSchema = zod.z.object({
|
|
2313
2835
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
2314
2836
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
2315
2837
|
useNamespace: zod.z.boolean().optional(),
|
|
2316
|
-
addSchemaRef: zod.z.boolean().optional()
|
|
2838
|
+
addSchemaRef: zod.z.boolean().optional(),
|
|
2839
|
+
charsetAssume: zod.z.string().min(1).optional(),
|
|
2840
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
2317
2841
|
}).strict().optional();
|
|
2318
|
-
function
|
|
2842
|
+
function buildArgs40(inputPath, options) {
|
|
2319
2843
|
const args = [];
|
|
2844
|
+
if (options?.verbosity !== void 0) {
|
|
2845
|
+
args.push(VERBOSITY_FLAGS26[options.verbosity]);
|
|
2846
|
+
}
|
|
2320
2847
|
if (options?.useNamespace === true) {
|
|
2321
2848
|
args.push("+Xn");
|
|
2322
2849
|
}
|
|
2323
2850
|
if (options?.addSchemaRef === true) {
|
|
2324
2851
|
args.push("+Xs");
|
|
2325
2852
|
}
|
|
2853
|
+
if (options?.charsetAssume !== void 0) {
|
|
2854
|
+
args.push("+Ca", options.charsetAssume);
|
|
2855
|
+
}
|
|
2326
2856
|
args.push(inputPath);
|
|
2327
2857
|
return args;
|
|
2328
2858
|
}
|
|
@@ -2335,7 +2865,7 @@ async function dsr2xml(inputPath, options) {
|
|
|
2335
2865
|
if (!binaryResult.ok) {
|
|
2336
2866
|
return err(binaryResult.error);
|
|
2337
2867
|
}
|
|
2338
|
-
const args =
|
|
2868
|
+
const args = buildArgs40(inputPath, options);
|
|
2339
2869
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2340
2870
|
const result = await execCommand(binaryResult.value, args, {
|
|
2341
2871
|
timeoutMs,
|
|
@@ -2353,10 +2883,16 @@ var Xml2dsrOptionsSchema = zod.z.object({
|
|
|
2353
2883
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
2354
2884
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
2355
2885
|
generateNewUIDs: zod.z.boolean().optional(),
|
|
2356
|
-
validateDocument: zod.z.boolean().optional()
|
|
2886
|
+
validateDocument: zod.z.boolean().optional(),
|
|
2887
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
2357
2888
|
}).strict().optional();
|
|
2358
|
-
function
|
|
2889
|
+
function buildArgs41(inputPath, outputPath, options) {
|
|
2359
2890
|
const args = [];
|
|
2891
|
+
if (options?.verbosity === "verbose") {
|
|
2892
|
+
args.push("-v");
|
|
2893
|
+
} else if (options?.verbosity === "debug") {
|
|
2894
|
+
args.push("-d");
|
|
2895
|
+
}
|
|
2360
2896
|
if (options?.generateNewUIDs === true) {
|
|
2361
2897
|
args.push("+Ug");
|
|
2362
2898
|
}
|
|
@@ -2375,7 +2911,7 @@ async function xml2dsr(inputPath, outputPath, options) {
|
|
|
2375
2911
|
if (!binaryResult.ok) {
|
|
2376
2912
|
return err(binaryResult.error);
|
|
2377
2913
|
}
|
|
2378
|
-
const args =
|
|
2914
|
+
const args = buildArgs41(inputPath, outputPath, options);
|
|
2379
2915
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2380
2916
|
const result = await execCommand(binaryResult.value, args, {
|
|
2381
2917
|
timeoutMs,
|
|
@@ -2392,10 +2928,16 @@ async function xml2dsr(inputPath, outputPath, options) {
|
|
|
2392
2928
|
var DrtdumpOptionsSchema = zod.z.object({
|
|
2393
2929
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
2394
2930
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
2395
|
-
printFilename: zod.z.boolean().optional()
|
|
2931
|
+
printFilename: zod.z.boolean().optional(),
|
|
2932
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
2396
2933
|
}).strict().optional();
|
|
2397
|
-
function
|
|
2934
|
+
function buildArgs42(inputPath, options) {
|
|
2398
2935
|
const args = [];
|
|
2936
|
+
if (options?.verbosity === "verbose") {
|
|
2937
|
+
args.push("-v");
|
|
2938
|
+
} else if (options?.verbosity === "debug") {
|
|
2939
|
+
args.push("-d");
|
|
2940
|
+
}
|
|
2399
2941
|
if (options?.printFilename === true) {
|
|
2400
2942
|
args.push("+Pf");
|
|
2401
2943
|
}
|
|
@@ -2411,7 +2953,7 @@ async function drtdump(inputPath, options) {
|
|
|
2411
2953
|
if (!binaryResult.ok) {
|
|
2412
2954
|
return err(binaryResult.error);
|
|
2413
2955
|
}
|
|
2414
|
-
const args =
|
|
2956
|
+
const args = buildArgs42(inputPath, options);
|
|
2415
2957
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2416
2958
|
const result = await execCommand(binaryResult.value, args, {
|
|
2417
2959
|
timeoutMs,
|
|
@@ -2427,8 +2969,18 @@ async function drtdump(inputPath, options) {
|
|
|
2427
2969
|
}
|
|
2428
2970
|
var DcmpsmkOptionsSchema = zod.z.object({
|
|
2429
2971
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
2430
|
-
signal: zod.z.instanceof(AbortSignal).optional()
|
|
2972
|
+
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
2973
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
2431
2974
|
}).strict().optional();
|
|
2975
|
+
var VERBOSITY_FLAGS27 = { verbose: "-v", debug: "-d" };
|
|
2976
|
+
function buildArgs43(inputPath, outputPath, options) {
|
|
2977
|
+
const args = [];
|
|
2978
|
+
if (options?.verbosity !== void 0) {
|
|
2979
|
+
args.push(VERBOSITY_FLAGS27[options.verbosity]);
|
|
2980
|
+
}
|
|
2981
|
+
args.push(inputPath, outputPath);
|
|
2982
|
+
return args;
|
|
2983
|
+
}
|
|
2432
2984
|
async function dcmpsmk(inputPath, outputPath, options) {
|
|
2433
2985
|
const validation = DcmpsmkOptionsSchema.safeParse(options);
|
|
2434
2986
|
if (!validation.success) {
|
|
@@ -2438,7 +2990,7 @@ async function dcmpsmk(inputPath, outputPath, options) {
|
|
|
2438
2990
|
if (!binaryResult.ok) {
|
|
2439
2991
|
return err(binaryResult.error);
|
|
2440
2992
|
}
|
|
2441
|
-
const args =
|
|
2993
|
+
const args = buildArgs43(inputPath, outputPath, options);
|
|
2442
2994
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2443
2995
|
const result = await execCommand(binaryResult.value, args, {
|
|
2444
2996
|
timeoutMs,
|
|
@@ -2454,8 +3006,18 @@ async function dcmpsmk(inputPath, outputPath, options) {
|
|
|
2454
3006
|
}
|
|
2455
3007
|
var DcmpschkOptionsSchema = zod.z.object({
|
|
2456
3008
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
2457
|
-
signal: zod.z.instanceof(AbortSignal).optional()
|
|
3009
|
+
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
3010
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
2458
3011
|
}).strict().optional();
|
|
3012
|
+
var VERBOSITY_FLAGS28 = { verbose: "-v", debug: "-d" };
|
|
3013
|
+
function buildArgs44(inputPath, options) {
|
|
3014
|
+
const args = [];
|
|
3015
|
+
if (options?.verbosity !== void 0) {
|
|
3016
|
+
args.push(VERBOSITY_FLAGS28[options.verbosity]);
|
|
3017
|
+
}
|
|
3018
|
+
args.push(inputPath);
|
|
3019
|
+
return args;
|
|
3020
|
+
}
|
|
2459
3021
|
async function dcmpschk(inputPath, options) {
|
|
2460
3022
|
const validation = DcmpschkOptionsSchema.safeParse(options);
|
|
2461
3023
|
if (!validation.success) {
|
|
@@ -2465,7 +3027,7 @@ async function dcmpschk(inputPath, options) {
|
|
|
2465
3027
|
if (!binaryResult.ok) {
|
|
2466
3028
|
return err(binaryResult.error);
|
|
2467
3029
|
}
|
|
2468
|
-
const args =
|
|
3030
|
+
const args = buildArgs44(inputPath, options);
|
|
2469
3031
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2470
3032
|
const result = await execCommand(binaryResult.value, args, {
|
|
2471
3033
|
timeoutMs,
|
|
@@ -2486,10 +3048,16 @@ var DcmprscuOptionsSchema = zod.z.object({
|
|
|
2486
3048
|
port: zod.z.number().int().min(1).max(65535),
|
|
2487
3049
|
callingAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
|
|
2488
3050
|
calledAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
|
|
2489
|
-
configFile: zod.z.string().min(1).optional()
|
|
3051
|
+
configFile: zod.z.string().min(1).optional(),
|
|
3052
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
2490
3053
|
}).strict();
|
|
2491
|
-
function
|
|
3054
|
+
function buildArgs45(options) {
|
|
2492
3055
|
const args = [];
|
|
3056
|
+
if (options.verbosity === "verbose") {
|
|
3057
|
+
args.push("-v");
|
|
3058
|
+
} else if (options.verbosity === "debug") {
|
|
3059
|
+
args.push("-d");
|
|
3060
|
+
}
|
|
2493
3061
|
if (options.callingAETitle !== void 0) {
|
|
2494
3062
|
args.push("-aet", options.callingAETitle);
|
|
2495
3063
|
}
|
|
@@ -2511,7 +3079,7 @@ async function dcmprscu(options) {
|
|
|
2511
3079
|
if (!binaryResult.ok) {
|
|
2512
3080
|
return err(binaryResult.error);
|
|
2513
3081
|
}
|
|
2514
|
-
const args =
|
|
3082
|
+
const args = buildArgs45(options);
|
|
2515
3083
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2516
3084
|
const result = await execCommand(binaryResult.value, args, {
|
|
2517
3085
|
timeoutMs,
|
|
@@ -2528,10 +3096,16 @@ async function dcmprscu(options) {
|
|
|
2528
3096
|
var DcmpsprtOptionsSchema = zod.z.object({
|
|
2529
3097
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
2530
3098
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
2531
|
-
configFile: zod.z.string().min(1).optional()
|
|
3099
|
+
configFile: zod.z.string().min(1).optional(),
|
|
3100
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
2532
3101
|
}).strict().optional();
|
|
2533
|
-
function
|
|
3102
|
+
function buildArgs46(inputPath, options) {
|
|
2534
3103
|
const args = [];
|
|
3104
|
+
if (options?.verbosity === "verbose") {
|
|
3105
|
+
args.push("-v");
|
|
3106
|
+
} else if (options?.verbosity === "debug") {
|
|
3107
|
+
args.push("-d");
|
|
3108
|
+
}
|
|
2535
3109
|
if (options?.configFile !== void 0) {
|
|
2536
3110
|
args.push("-c", options.configFile);
|
|
2537
3111
|
}
|
|
@@ -2547,7 +3121,7 @@ async function dcmpsprt(inputPath, options) {
|
|
|
2547
3121
|
if (!binaryResult.ok) {
|
|
2548
3122
|
return err(binaryResult.error);
|
|
2549
3123
|
}
|
|
2550
|
-
const args =
|
|
3124
|
+
const args = buildArgs46(inputPath, options);
|
|
2551
3125
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2552
3126
|
const result = await execCommand(binaryResult.value, args, {
|
|
2553
3127
|
timeoutMs,
|
|
@@ -2565,10 +3139,16 @@ var Dcmp2pgmOptionsSchema = zod.z.object({
|
|
|
2565
3139
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
2566
3140
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
2567
3141
|
presentationState: zod.z.string().min(1).optional(),
|
|
2568
|
-
frame: zod.z.number().int().min(0).max(65535).optional()
|
|
3142
|
+
frame: zod.z.number().int().min(0).max(65535).optional(),
|
|
3143
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
2569
3144
|
}).strict().optional();
|
|
2570
|
-
function
|
|
3145
|
+
function buildArgs47(inputPath, outputPath, options) {
|
|
2571
3146
|
const args = [];
|
|
3147
|
+
if (options?.verbosity === "verbose") {
|
|
3148
|
+
args.push("-v");
|
|
3149
|
+
} else if (options?.verbosity === "debug") {
|
|
3150
|
+
args.push("-d");
|
|
3151
|
+
}
|
|
2572
3152
|
if (options?.presentationState !== void 0) {
|
|
2573
3153
|
args.push("-p", options.presentationState);
|
|
2574
3154
|
}
|
|
@@ -2587,7 +3167,7 @@ async function dcmp2pgm(inputPath, outputPath, options) {
|
|
|
2587
3167
|
if (!binaryResult.ok) {
|
|
2588
3168
|
return err(binaryResult.error);
|
|
2589
3169
|
}
|
|
2590
|
-
const args =
|
|
3170
|
+
const args = buildArgs47(inputPath, outputPath, options);
|
|
2591
3171
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2592
3172
|
const result = await execCommand(binaryResult.value, args, {
|
|
2593
3173
|
timeoutMs,
|
|
@@ -2603,8 +3183,18 @@ async function dcmp2pgm(inputPath, outputPath, options) {
|
|
|
2603
3183
|
}
|
|
2604
3184
|
var DcmmkcrvOptionsSchema = zod.z.object({
|
|
2605
3185
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
2606
|
-
signal: zod.z.instanceof(AbortSignal).optional()
|
|
3186
|
+
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
3187
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
2607
3188
|
}).strict().optional();
|
|
3189
|
+
var VERBOSITY_FLAGS29 = { verbose: "-v", debug: "-d" };
|
|
3190
|
+
function buildArgs48(inputPath, outputPath, options) {
|
|
3191
|
+
const args = [];
|
|
3192
|
+
if (options?.verbosity !== void 0) {
|
|
3193
|
+
args.push(VERBOSITY_FLAGS29[options.verbosity]);
|
|
3194
|
+
}
|
|
3195
|
+
args.push(inputPath, outputPath);
|
|
3196
|
+
return args;
|
|
3197
|
+
}
|
|
2608
3198
|
async function dcmmkcrv(inputPath, outputPath, options) {
|
|
2609
3199
|
const validation = DcmmkcrvOptionsSchema.safeParse(options);
|
|
2610
3200
|
if (!validation.success) {
|
|
@@ -2614,7 +3204,7 @@ async function dcmmkcrv(inputPath, outputPath, options) {
|
|
|
2614
3204
|
if (!binaryResult.ok) {
|
|
2615
3205
|
return err(binaryResult.error);
|
|
2616
3206
|
}
|
|
2617
|
-
const args =
|
|
3207
|
+
const args = buildArgs48(inputPath, outputPath, options);
|
|
2618
3208
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2619
3209
|
const result = await execCommand(binaryResult.value, args, {
|
|
2620
3210
|
timeoutMs,
|
|
@@ -2641,16 +3231,17 @@ var LUT_TYPE_FLAGS = {
|
|
|
2641
3231
|
presentation: "+Tp",
|
|
2642
3232
|
voi: "+Tv"
|
|
2643
3233
|
};
|
|
3234
|
+
var VERBOSITY_FLAGS30 = { verbose: "-v", debug: "-d" };
|
|
2644
3235
|
var DcmmklutOptionsSchema = zod.z.object({
|
|
2645
3236
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
2646
3237
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
2647
3238
|
lutType: zod.z.enum(["modality", "presentation", "voi"]).optional(),
|
|
2648
3239
|
gamma: zod.z.number().positive().optional(),
|
|
2649
3240
|
entries: zod.z.number().int().positive().optional(),
|
|
2650
|
-
bits: zod.z.number().int().min(8).max(16).optional()
|
|
3241
|
+
bits: zod.z.number().int().min(8).max(16).optional(),
|
|
3242
|
+
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
2651
3243
|
}).strict().optional();
|
|
2652
|
-
function
|
|
2653
|
-
const args = [];
|
|
3244
|
+
function pushLutArgs(args, options) {
|
|
2654
3245
|
if (options?.lutType !== void 0) {
|
|
2655
3246
|
args.push(LUT_TYPE_FLAGS[options.lutType]);
|
|
2656
3247
|
}
|
|
@@ -2663,6 +3254,13 @@ function buildArgs37(outputPath, options) {
|
|
|
2663
3254
|
if (options?.bits !== void 0) {
|
|
2664
3255
|
args.push("-b", String(options.bits));
|
|
2665
3256
|
}
|
|
3257
|
+
}
|
|
3258
|
+
function buildArgs49(outputPath, options) {
|
|
3259
|
+
const args = [];
|
|
3260
|
+
if (options?.verbosity !== void 0) {
|
|
3261
|
+
args.push(VERBOSITY_FLAGS30[options.verbosity]);
|
|
3262
|
+
}
|
|
3263
|
+
pushLutArgs(args, options);
|
|
2666
3264
|
args.push(outputPath);
|
|
2667
3265
|
return args;
|
|
2668
3266
|
}
|
|
@@ -2675,7 +3273,7 @@ async function dcmmklut(outputPath, options) {
|
|
|
2675
3273
|
if (!binaryResult.ok) {
|
|
2676
3274
|
return err(binaryResult.error);
|
|
2677
3275
|
}
|
|
2678
|
-
const args =
|
|
3276
|
+
const args = buildArgs49(outputPath, options);
|
|
2679
3277
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2680
3278
|
const result = await execCommand(binaryResult.value, args, {
|
|
2681
3279
|
timeoutMs,
|