@ubercode/dcmtk 0.3.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/dist/tools.js CHANGED
@@ -243,19 +243,17 @@ var Dcm2xmlCharset = {
243
243
  /** Use ASCII encoding. */
244
244
  ASCII: "ascii"
245
245
  };
246
+ var VERBOSITY_FLAGS = { verbose: "-v", debug: "-d" };
246
247
  var Dcm2xmlOptionsSchema = z.object({
247
248
  timeoutMs: z.number().int().positive().optional(),
248
249
  signal: z.instanceof(AbortSignal).optional(),
249
250
  namespace: z.boolean().optional(),
250
251
  charset: z.enum(["utf8", "latin1", "ascii"]).optional(),
251
252
  writeBinaryData: z.boolean().optional(),
252
- encodeBinaryBase64: z.boolean().optional()
253
+ encodeBinaryBase64: z.boolean().optional(),
254
+ verbosity: z.enum(["verbose", "debug"]).optional()
253
255
  }).strict().optional();
254
- function buildArgs(inputPath, options) {
255
- const args = [];
256
- if (options?.namespace === true) {
257
- args.push("+Xn");
258
- }
256
+ function pushEncodingArgs(args, options) {
259
257
  if (options?.charset === "latin1") {
260
258
  args.push("+Cl");
261
259
  } else if (options?.charset === "ascii") {
@@ -267,6 +265,16 @@ function buildArgs(inputPath, options) {
267
265
  args.push("+Eb");
268
266
  }
269
267
  }
268
+ }
269
+ function buildArgs(inputPath, options) {
270
+ const args = [];
271
+ if (options?.verbosity !== void 0) {
272
+ args.push(VERBOSITY_FLAGS[options.verbosity]);
273
+ }
274
+ if (options?.namespace === true) {
275
+ args.push("+Xn");
276
+ }
277
+ pushEncodingArgs(args, options);
270
278
  args.push(inputPath);
271
279
  return args;
272
280
  }
@@ -497,19 +505,28 @@ function repairJson(raw) {
497
505
  var Dcm2jsonOptionsSchema = z.object({
498
506
  timeoutMs: z.number().int().positive().optional(),
499
507
  signal: z.instanceof(AbortSignal).optional(),
500
- directOnly: z.boolean().optional()
508
+ directOnly: z.boolean().optional(),
509
+ verbosity: z.enum(["verbose", "debug"]).optional()
501
510
  }).strict().optional();
502
- async function tryXmlPath(inputPath, timeoutMs, signal) {
511
+ var VERBOSITY_FLAGS2 = { verbose: "-v", debug: "-d" };
512
+ function buildVerbosityArgs(verbosity) {
513
+ if (verbosity !== void 0) {
514
+ return [VERBOSITY_FLAGS2[verbosity]];
515
+ }
516
+ return [];
517
+ }
518
+ async function tryXmlPath(inputPath, timeoutMs, signal, verbosity) {
503
519
  const xmlBinary = resolveBinary("dcm2xml");
504
520
  if (!xmlBinary.ok) {
505
521
  return err(xmlBinary.error);
506
522
  }
507
- const xmlResult = await execCommand(xmlBinary.value, ["-nat", inputPath], { timeoutMs, signal });
523
+ const xmlArgs = [...buildVerbosityArgs(verbosity), "-nat", inputPath];
524
+ const xmlResult = await execCommand(xmlBinary.value, xmlArgs, { timeoutMs, signal });
508
525
  if (!xmlResult.ok) {
509
526
  return err(xmlResult.error);
510
527
  }
511
528
  if (xmlResult.value.exitCode !== 0) {
512
- return err(createToolError("dcm2xml", ["-nat", inputPath], xmlResult.value.exitCode, xmlResult.value.stderr));
529
+ return err(createToolError("dcm2xml", xmlArgs, xmlResult.value.exitCode, xmlResult.value.stderr));
513
530
  }
514
531
  const jsonResult = xmlToJson(xmlResult.value.stdout);
515
532
  if (!jsonResult.ok) {
@@ -517,17 +534,18 @@ async function tryXmlPath(inputPath, timeoutMs, signal) {
517
534
  }
518
535
  return ok({ data: jsonResult.value, source: "xml" });
519
536
  }
520
- async function tryDirectPath(inputPath, timeoutMs, signal) {
537
+ async function tryDirectPath(inputPath, timeoutMs, signal, verbosity) {
521
538
  const jsonBinary = resolveBinary("dcm2json");
522
539
  if (!jsonBinary.ok) {
523
540
  return err(jsonBinary.error);
524
541
  }
525
- const result = await execCommand(jsonBinary.value, [inputPath], { timeoutMs, signal });
542
+ const directArgs = [...buildVerbosityArgs(verbosity), inputPath];
543
+ const result = await execCommand(jsonBinary.value, directArgs, { timeoutMs, signal });
526
544
  if (!result.ok) {
527
545
  return err(result.error);
528
546
  }
529
547
  if (result.value.exitCode !== 0) {
530
- return err(createToolError("dcm2json", [inputPath], result.value.exitCode, result.value.stderr));
548
+ return err(createToolError("dcm2json", directArgs, result.value.exitCode, result.value.stderr));
531
549
  }
532
550
  try {
533
551
  const repaired = repairJson(result.value.stdout);
@@ -544,14 +562,15 @@ async function dcm2json(inputPath, options) {
544
562
  }
545
563
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
546
564
  const signal = options?.signal;
565
+ const verbosity = options?.verbosity;
547
566
  if (options?.directOnly === true) {
548
- return tryDirectPath(inputPath, timeoutMs, signal);
567
+ return tryDirectPath(inputPath, timeoutMs, signal, verbosity);
549
568
  }
550
- const xmlResult = await tryXmlPath(inputPath, timeoutMs, signal);
569
+ const xmlResult = await tryXmlPath(inputPath, timeoutMs, signal, verbosity);
551
570
  if (xmlResult.ok) {
552
571
  return xmlResult;
553
572
  }
554
- return tryDirectPath(inputPath, timeoutMs, signal);
573
+ return tryDirectPath(inputPath, timeoutMs, signal, verbosity);
555
574
  }
556
575
  var DcmdumpFormat = {
557
576
  /** Print standard DCMTK format. */
@@ -559,16 +578,17 @@ var DcmdumpFormat = {
559
578
  /** Print tag and value only. */
560
579
  SHORT: "short"
561
580
  };
581
+ var VERBOSITY_FLAGS3 = { verbose: "-v", debug: "-d" };
562
582
  var DcmdumpOptionsSchema = z.object({
563
583
  timeoutMs: z.number().int().positive().optional(),
564
584
  signal: z.instanceof(AbortSignal).optional(),
565
585
  format: z.enum(["standard", "short"]).optional(),
566
586
  allTags: z.boolean().optional(),
567
587
  searchTag: z.string().regex(/^\([0-9A-Fa-f]{4},[0-9A-Fa-f]{4}\)$/).optional(),
568
- printValues: z.boolean().optional()
588
+ printValues: z.boolean().optional(),
589
+ verbosity: z.enum(["verbose", "debug"]).optional()
569
590
  }).strict().optional();
570
- function buildArgs2(inputPath, options) {
571
- const args = [];
591
+ function pushDisplayArgs(args, options) {
572
592
  if (options?.format === "short") {
573
593
  args.push("+L");
574
594
  }
@@ -582,6 +602,13 @@ function buildArgs2(inputPath, options) {
582
602
  if (options?.printValues === true) {
583
603
  args.push("+Vr");
584
604
  }
605
+ }
606
+ function buildArgs2(inputPath, options) {
607
+ const args = [];
608
+ if (options?.verbosity !== void 0) {
609
+ args.push(VERBOSITY_FLAGS3[options.verbosity]);
610
+ }
611
+ pushDisplayArgs(args, options);
585
612
  args.push(inputPath);
586
613
  return args;
587
614
  }
@@ -628,7 +655,8 @@ var VALID_TRANSFER_SYNTAXES = ["+ti", "+te", "+tb", "+tl", "+t2", "+tr", "+td"];
628
655
  var DcmconvOptionsSchema = z.object({
629
656
  timeoutMs: z.number().int().positive().optional(),
630
657
  signal: z.instanceof(AbortSignal).optional(),
631
- transferSyntax: z.enum(VALID_TRANSFER_SYNTAXES)
658
+ transferSyntax: z.enum(VALID_TRANSFER_SYNTAXES),
659
+ verbosity: z.enum(["verbose", "debug"]).optional()
632
660
  }).strict();
633
661
  async function dcmconv(inputPath, outputPath, options) {
634
662
  const validation = DcmconvOptionsSchema.safeParse(options);
@@ -639,7 +667,13 @@ async function dcmconv(inputPath, outputPath, options) {
639
667
  if (!binaryResult.ok) {
640
668
  return err(binaryResult.error);
641
669
  }
642
- const args = [options.transferSyntax, inputPath, outputPath];
670
+ const args = [];
671
+ if (options.verbosity === "verbose") {
672
+ args.push("-v");
673
+ } else if (options.verbosity === "debug") {
674
+ args.push("-d");
675
+ }
676
+ args.push(options.transferSyntax, inputPath, outputPath);
643
677
  const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
644
678
  const result = await execCommand(binaryResult.value, args, {
645
679
  timeoutMs,
@@ -658,6 +692,7 @@ var TagModificationSchema = z.object({
658
692
  tag: z.string().regex(TAG_OR_PATH_PATTERN),
659
693
  value: z.string()
660
694
  });
695
+ var VERBOSITY_FLAGS4 = { verbose: "-v", debug: "-d" };
661
696
  var DcmodifyOptionsSchema = z.object({
662
697
  timeoutMs: z.number().int().positive().optional(),
663
698
  signal: z.instanceof(AbortSignal).optional(),
@@ -666,12 +701,16 @@ var DcmodifyOptionsSchema = z.object({
666
701
  erasePrivateTags: z.boolean().optional(),
667
702
  noBackup: z.boolean().optional(),
668
703
  insertIfMissing: z.boolean().optional(),
669
- ignoreMissingTags: z.boolean().optional()
704
+ ignoreMissingTags: z.boolean().optional(),
705
+ verbosity: z.enum(["verbose", "debug"]).optional()
670
706
  }).strict().refine((data) => data.modifications.length > 0 || data.erasures !== void 0 && data.erasures.length > 0 || data.erasePrivateTags === true, {
671
707
  message: "At least one of modifications, erasures, or erasePrivateTags is required"
672
708
  });
673
709
  function buildArgs3(inputPath, options) {
674
710
  const args = [];
711
+ if (options.verbosity !== void 0) {
712
+ args.push(VERBOSITY_FLAGS4[options.verbosity]);
713
+ }
675
714
  if (options.noBackup !== false) {
676
715
  args.push("-nb");
677
716
  }
@@ -719,8 +758,18 @@ async function dcmodify(inputPath, options) {
719
758
  }
720
759
  var DcmftestOptionsSchema = z.object({
721
760
  timeoutMs: z.number().int().positive().optional(),
722
- signal: z.instanceof(AbortSignal).optional()
761
+ signal: z.instanceof(AbortSignal).optional(),
762
+ verbosity: z.enum(["verbose", "debug"]).optional()
723
763
  }).strict().optional();
764
+ var VERBOSITY_FLAGS5 = { verbose: "-v", debug: "-d" };
765
+ function buildArgs4(inputPath, options) {
766
+ const args = [];
767
+ if (options?.verbosity !== void 0) {
768
+ args.push(VERBOSITY_FLAGS5[options.verbosity]);
769
+ }
770
+ args.push(inputPath);
771
+ return args;
772
+ }
724
773
  async function dcmftest(inputPath, options) {
725
774
  const validation = DcmftestOptionsSchema.safeParse(options);
726
775
  if (!validation.success) {
@@ -730,7 +779,7 @@ async function dcmftest(inputPath, options) {
730
779
  if (!binaryResult.ok) {
731
780
  return err(binaryResult.error);
732
781
  }
733
- const args = [inputPath];
782
+ const args = buildArgs4(inputPath, options);
734
783
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
735
784
  const result = await execCommand(binaryResult.value, args, {
736
785
  timeoutMs,
@@ -754,10 +803,16 @@ var DcmgpdirOptionsSchema = z.object({
754
803
  filesetId: z.string().min(1).optional(),
755
804
  inputDirectory: z.string().min(1).optional(),
756
805
  mapFilenames: z.boolean().optional(),
757
- inventAttributes: z.boolean().optional()
806
+ inventAttributes: z.boolean().optional(),
807
+ verbosity: z.enum(["verbose", "debug"]).optional()
758
808
  }).strict();
759
- function buildArgs4(options) {
809
+ function buildArgs5(options) {
760
810
  const args = [];
811
+ if (options.verbosity === "verbose") {
812
+ args.push("-v");
813
+ } else if (options.verbosity === "debug") {
814
+ args.push("-d");
815
+ }
761
816
  if (options.outputFile !== void 0) {
762
817
  args.push("+D", options.outputFile);
763
818
  }
@@ -785,7 +840,7 @@ async function dcmgpdir(options) {
785
840
  if (!binaryResult.ok) {
786
841
  return err(binaryResult.error);
787
842
  }
788
- const args = buildArgs4(options);
843
+ const args = buildArgs5(options);
789
844
  const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
790
845
  const result = await execCommand(binaryResult.value, args, {
791
846
  timeoutMs,
@@ -810,10 +865,16 @@ var DcmmkdirOptionsSchema = z.object({
810
865
  append: z.boolean().optional(),
811
866
  inputDirectory: z.string().min(1).optional(),
812
867
  mapFilenames: z.boolean().optional(),
813
- inventAttributes: z.boolean().optional()
868
+ inventAttributes: z.boolean().optional(),
869
+ verbosity: z.enum(["verbose", "debug"]).optional()
814
870
  }).strict();
815
- function buildArgs5(options) {
871
+ function buildArgs6(options) {
816
872
  const args = [];
873
+ if (options.verbosity === "verbose") {
874
+ args.push("-v");
875
+ } else if (options.verbosity === "debug") {
876
+ args.push("-d");
877
+ }
817
878
  if (options.outputFile !== void 0) {
818
879
  args.push("+D", options.outputFile);
819
880
  }
@@ -844,7 +905,7 @@ async function dcmmkdir(options) {
844
905
  if (!binaryResult.ok) {
845
906
  return err(binaryResult.error);
846
907
  }
847
- const args = buildArgs5(options);
908
+ const args = buildArgs6(options);
848
909
  const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
849
910
  const result = await execCommand(binaryResult.value, args, {
850
911
  timeoutMs,
@@ -865,12 +926,18 @@ var DcmqridxOptionsSchema = z.object({
865
926
  indexDirectory: z.string().min(1),
866
927
  inputFiles: z.array(z.string().min(1)).min(1).optional(),
867
928
  print: z.boolean().optional(),
868
- notNew: z.boolean().optional()
929
+ notNew: z.boolean().optional(),
930
+ verbosity: z.enum(["verbose", "debug"]).optional()
869
931
  }).strict().refine((data) => data.inputFiles !== void 0 && data.inputFiles.length > 0 || data.print === true, {
870
932
  message: "Either inputFiles (non-empty) or print must be specified"
871
933
  });
872
- function buildArgs6(options) {
934
+ function buildArgs7(options) {
873
935
  const args = [];
936
+ if (options.verbosity === "verbose") {
937
+ args.push("-v");
938
+ } else if (options.verbosity === "debug") {
939
+ args.push("-d");
940
+ }
874
941
  if (options.print === true) {
875
942
  args.push("-p");
876
943
  }
@@ -892,7 +959,7 @@ async function dcmqridx(options) {
892
959
  if (!binaryResult.ok) {
893
960
  return err(binaryResult.error);
894
961
  }
895
- const args = buildArgs6(options);
962
+ const args = buildArgs7(options);
896
963
  const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
897
964
  const result = await execCommand(binaryResult.value, args, {
898
965
  timeoutMs,
@@ -912,11 +979,17 @@ async function dcmqridx(options) {
912
979
  var Xml2dcmOptionsSchema = z.object({
913
980
  timeoutMs: z.number().int().positive().optional(),
914
981
  signal: z.instanceof(AbortSignal).optional(),
982
+ verbosity: z.enum(["verbose", "debug"]).optional(),
915
983
  generateNewUIDs: z.boolean().optional(),
916
984
  validateDocument: z.boolean().optional()
917
985
  }).strict().optional();
918
- function buildArgs7(inputPath, outputPath, options) {
986
+ function buildArgs8(inputPath, outputPath, options) {
919
987
  const args = [];
988
+ if (options?.verbosity === "verbose") {
989
+ args.push("-v");
990
+ } else if (options?.verbosity === "debug") {
991
+ args.push("-d");
992
+ }
920
993
  if (options?.generateNewUIDs === true) {
921
994
  args.push("+Ug");
922
995
  }
@@ -935,7 +1008,7 @@ async function xml2dcm(inputPath, outputPath, options) {
935
1008
  if (!binaryResult.ok) {
936
1009
  return err(binaryResult.error);
937
1010
  }
938
- const args = buildArgs7(inputPath, outputPath, options);
1011
+ const args = buildArgs8(inputPath, outputPath, options);
939
1012
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
940
1013
  const result = await execCommand(binaryResult.value, args, {
941
1014
  timeoutMs,
@@ -951,8 +1024,18 @@ async function xml2dcm(inputPath, outputPath, options) {
951
1024
  }
952
1025
  var Json2dcmOptionsSchema = z.object({
953
1026
  timeoutMs: z.number().int().positive().optional(),
954
- signal: z.instanceof(AbortSignal).optional()
1027
+ signal: z.instanceof(AbortSignal).optional(),
1028
+ verbosity: z.enum(["verbose", "debug"]).optional()
955
1029
  }).strict().optional();
1030
+ var VERBOSITY_FLAGS6 = { verbose: "-v", debug: "-d" };
1031
+ function buildArgs9(inputPath, outputPath, options) {
1032
+ const args = [];
1033
+ if (options?.verbosity !== void 0) {
1034
+ args.push(VERBOSITY_FLAGS6[options.verbosity]);
1035
+ }
1036
+ args.push(inputPath, outputPath);
1037
+ return args;
1038
+ }
956
1039
  async function json2dcm(inputPath, outputPath, options) {
957
1040
  const validation = Json2dcmOptionsSchema.safeParse(options);
958
1041
  if (!validation.success) {
@@ -962,7 +1045,7 @@ async function json2dcm(inputPath, outputPath, options) {
962
1045
  if (!binaryResult.ok) {
963
1046
  return err(binaryResult.error);
964
1047
  }
965
- const args = [inputPath, outputPath];
1048
+ const args = buildArgs9(inputPath, outputPath, options);
966
1049
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
967
1050
  const result = await execCommand(binaryResult.value, args, {
968
1051
  timeoutMs,
@@ -979,11 +1062,17 @@ async function json2dcm(inputPath, outputPath, options) {
979
1062
  var Dump2dcmOptionsSchema = z.object({
980
1063
  timeoutMs: z.number().int().positive().optional(),
981
1064
  signal: z.instanceof(AbortSignal).optional(),
1065
+ verbosity: z.enum(["verbose", "debug"]).optional(),
982
1066
  generateNewUIDs: z.boolean().optional(),
983
1067
  writeFileFormat: z.boolean().optional()
984
1068
  }).strict().optional();
985
- function buildArgs8(inputPath, outputPath, options) {
1069
+ function buildArgs10(inputPath, outputPath, options) {
986
1070
  const args = [];
1071
+ if (options?.verbosity === "verbose") {
1072
+ args.push("-v");
1073
+ } else if (options?.verbosity === "debug") {
1074
+ args.push("-d");
1075
+ }
987
1076
  if (options?.generateNewUIDs === true) {
988
1077
  args.push("+Ug");
989
1078
  }
@@ -1002,7 +1091,7 @@ async function dump2dcm(inputPath, outputPath, options) {
1002
1091
  if (!binaryResult.ok) {
1003
1092
  return err(binaryResult.error);
1004
1093
  }
1005
- const args = buildArgs8(inputPath, outputPath, options);
1094
+ const args = buildArgs10(inputPath, outputPath, options);
1006
1095
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1007
1096
  const result = await execCommand(binaryResult.value, args, {
1008
1097
  timeoutMs,
@@ -1025,6 +1114,7 @@ var Img2dcmInputFormat = {
1025
1114
  var Img2dcmOptionsSchema = z.object({
1026
1115
  timeoutMs: z.number().int().positive().optional(),
1027
1116
  signal: z.instanceof(AbortSignal).optional(),
1117
+ verbosity: z.enum(["verbose", "debug"]).optional(),
1028
1118
  inputFormat: z.enum(["jpeg", "bmp"]).optional(),
1029
1119
  datasetFrom: z.string().min(1).optional()
1030
1120
  }).strict().optional();
@@ -1032,8 +1122,13 @@ var FORMAT_FLAG_MAP = {
1032
1122
  jpeg: "JPEG",
1033
1123
  bmp: "BMP"
1034
1124
  };
1035
- function buildArgs9(inputPath, outputPath, options) {
1125
+ function buildArgs11(inputPath, outputPath, options) {
1036
1126
  const args = [];
1127
+ if (options?.verbosity === "verbose") {
1128
+ args.push("-v");
1129
+ } else if (options?.verbosity === "debug") {
1130
+ args.push("-d");
1131
+ }
1037
1132
  if (options?.inputFormat !== void 0) {
1038
1133
  args.push("-i", FORMAT_FLAG_MAP[options.inputFormat]);
1039
1134
  }
@@ -1052,7 +1147,7 @@ async function img2dcm(inputPath, outputPath, options) {
1052
1147
  if (!binaryResult.ok) {
1053
1148
  return err(binaryResult.error);
1054
1149
  }
1055
- const args = buildArgs9(inputPath, outputPath, options);
1150
+ const args = buildArgs11(inputPath, outputPath, options);
1056
1151
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1057
1152
  const result = await execCommand(binaryResult.value, args, {
1058
1153
  timeoutMs,
@@ -1068,8 +1163,18 @@ async function img2dcm(inputPath, outputPath, options) {
1068
1163
  }
1069
1164
  var Pdf2dcmOptionsSchema = z.object({
1070
1165
  timeoutMs: z.number().int().positive().optional(),
1071
- signal: z.instanceof(AbortSignal).optional()
1166
+ signal: z.instanceof(AbortSignal).optional(),
1167
+ verbosity: z.enum(["verbose", "debug"]).optional()
1072
1168
  }).strict().optional();
1169
+ var VERBOSITY_FLAGS7 = { verbose: "-v", debug: "-d" };
1170
+ function buildArgs12(inputPath, outputPath, options) {
1171
+ const args = [];
1172
+ if (options?.verbosity !== void 0) {
1173
+ args.push(VERBOSITY_FLAGS7[options.verbosity]);
1174
+ }
1175
+ args.push(inputPath, outputPath);
1176
+ return args;
1177
+ }
1073
1178
  async function pdf2dcm(inputPath, outputPath, options) {
1074
1179
  const validation = Pdf2dcmOptionsSchema.safeParse(options);
1075
1180
  if (!validation.success) {
@@ -1079,7 +1184,7 @@ async function pdf2dcm(inputPath, outputPath, options) {
1079
1184
  if (!binaryResult.ok) {
1080
1185
  return err(binaryResult.error);
1081
1186
  }
1082
- const args = [inputPath, outputPath];
1187
+ const args = buildArgs12(inputPath, outputPath, options);
1083
1188
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1084
1189
  const result = await execCommand(binaryResult.value, args, {
1085
1190
  timeoutMs,
@@ -1095,8 +1200,18 @@ async function pdf2dcm(inputPath, outputPath, options) {
1095
1200
  }
1096
1201
  var Dcm2pdfOptionsSchema = z.object({
1097
1202
  timeoutMs: z.number().int().positive().optional(),
1098
- signal: z.instanceof(AbortSignal).optional()
1203
+ signal: z.instanceof(AbortSignal).optional(),
1204
+ verbosity: z.enum(["verbose", "debug"]).optional()
1099
1205
  }).strict().optional();
1206
+ var VERBOSITY_FLAGS8 = { verbose: "-v", debug: "-d" };
1207
+ function buildArgs13(inputPath, outputPath, options) {
1208
+ const args = [];
1209
+ if (options?.verbosity !== void 0) {
1210
+ args.push(VERBOSITY_FLAGS8[options.verbosity]);
1211
+ }
1212
+ args.push(inputPath, outputPath);
1213
+ return args;
1214
+ }
1100
1215
  async function dcm2pdf(inputPath, outputPath, options) {
1101
1216
  const validation = Dcm2pdfOptionsSchema.safeParse(options);
1102
1217
  if (!validation.success) {
@@ -1106,7 +1221,7 @@ async function dcm2pdf(inputPath, outputPath, options) {
1106
1221
  if (!binaryResult.ok) {
1107
1222
  return err(binaryResult.error);
1108
1223
  }
1109
- const args = [inputPath, outputPath];
1224
+ const args = buildArgs13(inputPath, outputPath, options);
1110
1225
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1111
1226
  const result = await execCommand(binaryResult.value, args, {
1112
1227
  timeoutMs,
@@ -1122,8 +1237,18 @@ async function dcm2pdf(inputPath, outputPath, options) {
1122
1237
  }
1123
1238
  var Cda2dcmOptionsSchema = z.object({
1124
1239
  timeoutMs: z.number().int().positive().optional(),
1125
- signal: z.instanceof(AbortSignal).optional()
1240
+ signal: z.instanceof(AbortSignal).optional(),
1241
+ verbosity: z.enum(["verbose", "debug"]).optional()
1126
1242
  }).strict().optional();
1243
+ var VERBOSITY_FLAGS9 = { verbose: "-v", debug: "-d" };
1244
+ function buildArgs14(inputPath, outputPath, options) {
1245
+ const args = [];
1246
+ if (options?.verbosity !== void 0) {
1247
+ args.push(VERBOSITY_FLAGS9[options.verbosity]);
1248
+ }
1249
+ args.push(inputPath, outputPath);
1250
+ return args;
1251
+ }
1127
1252
  async function cda2dcm(inputPath, outputPath, options) {
1128
1253
  const validation = Cda2dcmOptionsSchema.safeParse(options);
1129
1254
  if (!validation.success) {
@@ -1133,7 +1258,7 @@ async function cda2dcm(inputPath, outputPath, options) {
1133
1258
  if (!binaryResult.ok) {
1134
1259
  return err(binaryResult.error);
1135
1260
  }
1136
- const args = [inputPath, outputPath];
1261
+ const args = buildArgs14(inputPath, outputPath, options);
1137
1262
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1138
1263
  const result = await execCommand(binaryResult.value, args, {
1139
1264
  timeoutMs,
@@ -1149,8 +1274,18 @@ async function cda2dcm(inputPath, outputPath, options) {
1149
1274
  }
1150
1275
  var Dcm2cdaOptionsSchema = z.object({
1151
1276
  timeoutMs: z.number().int().positive().optional(),
1152
- signal: z.instanceof(AbortSignal).optional()
1277
+ signal: z.instanceof(AbortSignal).optional(),
1278
+ verbosity: z.enum(["verbose", "debug"]).optional()
1153
1279
  }).strict().optional();
1280
+ var VERBOSITY_FLAGS10 = { verbose: "-v", debug: "-d" };
1281
+ function buildArgs15(inputPath, outputPath, options) {
1282
+ const args = [];
1283
+ if (options?.verbosity !== void 0) {
1284
+ args.push(VERBOSITY_FLAGS10[options.verbosity]);
1285
+ }
1286
+ args.push(inputPath, outputPath);
1287
+ return args;
1288
+ }
1154
1289
  async function dcm2cda(inputPath, outputPath, options) {
1155
1290
  const validation = Dcm2cdaOptionsSchema.safeParse(options);
1156
1291
  if (!validation.success) {
@@ -1160,7 +1295,7 @@ async function dcm2cda(inputPath, outputPath, options) {
1160
1295
  if (!binaryResult.ok) {
1161
1296
  return err(binaryResult.error);
1162
1297
  }
1163
- const args = [inputPath, outputPath];
1298
+ const args = buildArgs15(inputPath, outputPath, options);
1164
1299
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1165
1300
  const result = await execCommand(binaryResult.value, args, {
1166
1301
  timeoutMs,
@@ -1176,8 +1311,18 @@ async function dcm2cda(inputPath, outputPath, options) {
1176
1311
  }
1177
1312
  var Stl2dcmOptionsSchema = z.object({
1178
1313
  timeoutMs: z.number().int().positive().optional(),
1179
- signal: z.instanceof(AbortSignal).optional()
1314
+ signal: z.instanceof(AbortSignal).optional(),
1315
+ verbosity: z.enum(["verbose", "debug"]).optional()
1180
1316
  }).strict().optional();
1317
+ var VERBOSITY_FLAGS11 = { verbose: "-v", debug: "-d" };
1318
+ function buildArgs16(inputPath, outputPath, options) {
1319
+ const args = [];
1320
+ if (options?.verbosity !== void 0) {
1321
+ args.push(VERBOSITY_FLAGS11[options.verbosity]);
1322
+ }
1323
+ args.push(inputPath, outputPath);
1324
+ return args;
1325
+ }
1181
1326
  async function stl2dcm(inputPath, outputPath, options) {
1182
1327
  const validation = Stl2dcmOptionsSchema.safeParse(options);
1183
1328
  if (!validation.success) {
@@ -1187,7 +1332,7 @@ async function stl2dcm(inputPath, outputPath, options) {
1187
1332
  if (!binaryResult.ok) {
1188
1333
  return err(binaryResult.error);
1189
1334
  }
1190
- const args = [inputPath, outputPath];
1335
+ const args = buildArgs16(inputPath, outputPath, options);
1191
1336
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1192
1337
  const result = await execCommand(binaryResult.value, args, {
1193
1338
  timeoutMs,
@@ -1204,10 +1349,16 @@ async function stl2dcm(inputPath, outputPath, options) {
1204
1349
  var DcmcrleOptionsSchema = z.object({
1205
1350
  timeoutMs: z.number().int().positive().optional(),
1206
1351
  signal: z.instanceof(AbortSignal).optional(),
1207
- uidAlways: z.boolean().optional()
1352
+ uidAlways: z.boolean().optional(),
1353
+ verbosity: z.enum(["verbose", "debug"]).optional()
1208
1354
  }).strict().optional();
1209
- function buildArgs10(inputPath, outputPath, options) {
1355
+ function buildArgs17(inputPath, outputPath, options) {
1210
1356
  const args = [];
1357
+ if (options?.verbosity === "verbose") {
1358
+ args.push("-v");
1359
+ } else if (options?.verbosity === "debug") {
1360
+ args.push("-d");
1361
+ }
1211
1362
  if (options?.uidAlways === true) {
1212
1363
  args.push("+ua");
1213
1364
  }
@@ -1223,7 +1374,7 @@ async function dcmcrle(inputPath, outputPath, options) {
1223
1374
  if (!binaryResult.ok) {
1224
1375
  return err(binaryResult.error);
1225
1376
  }
1226
- const args = buildArgs10(inputPath, outputPath, options);
1377
+ const args = buildArgs17(inputPath, outputPath, options);
1227
1378
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1228
1379
  const result = await execCommand(binaryResult.value, args, {
1229
1380
  timeoutMs,
@@ -1240,10 +1391,16 @@ async function dcmcrle(inputPath, outputPath, options) {
1240
1391
  var DcmdrleOptionsSchema = z.object({
1241
1392
  timeoutMs: z.number().int().positive().optional(),
1242
1393
  signal: z.instanceof(AbortSignal).optional(),
1243
- uidAlways: z.boolean().optional()
1394
+ uidAlways: z.boolean().optional(),
1395
+ verbosity: z.enum(["verbose", "debug"]).optional()
1244
1396
  }).strict().optional();
1245
- function buildArgs11(inputPath, outputPath, options) {
1397
+ function buildArgs18(inputPath, outputPath, options) {
1246
1398
  const args = [];
1399
+ if (options?.verbosity === "verbose") {
1400
+ args.push("-v");
1401
+ } else if (options?.verbosity === "debug") {
1402
+ args.push("-d");
1403
+ }
1247
1404
  if (options?.uidAlways === true) {
1248
1405
  args.push("+ua");
1249
1406
  }
@@ -1259,7 +1416,7 @@ async function dcmdrle(inputPath, outputPath, options) {
1259
1416
  if (!binaryResult.ok) {
1260
1417
  return err(binaryResult.error);
1261
1418
  }
1262
- const args = buildArgs11(inputPath, outputPath, options);
1419
+ const args = buildArgs18(inputPath, outputPath, options);
1263
1420
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1264
1421
  const result = await execCommand(binaryResult.value, args, {
1265
1422
  timeoutMs,
@@ -1276,10 +1433,16 @@ async function dcmdrle(inputPath, outputPath, options) {
1276
1433
  var DcmencapOptionsSchema = z.object({
1277
1434
  timeoutMs: z.number().int().positive().optional(),
1278
1435
  signal: z.instanceof(AbortSignal).optional(),
1279
- documentTitle: z.string().optional()
1436
+ documentTitle: z.string().optional(),
1437
+ verbosity: z.enum(["verbose", "debug"]).optional()
1280
1438
  }).strict().optional();
1281
- function buildArgs12(inputPath, outputPath, options) {
1439
+ function buildArgs19(inputPath, outputPath, options) {
1282
1440
  const args = [];
1441
+ if (options?.verbosity === "verbose") {
1442
+ args.push("-v");
1443
+ } else if (options?.verbosity === "debug") {
1444
+ args.push("-d");
1445
+ }
1283
1446
  if (options?.documentTitle !== void 0) {
1284
1447
  args.push("--title", options.documentTitle);
1285
1448
  }
@@ -1295,7 +1458,7 @@ async function dcmencap(inputPath, outputPath, options) {
1295
1458
  if (!binaryResult.ok) {
1296
1459
  return err(binaryResult.error);
1297
1460
  }
1298
- const args = buildArgs12(inputPath, outputPath, options);
1461
+ const args = buildArgs19(inputPath, outputPath, options);
1299
1462
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1300
1463
  const result = await execCommand(binaryResult.value, args, {
1301
1464
  timeoutMs,
@@ -1311,8 +1474,19 @@ async function dcmencap(inputPath, outputPath, options) {
1311
1474
  }
1312
1475
  var DcmdecapOptionsSchema = z.object({
1313
1476
  timeoutMs: z.number().int().positive().optional(),
1314
- signal: z.instanceof(AbortSignal).optional()
1477
+ signal: z.instanceof(AbortSignal).optional(),
1478
+ verbosity: z.enum(["verbose", "debug"]).optional()
1315
1479
  }).strict().optional();
1480
+ function buildArgs20(inputPath, outputPath, options) {
1481
+ const args = [];
1482
+ if (options?.verbosity === "verbose") {
1483
+ args.push("-v");
1484
+ } else if (options?.verbosity === "debug") {
1485
+ args.push("-d");
1486
+ }
1487
+ args.push(inputPath, outputPath);
1488
+ return args;
1489
+ }
1316
1490
  async function dcmdecap(inputPath, outputPath, options) {
1317
1491
  const validation = DcmdecapOptionsSchema.safeParse(options);
1318
1492
  if (!validation.success) {
@@ -1322,7 +1496,7 @@ async function dcmdecap(inputPath, outputPath, options) {
1322
1496
  if (!binaryResult.ok) {
1323
1497
  return err(binaryResult.error);
1324
1498
  }
1325
- const args = [inputPath, outputPath];
1499
+ const args = buildArgs20(inputPath, outputPath, options);
1326
1500
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1327
1501
  const result = await execCommand(binaryResult.value, args, {
1328
1502
  timeoutMs,
@@ -1340,10 +1514,19 @@ var DcmcjpegOptionsSchema = z.object({
1340
1514
  timeoutMs: z.number().int().positive().optional(),
1341
1515
  signal: z.instanceof(AbortSignal).optional(),
1342
1516
  quality: z.number().int().min(1).max(100).optional(),
1343
- lossless: z.boolean().optional()
1517
+ lossless: z.boolean().optional(),
1518
+ progressive: z.boolean().optional(),
1519
+ verbosity: z.enum(["verbose", "debug"]).optional()
1344
1520
  }).strict().optional();
1345
- function buildArgs13(inputPath, outputPath, options) {
1521
+ var VERBOSITY_FLAGS12 = { verbose: "-v", debug: "-d" };
1522
+ function buildArgs21(inputPath, outputPath, options) {
1346
1523
  const args = [];
1524
+ if (options?.verbosity !== void 0) {
1525
+ args.push(VERBOSITY_FLAGS12[options.verbosity]);
1526
+ }
1527
+ if (options?.progressive === true) {
1528
+ args.push("+p");
1529
+ }
1347
1530
  if (options?.lossless === true) {
1348
1531
  args.push("+e1");
1349
1532
  }
@@ -1362,7 +1545,7 @@ async function dcmcjpeg(inputPath, outputPath, options) {
1362
1545
  if (!binaryResult.ok) {
1363
1546
  return err(binaryResult.error);
1364
1547
  }
1365
- const args = buildArgs13(inputPath, outputPath, options);
1548
+ const args = buildArgs21(inputPath, outputPath, options);
1366
1549
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1367
1550
  const result = await execCommand(binaryResult.value, args, {
1368
1551
  timeoutMs,
@@ -1392,10 +1575,16 @@ var COLOR_CONVERSION_FLAGS = {
1392
1575
  var DcmdjpegOptionsSchema = z.object({
1393
1576
  timeoutMs: z.number().int().positive().optional(),
1394
1577
  signal: z.instanceof(AbortSignal).optional(),
1395
- colorConversion: z.enum(["photometric", "always", "never"]).optional()
1578
+ colorConversion: z.enum(["photometric", "always", "never"]).optional(),
1579
+ verbosity: z.enum(["verbose", "debug"]).optional()
1396
1580
  }).strict().optional();
1397
- function buildArgs14(inputPath, outputPath, options) {
1581
+ function buildArgs22(inputPath, outputPath, options) {
1398
1582
  const args = [];
1583
+ if (options?.verbosity === "verbose") {
1584
+ args.push("-v");
1585
+ } else if (options?.verbosity === "debug") {
1586
+ args.push("-d");
1587
+ }
1399
1588
  if (options?.colorConversion !== void 0) {
1400
1589
  args.push(COLOR_CONVERSION_FLAGS[options.colorConversion]);
1401
1590
  }
@@ -1411,7 +1600,7 @@ async function dcmdjpeg(inputPath, outputPath, options) {
1411
1600
  if (!binaryResult.ok) {
1412
1601
  return err(binaryResult.error);
1413
1602
  }
1414
- const args = buildArgs14(inputPath, outputPath, options);
1603
+ const args = buildArgs22(inputPath, outputPath, options);
1415
1604
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1416
1605
  const result = await execCommand(binaryResult.value, args, {
1417
1606
  timeoutMs,
@@ -1429,10 +1618,15 @@ var DcmcjplsOptionsSchema = z.object({
1429
1618
  timeoutMs: z.number().int().positive().optional(),
1430
1619
  signal: z.instanceof(AbortSignal).optional(),
1431
1620
  lossless: z.boolean().optional(),
1432
- maxDeviation: z.number().int().min(0).optional()
1621
+ maxDeviation: z.number().int().min(0).optional(),
1622
+ verbosity: z.enum(["verbose", "debug"]).optional()
1433
1623
  }).strict().optional();
1434
- function buildArgs15(inputPath, outputPath, options) {
1624
+ var VERBOSITY_FLAGS13 = { verbose: "-v", debug: "-d" };
1625
+ function buildArgs23(inputPath, outputPath, options) {
1435
1626
  const args = [];
1627
+ if (options?.verbosity !== void 0) {
1628
+ args.push(VERBOSITY_FLAGS13[options.verbosity]);
1629
+ }
1436
1630
  if (options?.lossless === false) {
1437
1631
  args.push("+en");
1438
1632
  } else if (options?.lossless === true) {
@@ -1453,7 +1647,7 @@ async function dcmcjpls(inputPath, outputPath, options) {
1453
1647
  if (!binaryResult.ok) {
1454
1648
  return err(binaryResult.error);
1455
1649
  }
1456
- const args = buildArgs15(inputPath, outputPath, options);
1650
+ const args = buildArgs23(inputPath, outputPath, options);
1457
1651
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1458
1652
  const result = await execCommand(binaryResult.value, args, {
1459
1653
  timeoutMs,
@@ -1483,10 +1677,16 @@ var JPLS_COLOR_CONVERSION_FLAGS = {
1483
1677
  var DcmdjplsOptionsSchema = z.object({
1484
1678
  timeoutMs: z.number().int().positive().optional(),
1485
1679
  signal: z.instanceof(AbortSignal).optional(),
1486
- colorConversion: z.enum(["photometric", "always", "never"]).optional()
1680
+ colorConversion: z.enum(["photometric", "always", "never"]).optional(),
1681
+ verbosity: z.enum(["verbose", "debug"]).optional()
1487
1682
  }).strict().optional();
1488
- function buildArgs16(inputPath, outputPath, options) {
1683
+ function buildArgs24(inputPath, outputPath, options) {
1489
1684
  const args = [];
1685
+ if (options?.verbosity === "verbose") {
1686
+ args.push("-v");
1687
+ } else if (options?.verbosity === "debug") {
1688
+ args.push("-d");
1689
+ }
1490
1690
  if (options?.colorConversion !== void 0) {
1491
1691
  args.push(JPLS_COLOR_CONVERSION_FLAGS[options.colorConversion]);
1492
1692
  }
@@ -1502,7 +1702,7 @@ async function dcmdjpls(inputPath, outputPath, options) {
1502
1702
  if (!binaryResult.ok) {
1503
1703
  return err(binaryResult.error);
1504
1704
  }
1505
- const args = buildArgs16(inputPath, outputPath, options);
1705
+ const args = buildArgs24(inputPath, outputPath, options);
1506
1706
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1507
1707
  const result = await execCommand(binaryResult.value, args, {
1508
1708
  timeoutMs,
@@ -1521,6 +1721,8 @@ var Dcmj2pnmOutputFormat = {
1521
1721
  PNM: "pnm",
1522
1722
  /** PNG format. */
1523
1723
  PNG: "png",
1724
+ /** 16-bit PNG format. */
1725
+ PNG_16BIT: "png16",
1524
1726
  /** BMP format. */
1525
1727
  BMP: "bmp",
1526
1728
  /** TIFF format. */
@@ -1531,6 +1733,7 @@ var Dcmj2pnmOutputFormat = {
1531
1733
  var OUTPUT_FORMAT_FLAGS = {
1532
1734
  pnm: "+op",
1533
1735
  png: "+on",
1736
+ png16: "+on2",
1534
1737
  bmp: "+ob",
1535
1738
  tiff: "+ot",
1536
1739
  jpeg: "+oj"
@@ -1538,17 +1741,32 @@ var OUTPUT_FORMAT_FLAGS = {
1538
1741
  var Dcmj2pnmOptionsSchema = z.object({
1539
1742
  timeoutMs: z.number().int().positive().optional(),
1540
1743
  signal: z.instanceof(AbortSignal).optional(),
1541
- outputFormat: z.enum(["pnm", "png", "bmp", "tiff", "jpeg"]).optional(),
1542
- frame: z.number().int().min(0).max(65535).optional()
1543
- }).strict().optional();
1544
- function buildArgs17(inputPath, outputPath, options) {
1744
+ outputFormat: z.enum(["pnm", "png", "png16", "bmp", "tiff", "jpeg"]).optional(),
1745
+ frame: z.number().int().min(0).max(65535).optional(),
1746
+ windowCenter: z.number().optional(),
1747
+ windowWidth: z.number().optional(),
1748
+ verbosity: z.enum(["verbose", "debug"]).optional()
1749
+ }).strict().refine((data) => data?.windowCenter === void 0 === (data?.windowWidth === void 0), {
1750
+ message: "windowCenter and windowWidth must be provided together"
1751
+ }).optional();
1752
+ var VERBOSITY_FLAGS14 = { verbose: "-v", debug: "-d" };
1753
+ function pushWindowArgs(args, options) {
1754
+ if (options?.windowCenter !== void 0 && options?.windowWidth !== void 0) {
1755
+ args.push("+Wl", String(options.windowCenter), String(options.windowWidth));
1756
+ }
1757
+ }
1758
+ function buildArgs25(inputPath, outputPath, options) {
1545
1759
  const args = [];
1760
+ if (options?.verbosity !== void 0) {
1761
+ args.push(VERBOSITY_FLAGS14[options.verbosity]);
1762
+ }
1546
1763
  if (options?.outputFormat !== void 0) {
1547
1764
  args.push(OUTPUT_FORMAT_FLAGS[options.outputFormat]);
1548
1765
  }
1549
1766
  if (options?.frame !== void 0) {
1550
1767
  args.push("+F", String(options.frame));
1551
1768
  }
1769
+ pushWindowArgs(args, options);
1552
1770
  args.push(inputPath, outputPath);
1553
1771
  return args;
1554
1772
  }
@@ -1557,11 +1775,12 @@ async function dcmj2pnm(inputPath, outputPath, options) {
1557
1775
  if (!validation.success) {
1558
1776
  return err(createValidationError("dcmj2pnm", validation.error));
1559
1777
  }
1560
- const binaryResult = resolveBinary("dcmj2pnm");
1778
+ const dcm2imgResult = resolveBinary("dcm2img");
1779
+ const binaryResult = dcm2imgResult.ok ? dcm2imgResult : resolveBinary("dcmj2pnm");
1561
1780
  if (!binaryResult.ok) {
1562
1781
  return err(binaryResult.error);
1563
1782
  }
1564
- const args = buildArgs17(inputPath, outputPath, options);
1783
+ const args = buildArgs25(inputPath, outputPath, options);
1565
1784
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1566
1785
  const result = await execCommand(binaryResult.value, args, {
1567
1786
  timeoutMs,
@@ -1580,6 +1799,8 @@ var Dcm2pnmOutputFormat = {
1580
1799
  PNM: "pnm",
1581
1800
  /** PNG format. */
1582
1801
  PNG: "png",
1802
+ /** 16-bit PNG format. */
1803
+ PNG_16BIT: "png16",
1583
1804
  /** BMP format. */
1584
1805
  BMP: "bmp",
1585
1806
  /** TIFF format. */
@@ -1588,23 +1809,39 @@ var Dcm2pnmOutputFormat = {
1588
1809
  var DCM2PNM_FORMAT_FLAGS = {
1589
1810
  pnm: "+op",
1590
1811
  png: "+on",
1812
+ png16: "+on2",
1591
1813
  bmp: "+ob",
1592
1814
  tiff: "+ot"
1593
1815
  };
1594
1816
  var Dcm2pnmOptionsSchema = z.object({
1595
1817
  timeoutMs: z.number().int().positive().optional(),
1596
1818
  signal: z.instanceof(AbortSignal).optional(),
1597
- outputFormat: z.enum(["pnm", "png", "bmp", "tiff"]).optional(),
1598
- frame: z.number().int().min(0).max(65535).optional()
1599
- }).strict().optional();
1600
- function buildArgs18(inputPath, outputPath, options) {
1819
+ outputFormat: z.enum(["pnm", "png", "png16", "bmp", "tiff"]).optional(),
1820
+ frame: z.number().int().min(0).max(65535).optional(),
1821
+ windowCenter: z.number().optional(),
1822
+ windowWidth: z.number().optional(),
1823
+ verbosity: z.enum(["verbose", "debug"]).optional()
1824
+ }).strict().refine((data) => data?.windowCenter === void 0 === (data?.windowWidth === void 0), {
1825
+ message: "windowCenter and windowWidth must be provided together"
1826
+ }).optional();
1827
+ var VERBOSITY_FLAGS15 = { verbose: "-v", debug: "-d" };
1828
+ function pushWindowArgs2(args, options) {
1829
+ if (options?.windowCenter !== void 0 && options?.windowWidth !== void 0) {
1830
+ args.push("+Wl", String(options.windowCenter), String(options.windowWidth));
1831
+ }
1832
+ }
1833
+ function buildArgs26(inputPath, outputPath, options) {
1601
1834
  const args = [];
1835
+ if (options?.verbosity !== void 0) {
1836
+ args.push(VERBOSITY_FLAGS15[options.verbosity]);
1837
+ }
1602
1838
  if (options?.outputFormat !== void 0) {
1603
1839
  args.push(DCM2PNM_FORMAT_FLAGS[options.outputFormat]);
1604
1840
  }
1605
1841
  if (options?.frame !== void 0) {
1606
1842
  args.push("+F", String(options.frame));
1607
1843
  }
1844
+ pushWindowArgs2(args, options);
1608
1845
  args.push(inputPath, outputPath);
1609
1846
  return args;
1610
1847
  }
@@ -1613,11 +1850,12 @@ async function dcm2pnm(inputPath, outputPath, options) {
1613
1850
  if (!validation.success) {
1614
1851
  return err(createValidationError("dcm2pnm", validation.error));
1615
1852
  }
1616
- const binaryResult = resolveBinary("dcm2pnm");
1853
+ const dcm2imgResult = resolveBinary("dcm2img");
1854
+ const binaryResult = dcm2imgResult.ok ? dcm2imgResult : resolveBinary("dcm2pnm");
1617
1855
  if (!binaryResult.ok) {
1618
1856
  return err(binaryResult.error);
1619
1857
  }
1620
- const args = buildArgs18(inputPath, outputPath, options);
1858
+ const args = buildArgs26(inputPath, outputPath, options);
1621
1859
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1622
1860
  const result = await execCommand(binaryResult.value, args, {
1623
1861
  timeoutMs,
@@ -1637,10 +1875,11 @@ var DcmscaleOptionsSchema = z.object({
1637
1875
  xFactor: z.number().positive().max(100).optional(),
1638
1876
  yFactor: z.number().positive().max(100).optional(),
1639
1877
  xSize: z.number().int().positive().optional(),
1640
- ySize: z.number().int().positive().optional()
1878
+ ySize: z.number().int().positive().optional(),
1879
+ verbosity: z.enum(["verbose", "debug"]).optional()
1641
1880
  }).strict().optional();
1642
- function buildArgs19(inputPath, outputPath, options) {
1643
- const args = [];
1881
+ var VERBOSITY_FLAGS16 = { verbose: "-v", debug: "-d" };
1882
+ function pushScalingArgs(args, options) {
1644
1883
  if (options?.xFactor !== void 0) {
1645
1884
  args.push("+Sxf", String(options.xFactor));
1646
1885
  }
@@ -1653,6 +1892,13 @@ function buildArgs19(inputPath, outputPath, options) {
1653
1892
  if (options?.ySize !== void 0) {
1654
1893
  args.push("+Syv", String(options.ySize));
1655
1894
  }
1895
+ }
1896
+ function buildArgs27(inputPath, outputPath, options) {
1897
+ const args = [];
1898
+ if (options?.verbosity !== void 0) {
1899
+ args.push(VERBOSITY_FLAGS16[options.verbosity]);
1900
+ }
1901
+ pushScalingArgs(args, options);
1656
1902
  args.push(inputPath, outputPath);
1657
1903
  return args;
1658
1904
  }
@@ -1665,7 +1911,7 @@ async function dcmscale(inputPath, outputPath, options) {
1665
1911
  if (!binaryResult.ok) {
1666
1912
  return err(binaryResult.error);
1667
1913
  }
1668
- const args = buildArgs19(inputPath, outputPath, options);
1914
+ const args = buildArgs27(inputPath, outputPath, options);
1669
1915
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1670
1916
  const result = await execCommand(binaryResult.value, args, {
1671
1917
  timeoutMs,
@@ -1683,10 +1929,16 @@ var DcmquantOptionsSchema = z.object({
1683
1929
  timeoutMs: z.number().int().positive().optional(),
1684
1930
  signal: z.instanceof(AbortSignal).optional(),
1685
1931
  colors: z.number().int().min(2).max(65536).optional(),
1686
- frame: z.number().int().min(0).max(65535).optional()
1932
+ frame: z.number().int().min(0).max(65535).optional(),
1933
+ verbosity: z.enum(["verbose", "debug"]).optional()
1687
1934
  }).strict().optional();
1688
- function buildArgs20(inputPath, outputPath, options) {
1935
+ function buildArgs28(inputPath, outputPath, options) {
1689
1936
  const args = [];
1937
+ if (options?.verbosity === "verbose") {
1938
+ args.push("-v");
1939
+ } else if (options?.verbosity === "debug") {
1940
+ args.push("-d");
1941
+ }
1690
1942
  if (options?.colors !== void 0) {
1691
1943
  args.push("+pc", String(options.colors));
1692
1944
  }
@@ -1705,7 +1957,7 @@ async function dcmquant(inputPath, outputPath, options) {
1705
1957
  if (!binaryResult.ok) {
1706
1958
  return err(binaryResult.error);
1707
1959
  }
1708
- const args = buildArgs20(inputPath, outputPath, options);
1960
+ const args = buildArgs28(inputPath, outputPath, options);
1709
1961
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1710
1962
  const result = await execCommand(binaryResult.value, args, {
1711
1963
  timeoutMs,
@@ -1725,10 +1977,11 @@ var DcmdspfnOptionsSchema = z.object({
1725
1977
  monitorFile: z.string().min(1).optional(),
1726
1978
  cameraFile: z.string().min(1).optional(),
1727
1979
  printerFile: z.string().min(1).optional(),
1728
- ambientLight: z.number().positive().optional()
1980
+ ambientLight: z.number().positive().optional(),
1981
+ verbosity: z.enum(["verbose", "debug"]).optional()
1729
1982
  }).strict().optional();
1730
- function buildArgs21(options) {
1731
- const args = [];
1983
+ var VERBOSITY_FLAGS17 = { verbose: "-v", debug: "-d" };
1984
+ function pushDeviceArgs(args, options) {
1732
1985
  if (options?.monitorFile !== void 0) {
1733
1986
  args.push("+Im", options.monitorFile);
1734
1987
  }
@@ -1741,6 +1994,13 @@ function buildArgs21(options) {
1741
1994
  if (options?.ambientLight !== void 0) {
1742
1995
  args.push("+Ca", String(options.ambientLight));
1743
1996
  }
1997
+ }
1998
+ function buildArgs29(options) {
1999
+ const args = [];
2000
+ if (options?.verbosity !== void 0) {
2001
+ args.push(VERBOSITY_FLAGS17[options.verbosity]);
2002
+ }
2003
+ pushDeviceArgs(args, options);
1744
2004
  return args;
1745
2005
  }
1746
2006
  async function dcmdspfn(options) {
@@ -1752,7 +2012,7 @@ async function dcmdspfn(options) {
1752
2012
  if (!binaryResult.ok) {
1753
2013
  return err(binaryResult.error);
1754
2014
  }
1755
- const args = buildArgs21(options);
2015
+ const args = buildArgs29(options);
1756
2016
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1757
2017
  const result = await execCommand(binaryResult.value, args, {
1758
2018
  timeoutMs,
@@ -1768,8 +2028,19 @@ async function dcmdspfn(options) {
1768
2028
  }
1769
2029
  var Dcod2lumOptionsSchema = z.object({
1770
2030
  timeoutMs: z.number().int().positive().optional(),
1771
- signal: z.instanceof(AbortSignal).optional()
2031
+ signal: z.instanceof(AbortSignal).optional(),
2032
+ verbosity: z.enum(["verbose", "debug"]).optional()
1772
2033
  }).strict().optional();
2034
+ function buildArgs30(inputPath, outputPath, options) {
2035
+ const args = [];
2036
+ if (options?.verbosity === "verbose") {
2037
+ args.push("-v");
2038
+ } else if (options?.verbosity === "debug") {
2039
+ args.push("-d");
2040
+ }
2041
+ args.push(inputPath, outputPath);
2042
+ return args;
2043
+ }
1773
2044
  async function dcod2lum(inputPath, outputPath, options) {
1774
2045
  const validation = Dcod2lumOptionsSchema.safeParse(options);
1775
2046
  if (!validation.success) {
@@ -1779,7 +2050,7 @@ async function dcod2lum(inputPath, outputPath, options) {
1779
2050
  if (!binaryResult.ok) {
1780
2051
  return err(binaryResult.error);
1781
2052
  }
1782
- const args = [inputPath, outputPath];
2053
+ const args = buildArgs30(inputPath, outputPath, options);
1783
2054
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1784
2055
  const result = await execCommand(binaryResult.value, args, {
1785
2056
  timeoutMs,
@@ -1796,10 +2067,16 @@ async function dcod2lum(inputPath, outputPath, options) {
1796
2067
  var DconvlumOptionsSchema = z.object({
1797
2068
  timeoutMs: z.number().int().positive().optional(),
1798
2069
  signal: z.instanceof(AbortSignal).optional(),
1799
- ambientLight: z.number().positive().optional()
2070
+ ambientLight: z.number().positive().optional(),
2071
+ verbosity: z.enum(["verbose", "debug"]).optional()
1800
2072
  }).strict().optional();
1801
- function buildArgs22(inputPath, outputPath, options) {
2073
+ function buildArgs31(inputPath, outputPath, options) {
1802
2074
  const args = [];
2075
+ if (options?.verbosity === "verbose") {
2076
+ args.push("-v");
2077
+ } else if (options?.verbosity === "debug") {
2078
+ args.push("-d");
2079
+ }
1803
2080
  if (options?.ambientLight !== void 0) {
1804
2081
  args.push("+Ca", String(options.ambientLight));
1805
2082
  }
@@ -1815,7 +2092,7 @@ async function dconvlum(inputPath, outputPath, options) {
1815
2092
  if (!binaryResult.ok) {
1816
2093
  return err(binaryResult.error);
1817
2094
  }
1818
- const args = buildArgs22(inputPath, outputPath, options);
2095
+ const args = buildArgs31(inputPath, outputPath, options);
1819
2096
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1820
2097
  const result = await execCommand(binaryResult.value, args, {
1821
2098
  timeoutMs,
@@ -1835,10 +2112,42 @@ var EchoscuOptionsSchema = z.object({
1835
2112
  host: z.string().min(1),
1836
2113
  port: z.number().int().min(1).max(65535),
1837
2114
  callingAETitle: z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
1838
- calledAETitle: z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional()
2115
+ calledAETitle: z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
2116
+ verbosity: z.enum(["verbose", "debug"]).optional(),
2117
+ maxPduReceive: z.number().int().min(4096).max(131072).optional(),
2118
+ maxPduSend: z.number().int().min(4096).max(131072).optional(),
2119
+ associationTimeout: z.number().int().positive().optional(),
2120
+ acseTimeout: z.number().int().positive().optional(),
2121
+ dimseTimeout: z.number().int().positive().optional(),
2122
+ noHostnameLookup: z.boolean().optional()
1839
2123
  }).strict();
1840
- function buildArgs23(options) {
2124
+ var VERBOSITY_FLAGS18 = { verbose: "-v", debug: "-d" };
2125
+ function pushNetworkArgs(args, options) {
2126
+ if (options.verbosity !== void 0) {
2127
+ args.push(VERBOSITY_FLAGS18[options.verbosity]);
2128
+ }
2129
+ if (options.maxPduReceive !== void 0) {
2130
+ args.push("--max-pdu", String(options.maxPduReceive));
2131
+ }
2132
+ if (options.maxPduSend !== void 0) {
2133
+ args.push("--max-send-pdu", String(options.maxPduSend));
2134
+ }
2135
+ if (options.associationTimeout !== void 0) {
2136
+ args.push("-to", String(options.associationTimeout));
2137
+ }
2138
+ if (options.acseTimeout !== void 0) {
2139
+ args.push("-ta", String(options.acseTimeout));
2140
+ }
2141
+ if (options.dimseTimeout !== void 0) {
2142
+ args.push("-td", String(options.dimseTimeout));
2143
+ }
2144
+ if (options.noHostnameLookup === true) {
2145
+ args.push("-nh");
2146
+ }
2147
+ }
2148
+ function buildArgs32(options) {
1841
2149
  const args = [];
2150
+ pushNetworkArgs(args, options);
1842
2151
  if (options.callingAETitle !== void 0) {
1843
2152
  args.push("-aet", options.callingAETitle);
1844
2153
  }
@@ -1857,7 +2166,7 @@ async function echoscu(options) {
1857
2166
  if (!binaryResult.ok) {
1858
2167
  return err(binaryResult.error);
1859
2168
  }
1860
- const args = buildArgs23(options);
2169
+ const args = buildArgs32(options);
1861
2170
  const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1862
2171
  const result = await execCommand(binaryResult.value, args, {
1863
2172
  timeoutMs,
@@ -1871,6 +2180,7 @@ async function echoscu(options) {
1871
2180
  }
1872
2181
  return ok({ success: true, stderr: result.value.stderr });
1873
2182
  }
2183
+ var VERBOSITY_FLAGS19 = { verbose: "-v", debug: "-d" };
1874
2184
  var DcmsendOptionsSchema = z.object({
1875
2185
  timeoutMs: z.number().int().positive().optional(),
1876
2186
  signal: z.instanceof(AbortSignal).optional(),
@@ -1879,16 +2189,51 @@ var DcmsendOptionsSchema = z.object({
1879
2189
  files: z.array(z.string().min(1).refine(isSafePath, { message: "path traversal detected in file path" })).min(1),
1880
2190
  callingAETitle: z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
1881
2191
  calledAETitle: z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
1882
- scanDirectory: z.boolean().optional()
2192
+ scanDirectory: z.boolean().optional(),
2193
+ verbosity: z.enum(["verbose", "debug"]).optional(),
2194
+ noUidChecks: z.boolean().optional(),
2195
+ maxPduReceive: z.number().int().min(4096).max(131072).optional(),
2196
+ maxPduSend: z.number().int().min(4096).max(131072).optional(),
2197
+ noHostnameLookup: z.boolean().optional(),
2198
+ associationTimeout: z.number().int().positive().optional(),
2199
+ acseTimeout: z.number().int().positive().optional(),
2200
+ dimseTimeout: z.number().int().positive().optional()
1883
2201
  }).strict();
1884
- function buildArgs24(options) {
1885
- const args = [];
2202
+ function pushNetworkArgs2(args, options) {
1886
2203
  if (options.callingAETitle !== void 0) {
1887
2204
  args.push("-aet", options.callingAETitle);
1888
2205
  }
1889
2206
  if (options.calledAETitle !== void 0) {
1890
2207
  args.push("-aec", options.calledAETitle);
1891
2208
  }
2209
+ if (options.noUidChecks === true) {
2210
+ args.push("--no-uid-checks");
2211
+ }
2212
+ if (options.maxPduReceive !== void 0) {
2213
+ args.push("--max-pdu", String(options.maxPduReceive));
2214
+ }
2215
+ if (options.maxPduSend !== void 0) {
2216
+ args.push("--max-send-pdu", String(options.maxPduSend));
2217
+ }
2218
+ if (options.noHostnameLookup === true) {
2219
+ args.push("-nh");
2220
+ }
2221
+ if (options.associationTimeout !== void 0) {
2222
+ args.push("-to", String(options.associationTimeout));
2223
+ }
2224
+ if (options.acseTimeout !== void 0) {
2225
+ args.push("-ta", String(options.acseTimeout));
2226
+ }
2227
+ if (options.dimseTimeout !== void 0) {
2228
+ args.push("-td", String(options.dimseTimeout));
2229
+ }
2230
+ }
2231
+ function buildArgs33(options) {
2232
+ const args = [];
2233
+ if (options.verbosity !== void 0) {
2234
+ args.push(VERBOSITY_FLAGS19[options.verbosity]);
2235
+ }
2236
+ pushNetworkArgs2(args, options);
1892
2237
  if (options.scanDirectory === true) {
1893
2238
  args.push("--scan-directories");
1894
2239
  }
@@ -1905,7 +2250,7 @@ async function dcmsend(options) {
1905
2250
  if (!binaryResult.ok) {
1906
2251
  return err(binaryResult.error);
1907
2252
  }
1908
- const args = buildArgs24(options);
2253
+ const args = buildArgs33(options);
1909
2254
  const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1910
2255
  const result = await execCommand(binaryResult.value, args, {
1911
2256
  timeoutMs,
@@ -1917,7 +2262,7 @@ async function dcmsend(options) {
1917
2262
  if (result.value.exitCode !== 0) {
1918
2263
  return err(createToolError("dcmsend", args, result.value.exitCode, result.value.stderr));
1919
2264
  }
1920
- return ok({ success: true, stderr: result.value.stderr });
2265
+ return ok({ success: true, stdout: result.value.stdout, stderr: result.value.stderr });
1921
2266
  }
1922
2267
  var ProposedTransferSyntax = {
1923
2268
  UNCOMPRESSED: "uncompressed",
@@ -1955,6 +2300,14 @@ var StorescuOptionsSchema = z.object({
1955
2300
  calledAETitle: z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
1956
2301
  scanDirectories: z.boolean().optional(),
1957
2302
  recurse: z.boolean().optional(),
2303
+ verbosity: z.enum(["verbose", "debug"]).optional(),
2304
+ maxPduReceive: z.number().int().min(4096).max(131072).optional(),
2305
+ maxPduSend: z.number().int().min(4096).max(131072).optional(),
2306
+ associationTimeout: z.number().int().positive().optional(),
2307
+ acseTimeout: z.number().int().positive().optional(),
2308
+ dimseTimeout: z.number().int().positive().optional(),
2309
+ noHostnameLookup: z.boolean().optional(),
2310
+ noUidChecks: z.boolean().optional(),
1958
2311
  proposedTransferSyntax: z.enum([
1959
2312
  "uncompressed",
1960
2313
  "littleEndian",
@@ -1969,8 +2322,36 @@ var StorescuOptionsSchema = z.object({
1969
2322
  "jlsLossy"
1970
2323
  ]).optional()
1971
2324
  }).strict();
1972
- function buildArgs25(options) {
2325
+ var VERBOSITY_FLAGS20 = { verbose: "-v", debug: "-d" };
2326
+ function pushNetworkArgs3(args, options) {
2327
+ if (options.verbosity !== void 0) {
2328
+ args.push(VERBOSITY_FLAGS20[options.verbosity]);
2329
+ }
2330
+ if (options.maxPduReceive !== void 0) {
2331
+ args.push("--max-pdu", String(options.maxPduReceive));
2332
+ }
2333
+ if (options.maxPduSend !== void 0) {
2334
+ args.push("--max-send-pdu", String(options.maxPduSend));
2335
+ }
2336
+ if (options.associationTimeout !== void 0) {
2337
+ args.push("-to", String(options.associationTimeout));
2338
+ }
2339
+ if (options.acseTimeout !== void 0) {
2340
+ args.push("-ta", String(options.acseTimeout));
2341
+ }
2342
+ if (options.dimseTimeout !== void 0) {
2343
+ args.push("-td", String(options.dimseTimeout));
2344
+ }
2345
+ if (options.noHostnameLookup === true) {
2346
+ args.push("-nh");
2347
+ }
2348
+ }
2349
+ function buildArgs34(options) {
1973
2350
  const args = [];
2351
+ pushNetworkArgs3(args, options);
2352
+ if (options.noUidChecks === true) {
2353
+ args.push("--no-uid-checks");
2354
+ }
1974
2355
  if (options.callingAETitle !== void 0) {
1975
2356
  args.push("-aet", options.callingAETitle);
1976
2357
  }
@@ -1999,7 +2380,7 @@ async function storescu(options) {
1999
2380
  if (!binaryResult.ok) {
2000
2381
  return err(binaryResult.error);
2001
2382
  }
2002
- const args = buildArgs25(options);
2383
+ const args = buildArgs34(options);
2003
2384
  const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
2004
2385
  const result = await execCommand(binaryResult.value, args, {
2005
2386
  timeoutMs,
@@ -2033,12 +2414,44 @@ var FindscuOptionsSchema = z.object({
2033
2414
  queryModel: z.enum(["worklist", "patient", "study"]).optional(),
2034
2415
  keys: z.array(z.string().min(1).refine(isValidDicomKey, { message: "invalid DICOM query key format (expected XXXX,XXXX[=value])" })).optional(),
2035
2416
  extract: z.boolean().optional(),
2036
- outputDirectory: z.string().min(1).refine(isSafePath, { message: "path traversal detected in outputDirectory" }).optional()
2417
+ outputDirectory: z.string().min(1).refine(isSafePath, { message: "path traversal detected in outputDirectory" }).optional(),
2418
+ verbosity: z.enum(["verbose", "debug"]).optional(),
2419
+ maxPduReceive: z.number().int().min(4096).max(131072).optional(),
2420
+ maxPduSend: z.number().int().min(4096).max(131072).optional(),
2421
+ associationTimeout: z.number().int().positive().optional(),
2422
+ acseTimeout: z.number().int().positive().optional(),
2423
+ dimseTimeout: z.number().int().positive().optional(),
2424
+ noHostnameLookup: z.boolean().optional()
2037
2425
  }).strict().refine((data) => data.extract !== true || data.outputDirectory !== void 0, {
2038
2426
  message: "outputDirectory is required when extract is true"
2039
2427
  });
2040
- function buildArgs26(options) {
2428
+ var VERBOSITY_FLAGS21 = { verbose: "-v", debug: "-d" };
2429
+ function pushNetworkArgs4(args, options) {
2430
+ if (options.verbosity !== void 0) {
2431
+ args.push(VERBOSITY_FLAGS21[options.verbosity]);
2432
+ }
2433
+ if (options.maxPduReceive !== void 0) {
2434
+ args.push("--max-pdu", String(options.maxPduReceive));
2435
+ }
2436
+ if (options.maxPduSend !== void 0) {
2437
+ args.push("--max-send-pdu", String(options.maxPduSend));
2438
+ }
2439
+ if (options.associationTimeout !== void 0) {
2440
+ args.push("-to", String(options.associationTimeout));
2441
+ }
2442
+ if (options.acseTimeout !== void 0) {
2443
+ args.push("-ta", String(options.acseTimeout));
2444
+ }
2445
+ if (options.dimseTimeout !== void 0) {
2446
+ args.push("-td", String(options.dimseTimeout));
2447
+ }
2448
+ if (options.noHostnameLookup === true) {
2449
+ args.push("-nh");
2450
+ }
2451
+ }
2452
+ function buildArgs35(options) {
2041
2453
  const args = [];
2454
+ pushNetworkArgs4(args, options);
2042
2455
  if (options.callingAETitle !== void 0) {
2043
2456
  args.push("-aet", options.callingAETitle);
2044
2457
  }
@@ -2071,7 +2484,7 @@ async function findscu(options) {
2071
2484
  if (!binaryResult.ok) {
2072
2485
  return err(binaryResult.error);
2073
2486
  }
2074
- const args = buildArgs26(options);
2487
+ const args = buildArgs35(options);
2075
2488
  const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
2076
2489
  const result = await execCommand(binaryResult.value, args, {
2077
2490
  timeoutMs,
@@ -2103,10 +2516,42 @@ var MovescuOptionsSchema = z.object({
2103
2516
  queryModel: z.enum(["patient", "study"]).optional(),
2104
2517
  keys: z.array(z.string().min(1).refine(isValidDicomKey, { message: "invalid DICOM query key format (expected XXXX,XXXX[=value])" })).optional(),
2105
2518
  moveDestination: z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
2106
- outputDirectory: z.string().min(1).refine(isSafePath, { message: "path traversal detected in outputDirectory" }).optional()
2519
+ outputDirectory: z.string().min(1).refine(isSafePath, { message: "path traversal detected in outputDirectory" }).optional(),
2520
+ verbosity: z.enum(["verbose", "debug"]).optional(),
2521
+ maxPduReceive: z.number().int().min(4096).max(131072).optional(),
2522
+ maxPduSend: z.number().int().min(4096).max(131072).optional(),
2523
+ associationTimeout: z.number().int().positive().optional(),
2524
+ acseTimeout: z.number().int().positive().optional(),
2525
+ dimseTimeout: z.number().int().positive().optional(),
2526
+ noHostnameLookup: z.boolean().optional()
2107
2527
  }).strict();
2108
- function buildArgs27(options) {
2528
+ var VERBOSITY_FLAGS22 = { verbose: "-v", debug: "-d" };
2529
+ function pushNetworkArgs5(args, options) {
2530
+ if (options.verbosity !== void 0) {
2531
+ args.push(VERBOSITY_FLAGS22[options.verbosity]);
2532
+ }
2533
+ if (options.maxPduReceive !== void 0) {
2534
+ args.push("--max-pdu", String(options.maxPduReceive));
2535
+ }
2536
+ if (options.maxPduSend !== void 0) {
2537
+ args.push("--max-send-pdu", String(options.maxPduSend));
2538
+ }
2539
+ if (options.associationTimeout !== void 0) {
2540
+ args.push("-to", String(options.associationTimeout));
2541
+ }
2542
+ if (options.acseTimeout !== void 0) {
2543
+ args.push("-ta", String(options.acseTimeout));
2544
+ }
2545
+ if (options.dimseTimeout !== void 0) {
2546
+ args.push("-td", String(options.dimseTimeout));
2547
+ }
2548
+ if (options.noHostnameLookup === true) {
2549
+ args.push("-nh");
2550
+ }
2551
+ }
2552
+ function buildArgs36(options) {
2109
2553
  const args = [];
2554
+ pushNetworkArgs5(args, options);
2110
2555
  if (options.callingAETitle !== void 0) {
2111
2556
  args.push("-aet", options.callingAETitle);
2112
2557
  }
@@ -2139,7 +2584,7 @@ async function movescu(options) {
2139
2584
  if (!binaryResult.ok) {
2140
2585
  return err(binaryResult.error);
2141
2586
  }
2142
- const args = buildArgs27(options);
2587
+ const args = buildArgs36(options);
2143
2588
  const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
2144
2589
  const result = await execCommand(binaryResult.value, args, {
2145
2590
  timeoutMs,
@@ -2170,10 +2615,42 @@ var GetscuOptionsSchema = z.object({
2170
2615
  calledAETitle: z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
2171
2616
  queryModel: z.enum(["patient", "study"]).optional(),
2172
2617
  keys: z.array(z.string().min(1).refine(isValidDicomKey, { message: "invalid DICOM query key format (expected XXXX,XXXX[=value])" })).optional(),
2173
- outputDirectory: z.string().min(1).refine(isSafePath, { message: "path traversal detected in outputDirectory" }).optional()
2618
+ outputDirectory: z.string().min(1).refine(isSafePath, { message: "path traversal detected in outputDirectory" }).optional(),
2619
+ verbosity: z.enum(["verbose", "debug"]).optional(),
2620
+ maxPduReceive: z.number().int().min(4096).max(131072).optional(),
2621
+ maxPduSend: z.number().int().min(4096).max(131072).optional(),
2622
+ associationTimeout: z.number().int().positive().optional(),
2623
+ acseTimeout: z.number().int().positive().optional(),
2624
+ dimseTimeout: z.number().int().positive().optional(),
2625
+ noHostnameLookup: z.boolean().optional()
2174
2626
  }).strict();
2175
- function buildArgs28(options) {
2627
+ var VERBOSITY_FLAGS23 = { verbose: "-v", debug: "-d" };
2628
+ function pushNetworkArgs6(args, options) {
2629
+ if (options.verbosity !== void 0) {
2630
+ args.push(VERBOSITY_FLAGS23[options.verbosity]);
2631
+ }
2632
+ if (options.maxPduReceive !== void 0) {
2633
+ args.push("--max-pdu", String(options.maxPduReceive));
2634
+ }
2635
+ if (options.maxPduSend !== void 0) {
2636
+ args.push("--max-send-pdu", String(options.maxPduSend));
2637
+ }
2638
+ if (options.associationTimeout !== void 0) {
2639
+ args.push("-to", String(options.associationTimeout));
2640
+ }
2641
+ if (options.acseTimeout !== void 0) {
2642
+ args.push("-ta", String(options.acseTimeout));
2643
+ }
2644
+ if (options.dimseTimeout !== void 0) {
2645
+ args.push("-td", String(options.dimseTimeout));
2646
+ }
2647
+ if (options.noHostnameLookup === true) {
2648
+ args.push("-nh");
2649
+ }
2650
+ }
2651
+ function buildArgs37(options) {
2176
2652
  const args = [];
2653
+ pushNetworkArgs6(args, options);
2177
2654
  if (options.callingAETitle !== void 0) {
2178
2655
  args.push("-aet", options.callingAETitle);
2179
2656
  }
@@ -2203,7 +2680,7 @@ async function getscu(options) {
2203
2680
  if (!binaryResult.ok) {
2204
2681
  return err(binaryResult.error);
2205
2682
  }
2206
- const args = buildArgs28(options);
2683
+ const args = buildArgs37(options);
2207
2684
  const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
2208
2685
  const result = await execCommand(binaryResult.value, args, {
2209
2686
  timeoutMs,
@@ -2223,10 +2700,42 @@ var TermscuOptionsSchema = z.object({
2223
2700
  host: z.string().min(1),
2224
2701
  port: z.number().int().min(1).max(65535),
2225
2702
  callingAETitle: z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
2226
- calledAETitle: z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional()
2703
+ calledAETitle: z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
2704
+ verbosity: z.enum(["verbose", "debug"]).optional(),
2705
+ maxPduReceive: z.number().int().min(4096).max(131072).optional(),
2706
+ maxPduSend: z.number().int().min(4096).max(131072).optional(),
2707
+ associationTimeout: z.number().int().positive().optional(),
2708
+ acseTimeout: z.number().int().positive().optional(),
2709
+ dimseTimeout: z.number().int().positive().optional(),
2710
+ noHostnameLookup: z.boolean().optional()
2227
2711
  }).strict();
2228
- function buildArgs29(options) {
2712
+ var VERBOSITY_FLAGS24 = { verbose: "-v", debug: "-d" };
2713
+ function pushNetworkArgs7(args, options) {
2714
+ if (options.verbosity !== void 0) {
2715
+ args.push(VERBOSITY_FLAGS24[options.verbosity]);
2716
+ }
2717
+ if (options.maxPduReceive !== void 0) {
2718
+ args.push("--max-pdu", String(options.maxPduReceive));
2719
+ }
2720
+ if (options.maxPduSend !== void 0) {
2721
+ args.push("--max-send-pdu", String(options.maxPduSend));
2722
+ }
2723
+ if (options.associationTimeout !== void 0) {
2724
+ args.push("-to", String(options.associationTimeout));
2725
+ }
2726
+ if (options.acseTimeout !== void 0) {
2727
+ args.push("-ta", String(options.acseTimeout));
2728
+ }
2729
+ if (options.dimseTimeout !== void 0) {
2730
+ args.push("-td", String(options.dimseTimeout));
2731
+ }
2732
+ if (options.noHostnameLookup === true) {
2733
+ args.push("-nh");
2734
+ }
2735
+ }
2736
+ function buildArgs38(options) {
2229
2737
  const args = [];
2738
+ pushNetworkArgs7(args, options);
2230
2739
  if (options.callingAETitle !== void 0) {
2231
2740
  args.push("-aet", options.callingAETitle);
2232
2741
  }
@@ -2245,7 +2754,7 @@ async function termscu(options) {
2245
2754
  if (!binaryResult.ok) {
2246
2755
  return err(binaryResult.error);
2247
2756
  }
2248
- const args = buildArgs29(options);
2757
+ const args = buildArgs38(options);
2249
2758
  const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
2250
2759
  const result = await execCommand(binaryResult.value, args, {
2251
2760
  timeoutMs,
@@ -2259,15 +2768,17 @@ async function termscu(options) {
2259
2768
  }
2260
2769
  return ok({ success: true, stderr: result.value.stderr });
2261
2770
  }
2771
+ var VERBOSITY_FLAGS25 = { verbose: "-v", debug: "-d" };
2262
2772
  var DsrdumpOptionsSchema = z.object({
2263
2773
  timeoutMs: z.number().int().positive().optional(),
2264
2774
  signal: z.instanceof(AbortSignal).optional(),
2265
2775
  printFilename: z.boolean().optional(),
2266
2776
  printLong: z.boolean().optional(),
2267
- printCodes: z.boolean().optional()
2777
+ printCodes: z.boolean().optional(),
2778
+ charsetAssume: z.string().min(1).optional(),
2779
+ verbosity: z.enum(["verbose", "debug"]).optional()
2268
2780
  }).strict().optional();
2269
- function buildArgs30(inputPath, options) {
2270
- const args = [];
2781
+ function pushDisplayArgs2(args, options) {
2271
2782
  if (options?.printFilename === true) {
2272
2783
  args.push("+Pf");
2273
2784
  }
@@ -2277,6 +2788,16 @@ function buildArgs30(inputPath, options) {
2277
2788
  if (options?.printCodes === true) {
2278
2789
  args.push("+Pc");
2279
2790
  }
2791
+ if (options?.charsetAssume !== void 0) {
2792
+ args.push("+Ca", options.charsetAssume);
2793
+ }
2794
+ }
2795
+ function buildArgs39(inputPath, options) {
2796
+ const args = [];
2797
+ if (options?.verbosity !== void 0) {
2798
+ args.push(VERBOSITY_FLAGS25[options.verbosity]);
2799
+ }
2800
+ pushDisplayArgs2(args, options);
2280
2801
  args.push(inputPath);
2281
2802
  return args;
2282
2803
  }
@@ -2289,7 +2810,7 @@ async function dsrdump(inputPath, options) {
2289
2810
  if (!binaryResult.ok) {
2290
2811
  return err(binaryResult.error);
2291
2812
  }
2292
- const args = buildArgs30(inputPath, options);
2813
+ const args = buildArgs39(inputPath, options);
2293
2814
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
2294
2815
  const result = await execCommand(binaryResult.value, args, {
2295
2816
  timeoutMs,
@@ -2303,20 +2824,29 @@ async function dsrdump(inputPath, options) {
2303
2824
  }
2304
2825
  return ok({ text: result.value.stdout });
2305
2826
  }
2827
+ var VERBOSITY_FLAGS26 = { verbose: "-v", debug: "-d" };
2306
2828
  var Dsr2xmlOptionsSchema = z.object({
2307
2829
  timeoutMs: z.number().int().positive().optional(),
2308
2830
  signal: z.instanceof(AbortSignal).optional(),
2309
2831
  useNamespace: z.boolean().optional(),
2310
- addSchemaRef: z.boolean().optional()
2832
+ addSchemaRef: z.boolean().optional(),
2833
+ charsetAssume: z.string().min(1).optional(),
2834
+ verbosity: z.enum(["verbose", "debug"]).optional()
2311
2835
  }).strict().optional();
2312
- function buildArgs31(inputPath, options) {
2836
+ function buildArgs40(inputPath, options) {
2313
2837
  const args = [];
2838
+ if (options?.verbosity !== void 0) {
2839
+ args.push(VERBOSITY_FLAGS26[options.verbosity]);
2840
+ }
2314
2841
  if (options?.useNamespace === true) {
2315
2842
  args.push("+Xn");
2316
2843
  }
2317
2844
  if (options?.addSchemaRef === true) {
2318
2845
  args.push("+Xs");
2319
2846
  }
2847
+ if (options?.charsetAssume !== void 0) {
2848
+ args.push("+Ca", options.charsetAssume);
2849
+ }
2320
2850
  args.push(inputPath);
2321
2851
  return args;
2322
2852
  }
@@ -2329,7 +2859,7 @@ async function dsr2xml(inputPath, options) {
2329
2859
  if (!binaryResult.ok) {
2330
2860
  return err(binaryResult.error);
2331
2861
  }
2332
- const args = buildArgs31(inputPath, options);
2862
+ const args = buildArgs40(inputPath, options);
2333
2863
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
2334
2864
  const result = await execCommand(binaryResult.value, args, {
2335
2865
  timeoutMs,
@@ -2347,10 +2877,16 @@ var Xml2dsrOptionsSchema = z.object({
2347
2877
  timeoutMs: z.number().int().positive().optional(),
2348
2878
  signal: z.instanceof(AbortSignal).optional(),
2349
2879
  generateNewUIDs: z.boolean().optional(),
2350
- validateDocument: z.boolean().optional()
2880
+ validateDocument: z.boolean().optional(),
2881
+ verbosity: z.enum(["verbose", "debug"]).optional()
2351
2882
  }).strict().optional();
2352
- function buildArgs32(inputPath, outputPath, options) {
2883
+ function buildArgs41(inputPath, outputPath, options) {
2353
2884
  const args = [];
2885
+ if (options?.verbosity === "verbose") {
2886
+ args.push("-v");
2887
+ } else if (options?.verbosity === "debug") {
2888
+ args.push("-d");
2889
+ }
2354
2890
  if (options?.generateNewUIDs === true) {
2355
2891
  args.push("+Ug");
2356
2892
  }
@@ -2369,7 +2905,7 @@ async function xml2dsr(inputPath, outputPath, options) {
2369
2905
  if (!binaryResult.ok) {
2370
2906
  return err(binaryResult.error);
2371
2907
  }
2372
- const args = buildArgs32(inputPath, outputPath, options);
2908
+ const args = buildArgs41(inputPath, outputPath, options);
2373
2909
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
2374
2910
  const result = await execCommand(binaryResult.value, args, {
2375
2911
  timeoutMs,
@@ -2386,10 +2922,16 @@ async function xml2dsr(inputPath, outputPath, options) {
2386
2922
  var DrtdumpOptionsSchema = z.object({
2387
2923
  timeoutMs: z.number().int().positive().optional(),
2388
2924
  signal: z.instanceof(AbortSignal).optional(),
2389
- printFilename: z.boolean().optional()
2925
+ printFilename: z.boolean().optional(),
2926
+ verbosity: z.enum(["verbose", "debug"]).optional()
2390
2927
  }).strict().optional();
2391
- function buildArgs33(inputPath, options) {
2928
+ function buildArgs42(inputPath, options) {
2392
2929
  const args = [];
2930
+ if (options?.verbosity === "verbose") {
2931
+ args.push("-v");
2932
+ } else if (options?.verbosity === "debug") {
2933
+ args.push("-d");
2934
+ }
2393
2935
  if (options?.printFilename === true) {
2394
2936
  args.push("+Pf");
2395
2937
  }
@@ -2405,7 +2947,7 @@ async function drtdump(inputPath, options) {
2405
2947
  if (!binaryResult.ok) {
2406
2948
  return err(binaryResult.error);
2407
2949
  }
2408
- const args = buildArgs33(inputPath, options);
2950
+ const args = buildArgs42(inputPath, options);
2409
2951
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
2410
2952
  const result = await execCommand(binaryResult.value, args, {
2411
2953
  timeoutMs,
@@ -2421,8 +2963,18 @@ async function drtdump(inputPath, options) {
2421
2963
  }
2422
2964
  var DcmpsmkOptionsSchema = z.object({
2423
2965
  timeoutMs: z.number().int().positive().optional(),
2424
- signal: z.instanceof(AbortSignal).optional()
2966
+ signal: z.instanceof(AbortSignal).optional(),
2967
+ verbosity: z.enum(["verbose", "debug"]).optional()
2425
2968
  }).strict().optional();
2969
+ var VERBOSITY_FLAGS27 = { verbose: "-v", debug: "-d" };
2970
+ function buildArgs43(inputPath, outputPath, options) {
2971
+ const args = [];
2972
+ if (options?.verbosity !== void 0) {
2973
+ args.push(VERBOSITY_FLAGS27[options.verbosity]);
2974
+ }
2975
+ args.push(inputPath, outputPath);
2976
+ return args;
2977
+ }
2426
2978
  async function dcmpsmk(inputPath, outputPath, options) {
2427
2979
  const validation = DcmpsmkOptionsSchema.safeParse(options);
2428
2980
  if (!validation.success) {
@@ -2432,7 +2984,7 @@ async function dcmpsmk(inputPath, outputPath, options) {
2432
2984
  if (!binaryResult.ok) {
2433
2985
  return err(binaryResult.error);
2434
2986
  }
2435
- const args = [inputPath, outputPath];
2987
+ const args = buildArgs43(inputPath, outputPath, options);
2436
2988
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
2437
2989
  const result = await execCommand(binaryResult.value, args, {
2438
2990
  timeoutMs,
@@ -2448,8 +3000,18 @@ async function dcmpsmk(inputPath, outputPath, options) {
2448
3000
  }
2449
3001
  var DcmpschkOptionsSchema = z.object({
2450
3002
  timeoutMs: z.number().int().positive().optional(),
2451
- signal: z.instanceof(AbortSignal).optional()
3003
+ signal: z.instanceof(AbortSignal).optional(),
3004
+ verbosity: z.enum(["verbose", "debug"]).optional()
2452
3005
  }).strict().optional();
3006
+ var VERBOSITY_FLAGS28 = { verbose: "-v", debug: "-d" };
3007
+ function buildArgs44(inputPath, options) {
3008
+ const args = [];
3009
+ if (options?.verbosity !== void 0) {
3010
+ args.push(VERBOSITY_FLAGS28[options.verbosity]);
3011
+ }
3012
+ args.push(inputPath);
3013
+ return args;
3014
+ }
2453
3015
  async function dcmpschk(inputPath, options) {
2454
3016
  const validation = DcmpschkOptionsSchema.safeParse(options);
2455
3017
  if (!validation.success) {
@@ -2459,7 +3021,7 @@ async function dcmpschk(inputPath, options) {
2459
3021
  if (!binaryResult.ok) {
2460
3022
  return err(binaryResult.error);
2461
3023
  }
2462
- const args = [inputPath];
3024
+ const args = buildArgs44(inputPath, options);
2463
3025
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
2464
3026
  const result = await execCommand(binaryResult.value, args, {
2465
3027
  timeoutMs,
@@ -2480,10 +3042,16 @@ var DcmprscuOptionsSchema = z.object({
2480
3042
  port: z.number().int().min(1).max(65535),
2481
3043
  callingAETitle: z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
2482
3044
  calledAETitle: z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
2483
- configFile: z.string().min(1).optional()
3045
+ configFile: z.string().min(1).optional(),
3046
+ verbosity: z.enum(["verbose", "debug"]).optional()
2484
3047
  }).strict();
2485
- function buildArgs34(options) {
3048
+ function buildArgs45(options) {
2486
3049
  const args = [];
3050
+ if (options.verbosity === "verbose") {
3051
+ args.push("-v");
3052
+ } else if (options.verbosity === "debug") {
3053
+ args.push("-d");
3054
+ }
2487
3055
  if (options.callingAETitle !== void 0) {
2488
3056
  args.push("-aet", options.callingAETitle);
2489
3057
  }
@@ -2505,7 +3073,7 @@ async function dcmprscu(options) {
2505
3073
  if (!binaryResult.ok) {
2506
3074
  return err(binaryResult.error);
2507
3075
  }
2508
- const args = buildArgs34(options);
3076
+ const args = buildArgs45(options);
2509
3077
  const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
2510
3078
  const result = await execCommand(binaryResult.value, args, {
2511
3079
  timeoutMs,
@@ -2522,10 +3090,16 @@ async function dcmprscu(options) {
2522
3090
  var DcmpsprtOptionsSchema = z.object({
2523
3091
  timeoutMs: z.number().int().positive().optional(),
2524
3092
  signal: z.instanceof(AbortSignal).optional(),
2525
- configFile: z.string().min(1).optional()
3093
+ configFile: z.string().min(1).optional(),
3094
+ verbosity: z.enum(["verbose", "debug"]).optional()
2526
3095
  }).strict().optional();
2527
- function buildArgs35(inputPath, options) {
3096
+ function buildArgs46(inputPath, options) {
2528
3097
  const args = [];
3098
+ if (options?.verbosity === "verbose") {
3099
+ args.push("-v");
3100
+ } else if (options?.verbosity === "debug") {
3101
+ args.push("-d");
3102
+ }
2529
3103
  if (options?.configFile !== void 0) {
2530
3104
  args.push("-c", options.configFile);
2531
3105
  }
@@ -2541,7 +3115,7 @@ async function dcmpsprt(inputPath, options) {
2541
3115
  if (!binaryResult.ok) {
2542
3116
  return err(binaryResult.error);
2543
3117
  }
2544
- const args = buildArgs35(inputPath, options);
3118
+ const args = buildArgs46(inputPath, options);
2545
3119
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
2546
3120
  const result = await execCommand(binaryResult.value, args, {
2547
3121
  timeoutMs,
@@ -2559,10 +3133,16 @@ var Dcmp2pgmOptionsSchema = z.object({
2559
3133
  timeoutMs: z.number().int().positive().optional(),
2560
3134
  signal: z.instanceof(AbortSignal).optional(),
2561
3135
  presentationState: z.string().min(1).optional(),
2562
- frame: z.number().int().min(0).max(65535).optional()
3136
+ frame: z.number().int().min(0).max(65535).optional(),
3137
+ verbosity: z.enum(["verbose", "debug"]).optional()
2563
3138
  }).strict().optional();
2564
- function buildArgs36(inputPath, outputPath, options) {
3139
+ function buildArgs47(inputPath, outputPath, options) {
2565
3140
  const args = [];
3141
+ if (options?.verbosity === "verbose") {
3142
+ args.push("-v");
3143
+ } else if (options?.verbosity === "debug") {
3144
+ args.push("-d");
3145
+ }
2566
3146
  if (options?.presentationState !== void 0) {
2567
3147
  args.push("-p", options.presentationState);
2568
3148
  }
@@ -2581,7 +3161,7 @@ async function dcmp2pgm(inputPath, outputPath, options) {
2581
3161
  if (!binaryResult.ok) {
2582
3162
  return err(binaryResult.error);
2583
3163
  }
2584
- const args = buildArgs36(inputPath, outputPath, options);
3164
+ const args = buildArgs47(inputPath, outputPath, options);
2585
3165
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
2586
3166
  const result = await execCommand(binaryResult.value, args, {
2587
3167
  timeoutMs,
@@ -2597,8 +3177,18 @@ async function dcmp2pgm(inputPath, outputPath, options) {
2597
3177
  }
2598
3178
  var DcmmkcrvOptionsSchema = z.object({
2599
3179
  timeoutMs: z.number().int().positive().optional(),
2600
- signal: z.instanceof(AbortSignal).optional()
3180
+ signal: z.instanceof(AbortSignal).optional(),
3181
+ verbosity: z.enum(["verbose", "debug"]).optional()
2601
3182
  }).strict().optional();
3183
+ var VERBOSITY_FLAGS29 = { verbose: "-v", debug: "-d" };
3184
+ function buildArgs48(inputPath, outputPath, options) {
3185
+ const args = [];
3186
+ if (options?.verbosity !== void 0) {
3187
+ args.push(VERBOSITY_FLAGS29[options.verbosity]);
3188
+ }
3189
+ args.push(inputPath, outputPath);
3190
+ return args;
3191
+ }
2602
3192
  async function dcmmkcrv(inputPath, outputPath, options) {
2603
3193
  const validation = DcmmkcrvOptionsSchema.safeParse(options);
2604
3194
  if (!validation.success) {
@@ -2608,7 +3198,7 @@ async function dcmmkcrv(inputPath, outputPath, options) {
2608
3198
  if (!binaryResult.ok) {
2609
3199
  return err(binaryResult.error);
2610
3200
  }
2611
- const args = [inputPath, outputPath];
3201
+ const args = buildArgs48(inputPath, outputPath, options);
2612
3202
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
2613
3203
  const result = await execCommand(binaryResult.value, args, {
2614
3204
  timeoutMs,
@@ -2635,16 +3225,17 @@ var LUT_TYPE_FLAGS = {
2635
3225
  presentation: "+Tp",
2636
3226
  voi: "+Tv"
2637
3227
  };
3228
+ var VERBOSITY_FLAGS30 = { verbose: "-v", debug: "-d" };
2638
3229
  var DcmmklutOptionsSchema = z.object({
2639
3230
  timeoutMs: z.number().int().positive().optional(),
2640
3231
  signal: z.instanceof(AbortSignal).optional(),
2641
3232
  lutType: z.enum(["modality", "presentation", "voi"]).optional(),
2642
3233
  gamma: z.number().positive().optional(),
2643
3234
  entries: z.number().int().positive().optional(),
2644
- bits: z.number().int().min(8).max(16).optional()
3235
+ bits: z.number().int().min(8).max(16).optional(),
3236
+ verbosity: z.enum(["verbose", "debug"]).optional()
2645
3237
  }).strict().optional();
2646
- function buildArgs37(outputPath, options) {
2647
- const args = [];
3238
+ function pushLutArgs(args, options) {
2648
3239
  if (options?.lutType !== void 0) {
2649
3240
  args.push(LUT_TYPE_FLAGS[options.lutType]);
2650
3241
  }
@@ -2657,6 +3248,13 @@ function buildArgs37(outputPath, options) {
2657
3248
  if (options?.bits !== void 0) {
2658
3249
  args.push("-b", String(options.bits));
2659
3250
  }
3251
+ }
3252
+ function buildArgs49(outputPath, options) {
3253
+ const args = [];
3254
+ if (options?.verbosity !== void 0) {
3255
+ args.push(VERBOSITY_FLAGS30[options.verbosity]);
3256
+ }
3257
+ pushLutArgs(args, options);
2660
3258
  args.push(outputPath);
2661
3259
  return args;
2662
3260
  }
@@ -2669,7 +3267,7 @@ async function dcmmklut(outputPath, options) {
2669
3267
  if (!binaryResult.ok) {
2670
3268
  return err(binaryResult.error);
2671
3269
  }
2672
- const args = buildArgs37(outputPath, options);
3270
+ const args = buildArgs49(outputPath, options);
2673
3271
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
2674
3272
  const result = await execCommand(binaryResult.value, args, {
2675
3273
  timeoutMs,