@ubercode/dcmtk 0.8.0 → 0.8.2
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/{DicomInstance-BjrSIEGN.d.ts → DicomInstance-BKUiir0G.d.ts} +8 -3
- package/dist/{DicomInstance-zsmyd7fs.d.cts → DicomInstance-CxLKC-oM.d.cts} +8 -3
- package/dist/dicom.cjs +15 -6
- package/dist/dicom.cjs.map +1 -1
- package/dist/dicom.d.cts +2 -2
- package/dist/dicom.d.ts +2 -2
- package/dist/dicom.js +15 -6
- package/dist/dicom.js.map +1 -1
- package/dist/{index-AYvUunlI.d.cts → index-B13DmBRs.d.cts} +1 -1
- package/dist/{index-C20fLU5U.d.ts → index-CCgNgve7.d.ts} +1 -1
- package/dist/index.cjs +19 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +19 -6
- package/dist/index.js.map +1 -1
- package/dist/servers.cjs +15 -6
- 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 +15 -6
- package/dist/servers.js.map +1 -1
- package/dist/tools.cjs +16 -4
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.d.cts +4 -0
- package/dist/tools.d.ts +4 -0
- package/dist/tools.js +16 -4
- package/dist/tools.js.map +1 -1
- package/package.json +2 -2
package/dist/dicom.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DicomTag, a as DicomTagPath } from './DicomInstance-
|
|
2
|
-
export { C as ChangeSet, b as DicomDataset, d as DicomInstance } from './DicomInstance-
|
|
1
|
+
import { D as DicomTag, a as DicomTagPath } from './DicomInstance-CxLKC-oM.cjs';
|
|
2
|
+
export { C as ChangeSet, b as DicomDataset, d as DicomInstance, e as DicomOpenOptions } from './DicomInstance-CxLKC-oM.cjs';
|
|
3
3
|
export { x as xmlToJson } from './dcmodify-Cf-RPHF3.cjs';
|
|
4
4
|
import './types-Cgumy1N4.cjs';
|
|
5
5
|
|
package/dist/dicom.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DicomTag, a as DicomTagPath } from './DicomInstance-
|
|
2
|
-
export { C as ChangeSet, b as DicomDataset, d as DicomInstance } from './DicomInstance-
|
|
1
|
+
import { D as DicomTag, a as DicomTagPath } from './DicomInstance-BKUiir0G.js';
|
|
2
|
+
export { C as ChangeSet, b as DicomDataset, d as DicomInstance, e as DicomOpenOptions } from './DicomInstance-BKUiir0G.js';
|
|
3
3
|
export { x as xmlToJson } from './dcmodify-CHvwChFu.js';
|
|
4
4
|
import './types-Cgumy1N4.js';
|
|
5
5
|
|
package/dist/dicom.js
CHANGED
|
@@ -30778,6 +30778,7 @@ var Dcm2jsonOptionsSchema = z.object({
|
|
|
30778
30778
|
timeoutMs: z.number().int().positive().optional(),
|
|
30779
30779
|
signal: z.instanceof(AbortSignal).optional(),
|
|
30780
30780
|
directOnly: z.boolean().optional(),
|
|
30781
|
+
charsetAssume: z.string().min(1).optional(),
|
|
30781
30782
|
verbosity: z.enum(["verbose", "debug"]).optional()
|
|
30782
30783
|
}).strict().optional();
|
|
30783
30784
|
var VERBOSITY_FLAGS = { verbose: "-v", debug: "-d" };
|
|
@@ -30787,12 +30788,19 @@ function buildVerbosityArgs(verbosity) {
|
|
|
30787
30788
|
}
|
|
30788
30789
|
return [];
|
|
30789
30790
|
}
|
|
30790
|
-
|
|
30791
|
+
function buildXmlOpts(options) {
|
|
30792
|
+
const result = {};
|
|
30793
|
+
if (options?.verbosity !== void 0) result["verbosity"] = options.verbosity;
|
|
30794
|
+
if (options?.charsetAssume !== void 0) result["charsetAssume"] = options.charsetAssume;
|
|
30795
|
+
return result;
|
|
30796
|
+
}
|
|
30797
|
+
async function tryXmlPath(inputPath, timeoutMs, signal, opts) {
|
|
30791
30798
|
const xmlBinary = resolveBinary("dcm2xml");
|
|
30792
30799
|
if (!xmlBinary.ok) {
|
|
30793
30800
|
return err(xmlBinary.error);
|
|
30794
30801
|
}
|
|
30795
|
-
const
|
|
30802
|
+
const charsetArgs = opts?.charsetAssume !== void 0 ? ["+Ca", opts.charsetAssume] : [];
|
|
30803
|
+
const xmlArgs = [...buildVerbosityArgs(opts?.verbosity), ...charsetArgs, "-nat", inputPath];
|
|
30796
30804
|
const xmlResult = await execCommand(xmlBinary.value, xmlArgs, { timeoutMs, signal });
|
|
30797
30805
|
if (!xmlResult.ok) {
|
|
30798
30806
|
return err(xmlResult.error);
|
|
@@ -30811,7 +30819,7 @@ async function tryDirectPath(inputPath, timeoutMs, signal, verbosity) {
|
|
|
30811
30819
|
if (!jsonBinary.ok) {
|
|
30812
30820
|
return err(jsonBinary.error);
|
|
30813
30821
|
}
|
|
30814
|
-
const directArgs = [...buildVerbosityArgs(verbosity), inputPath];
|
|
30822
|
+
const directArgs = [...buildVerbosityArgs(verbosity), "+b", inputPath];
|
|
30815
30823
|
const result = await execCommand(jsonBinary.value, directArgs, { timeoutMs, signal });
|
|
30816
30824
|
if (!result.ok) {
|
|
30817
30825
|
return err(result.error);
|
|
@@ -30838,7 +30846,7 @@ async function dcm2json(inputPath, options) {
|
|
|
30838
30846
|
if (options?.directOnly === true) {
|
|
30839
30847
|
return tryDirectPath(inputPath, timeoutMs, signal, verbosity);
|
|
30840
30848
|
}
|
|
30841
|
-
const xmlResult = await tryXmlPath(inputPath, timeoutMs, signal,
|
|
30849
|
+
const xmlResult = await tryXmlPath(inputPath, timeoutMs, signal, buildXmlOpts(options));
|
|
30842
30850
|
if (xmlResult.ok) {
|
|
30843
30851
|
return xmlResult;
|
|
30844
30852
|
}
|
|
@@ -30967,7 +30975,7 @@ var DicomInstance = class _DicomInstance {
|
|
|
30967
30975
|
* Opens a DICOM file and creates a DicomInstance.
|
|
30968
30976
|
*
|
|
30969
30977
|
* @param path - Filesystem path to the DICOM file
|
|
30970
|
-
* @param options - Timeout and
|
|
30978
|
+
* @param options - Timeout, abort, and charset options
|
|
30971
30979
|
* @returns A Result containing the DicomInstance or an error
|
|
30972
30980
|
*/
|
|
30973
30981
|
static async open(path, options) {
|
|
@@ -30975,7 +30983,8 @@ var DicomInstance = class _DicomInstance {
|
|
|
30975
30983
|
if (!filePathResult.ok) return err(filePathResult.error);
|
|
30976
30984
|
const jsonResult = await dcm2json(path, {
|
|
30977
30985
|
timeoutMs: options?.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
30978
|
-
signal: options?.signal
|
|
30986
|
+
signal: options?.signal,
|
|
30987
|
+
charsetAssume: options?.charsetAssume
|
|
30979
30988
|
});
|
|
30980
30989
|
if (!jsonResult.ok) return err(jsonResult.error);
|
|
30981
30990
|
const datasetResult = DicomDataset.fromJson(jsonResult.value.data);
|