dicom-curate 0.23.0 → 0.24.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/esm/applyMappingsWorker.js +65 -25
- package/dist/esm/collectMappings.js +9 -1
- package/dist/esm/curateDict.js +9 -1
- package/dist/esm/curateOne.js +62 -25
- package/dist/esm/index.js +89 -31
- package/dist/esm/scanDirectoryWorker.js +69 -50
- package/dist/esm/serializeMappingOptions.js +6 -1
- package/dist/types/scanDirectoryWorker.d.ts +10 -12
- package/dist/types/types.d.ts +3 -2
- package/dist/umd/dicom-curate.umd.js +222 -100
- package/dist/umd/dicom-curate.umd.js.map +1 -1
- package/dist/umd/dicom-curate.umd.min.js +5 -5
- package/dist/umd/dicom-curate.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -79464,6 +79464,12 @@ function collectMappings(inputFilePath, dicomData, mappingOptions) {
|
|
|
79464
79464
|
errors: [],
|
|
79465
79465
|
quarantine: {}
|
|
79466
79466
|
};
|
|
79467
|
+
if (mappingOptions.curationSpec === "none") {
|
|
79468
|
+
return [
|
|
79469
|
+
dcmjs4.data.DicomMetaDictionary.naturalizeDataset(dicomData.dict),
|
|
79470
|
+
mapResults
|
|
79471
|
+
];
|
|
79472
|
+
}
|
|
79467
79473
|
const naturalData = dcmjs4.data.DicomMetaDictionary.naturalizeDataset(
|
|
79468
79474
|
dicomData.dict
|
|
79469
79475
|
);
|
|
@@ -79498,6 +79504,8 @@ function collectMappings(inputFilePath, dicomData, mappingOptions) {
|
|
|
79498
79504
|
}
|
|
79499
79505
|
if (!mappingOptions.skipModifications) {
|
|
79500
79506
|
mapResults.outputFilePath = finalSpec.outputFilePathComponents(parser).join("/");
|
|
79507
|
+
} else {
|
|
79508
|
+
mapResults.outputFilePath = inputFilePath;
|
|
79501
79509
|
}
|
|
79502
79510
|
const rawModality = naturalData.Modality;
|
|
79503
79511
|
let modalityStr = "";
|
|
@@ -79507,7 +79515,7 @@ function collectMappings(inputFilePath, dicomData, mappingOptions) {
|
|
|
79507
79515
|
modalityStr = String(rawModality[0]);
|
|
79508
79516
|
}
|
|
79509
79517
|
const modality = modalityStr.trim().replace(/\W/g, "") || "OT";
|
|
79510
|
-
if (finalSpec.dicomPS315EOptions !== "Off") {
|
|
79518
|
+
if (!mappingOptions.skipModifications && finalSpec.dicomPS315EOptions !== "Off") {
|
|
79511
79519
|
deidentifyPS315E({
|
|
79512
79520
|
naturalData,
|
|
79513
79521
|
dicomPS315EOptions: finalSpec.dicomPS315EOptions,
|
|
@@ -79889,38 +79897,67 @@ async function curateOne({
|
|
|
79889
79897
|
if (canSkip && previousSourceFileInfo) {
|
|
79890
79898
|
return noMapResult();
|
|
79891
79899
|
}
|
|
79892
|
-
|
|
79893
|
-
|
|
79894
|
-
|
|
79895
|
-
|
|
79896
|
-
|
|
79897
|
-
|
|
79898
|
-
|
|
79899
|
-
|
|
79900
|
-
|
|
79901
|
-
|
|
79902
|
-
|
|
79903
|
-
|
|
79904
|
-
|
|
79905
|
-
|
|
79906
|
-
|
|
79907
|
-
|
|
79908
|
-
|
|
79909
|
-
|
|
79900
|
+
let mappedDicomData;
|
|
79901
|
+
let clonedMapResults;
|
|
79902
|
+
if (mappingOptions.curationSpec !== "none") {
|
|
79903
|
+
dcmjs7.log.setLevel(dcmjs7.log.levels.ERROR);
|
|
79904
|
+
dcmjs7.log.getLogger("validation.dcmjs").setLevel(dcmjs7.log.levels.SILENT);
|
|
79905
|
+
let dicomData;
|
|
79906
|
+
try {
|
|
79907
|
+
dicomData = dcmjs7.data.DicomMessage.readFile(fileArrayBuffer, {
|
|
79908
|
+
ignoreErrors: true
|
|
79909
|
+
});
|
|
79910
|
+
} catch (error2) {
|
|
79911
|
+
console.warn(
|
|
79912
|
+
`[dicom-curate] Could not parse ${fileInfo.name} as DICOM data:`,
|
|
79913
|
+
error2
|
|
79914
|
+
);
|
|
79915
|
+
const mapResults = {
|
|
79916
|
+
anomalies: [`Could not parse ${fileInfo.name} as DICOM data`],
|
|
79917
|
+
errors: [
|
|
79918
|
+
`File ${fileInfo.name} is not a valid DICOM file or is corrupted`
|
|
79919
|
+
],
|
|
79920
|
+
sourceInstanceUID: `invalid_${fileInfo.name.replace(/[^a-zA-Z0-9]/g, "_")}`,
|
|
79921
|
+
fileInfo: {
|
|
79922
|
+
name: fileInfo.name,
|
|
79923
|
+
size: fileInfo.size,
|
|
79924
|
+
path: fileInfo.path,
|
|
79925
|
+
mtime,
|
|
79926
|
+
preMappedHash,
|
|
79927
|
+
parseError: error2 instanceof Error ? error2.message : String(error2)
|
|
79928
|
+
},
|
|
79929
|
+
curationTime: performance.now() - startTime
|
|
79930
|
+
};
|
|
79931
|
+
return mapResults;
|
|
79932
|
+
}
|
|
79933
|
+
;
|
|
79934
|
+
({ dicomData: mappedDicomData, mapResults: clonedMapResults } = curateDict(
|
|
79935
|
+
`${fileInfo.path}/${fileInfo.name}`,
|
|
79936
|
+
dicomData,
|
|
79937
|
+
mappingOptions
|
|
79938
|
+
));
|
|
79939
|
+
clonedMapResults.mappingRequired = true;
|
|
79940
|
+
} else {
|
|
79941
|
+
mappedDicomData = {
|
|
79942
|
+
write: (...args) => fileArrayBuffer
|
|
79943
|
+
};
|
|
79944
|
+
clonedMapResults = {
|
|
79945
|
+
sourceInstanceUID: `passthrough_${fileInfo.name.replace(/[^a-zA-Z0-9]/g, "_")}`,
|
|
79946
|
+
mappings: {},
|
|
79947
|
+
anomalies: [],
|
|
79948
|
+
errors: [],
|
|
79949
|
+
quarantine: {},
|
|
79910
79950
|
fileInfo: {
|
|
79911
79951
|
name: fileInfo.name,
|
|
79912
79952
|
size: fileInfo.size,
|
|
79913
79953
|
path: fileInfo.path,
|
|
79914
79954
|
mtime,
|
|
79915
|
-
preMappedHash
|
|
79916
|
-
parseError: error2 instanceof Error ? error2.message : String(error2)
|
|
79955
|
+
preMappedHash
|
|
79917
79956
|
},
|
|
79918
|
-
|
|
79957
|
+
outputFilePath: `${fileInfo.path}/${fileInfo.name}`,
|
|
79958
|
+
mappingRequired: false
|
|
79919
79959
|
};
|
|
79920
|
-
return mapResults;
|
|
79921
79960
|
}
|
|
79922
|
-
const { dicomData: mappedDicomData, mapResults: clonedMapResults } = curateDict(`${fileInfo.path}/${fileInfo.name}`, dicomData, mappingOptions);
|
|
79923
|
-
clonedMapResults.mappingRequired = true;
|
|
79924
79961
|
if (!preMappedHash) {
|
|
79925
79962
|
try {
|
|
79926
79963
|
preMappedHash = await hash(fileArrayBuffer, hashMethod || "crc64");
|
|
@@ -85680,6 +85717,9 @@ var import_acorn_globals = __toESM(require_acorn_globals(), 1);
|
|
|
85680
85717
|
// src/serializeMappingOptions.ts
|
|
85681
85718
|
function deserializeMappingOptions(serializedMappingOptions) {
|
|
85682
85719
|
const { curationSpecStr, ...rest } = serializedMappingOptions;
|
|
85720
|
+
if (curationSpecStr === "none") {
|
|
85721
|
+
return { ...rest, curationSpec: "none" };
|
|
85722
|
+
}
|
|
85683
85723
|
const curationSpec = new Function(`return ${curationSpecStr}`)();
|
|
85684
85724
|
return { ...rest, curationSpec };
|
|
85685
85725
|
}
|
|
@@ -35458,6 +35458,12 @@ function collectMappings(inputFilePath, dicomData, mappingOptions) {
|
|
|
35458
35458
|
errors: [],
|
|
35459
35459
|
quarantine: {}
|
|
35460
35460
|
};
|
|
35461
|
+
if (mappingOptions.curationSpec === "none") {
|
|
35462
|
+
return [
|
|
35463
|
+
dcmjs4.data.DicomMetaDictionary.naturalizeDataset(dicomData.dict),
|
|
35464
|
+
mapResults
|
|
35465
|
+
];
|
|
35466
|
+
}
|
|
35461
35467
|
const naturalData = dcmjs4.data.DicomMetaDictionary.naturalizeDataset(
|
|
35462
35468
|
dicomData.dict
|
|
35463
35469
|
);
|
|
@@ -35492,6 +35498,8 @@ function collectMappings(inputFilePath, dicomData, mappingOptions) {
|
|
|
35492
35498
|
}
|
|
35493
35499
|
if (!mappingOptions.skipModifications) {
|
|
35494
35500
|
mapResults.outputFilePath = finalSpec.outputFilePathComponents(parser).join("/");
|
|
35501
|
+
} else {
|
|
35502
|
+
mapResults.outputFilePath = inputFilePath;
|
|
35495
35503
|
}
|
|
35496
35504
|
const rawModality = naturalData.Modality;
|
|
35497
35505
|
let modalityStr = "";
|
|
@@ -35501,7 +35509,7 @@ function collectMappings(inputFilePath, dicomData, mappingOptions) {
|
|
|
35501
35509
|
modalityStr = String(rawModality[0]);
|
|
35502
35510
|
}
|
|
35503
35511
|
const modality = modalityStr.trim().replace(/\W/g, "") || "OT";
|
|
35504
|
-
if (finalSpec.dicomPS315EOptions !== "Off") {
|
|
35512
|
+
if (!mappingOptions.skipModifications && finalSpec.dicomPS315EOptions !== "Off") {
|
|
35505
35513
|
deidentifyPS315E({
|
|
35506
35514
|
naturalData,
|
|
35507
35515
|
dicomPS315EOptions: finalSpec.dicomPS315EOptions,
|
package/dist/esm/curateDict.js
CHANGED
|
@@ -35475,6 +35475,12 @@ function collectMappings(inputFilePath, dicomData, mappingOptions) {
|
|
|
35475
35475
|
errors: [],
|
|
35476
35476
|
quarantine: {}
|
|
35477
35477
|
};
|
|
35478
|
+
if (mappingOptions.curationSpec === "none") {
|
|
35479
|
+
return [
|
|
35480
|
+
dcmjs4.data.DicomMetaDictionary.naturalizeDataset(dicomData.dict),
|
|
35481
|
+
mapResults
|
|
35482
|
+
];
|
|
35483
|
+
}
|
|
35478
35484
|
const naturalData = dcmjs4.data.DicomMetaDictionary.naturalizeDataset(
|
|
35479
35485
|
dicomData.dict
|
|
35480
35486
|
);
|
|
@@ -35509,6 +35515,8 @@ function collectMappings(inputFilePath, dicomData, mappingOptions) {
|
|
|
35509
35515
|
}
|
|
35510
35516
|
if (!mappingOptions.skipModifications) {
|
|
35511
35517
|
mapResults.outputFilePath = finalSpec.outputFilePathComponents(parser).join("/");
|
|
35518
|
+
} else {
|
|
35519
|
+
mapResults.outputFilePath = inputFilePath;
|
|
35512
35520
|
}
|
|
35513
35521
|
const rawModality = naturalData.Modality;
|
|
35514
35522
|
let modalityStr = "";
|
|
@@ -35518,7 +35526,7 @@ function collectMappings(inputFilePath, dicomData, mappingOptions) {
|
|
|
35518
35526
|
modalityStr = String(rawModality[0]);
|
|
35519
35527
|
}
|
|
35520
35528
|
const modality = modalityStr.trim().replace(/\W/g, "") || "OT";
|
|
35521
|
-
if (finalSpec.dicomPS315EOptions !== "Off") {
|
|
35529
|
+
if (!mappingOptions.skipModifications && finalSpec.dicomPS315EOptions !== "Off") {
|
|
35522
35530
|
deidentifyPS315E({
|
|
35523
35531
|
naturalData,
|
|
35524
35532
|
dicomPS315EOptions: finalSpec.dicomPS315EOptions,
|
package/dist/esm/curateOne.js
CHANGED
|
@@ -73173,6 +73173,12 @@ function collectMappings(inputFilePath, dicomData, mappingOptions) {
|
|
|
73173
73173
|
errors: [],
|
|
73174
73174
|
quarantine: {}
|
|
73175
73175
|
};
|
|
73176
|
+
if (mappingOptions.curationSpec === "none") {
|
|
73177
|
+
return [
|
|
73178
|
+
dcmjs4.data.DicomMetaDictionary.naturalizeDataset(dicomData.dict),
|
|
73179
|
+
mapResults
|
|
73180
|
+
];
|
|
73181
|
+
}
|
|
73176
73182
|
const naturalData = dcmjs4.data.DicomMetaDictionary.naturalizeDataset(
|
|
73177
73183
|
dicomData.dict
|
|
73178
73184
|
);
|
|
@@ -73207,6 +73213,8 @@ function collectMappings(inputFilePath, dicomData, mappingOptions) {
|
|
|
73207
73213
|
}
|
|
73208
73214
|
if (!mappingOptions.skipModifications) {
|
|
73209
73215
|
mapResults.outputFilePath = finalSpec.outputFilePathComponents(parser).join("/");
|
|
73216
|
+
} else {
|
|
73217
|
+
mapResults.outputFilePath = inputFilePath;
|
|
73210
73218
|
}
|
|
73211
73219
|
const rawModality = naturalData.Modality;
|
|
73212
73220
|
let modalityStr = "";
|
|
@@ -73216,7 +73224,7 @@ function collectMappings(inputFilePath, dicomData, mappingOptions) {
|
|
|
73216
73224
|
modalityStr = String(rawModality[0]);
|
|
73217
73225
|
}
|
|
73218
73226
|
const modality = modalityStr.trim().replace(/\W/g, "") || "OT";
|
|
73219
|
-
if (finalSpec.dicomPS315EOptions !== "Off") {
|
|
73227
|
+
if (!mappingOptions.skipModifications && finalSpec.dicomPS315EOptions !== "Off") {
|
|
73220
73228
|
deidentifyPS315E({
|
|
73221
73229
|
naturalData,
|
|
73222
73230
|
dicomPS315EOptions: finalSpec.dicomPS315EOptions,
|
|
@@ -73598,38 +73606,67 @@ async function curateOne({
|
|
|
73598
73606
|
if (canSkip && previousSourceFileInfo) {
|
|
73599
73607
|
return noMapResult();
|
|
73600
73608
|
}
|
|
73601
|
-
|
|
73602
|
-
|
|
73603
|
-
|
|
73604
|
-
|
|
73605
|
-
|
|
73606
|
-
|
|
73607
|
-
|
|
73608
|
-
|
|
73609
|
-
|
|
73610
|
-
|
|
73611
|
-
|
|
73612
|
-
|
|
73613
|
-
|
|
73614
|
-
|
|
73615
|
-
|
|
73616
|
-
|
|
73617
|
-
|
|
73618
|
-
|
|
73609
|
+
let mappedDicomData;
|
|
73610
|
+
let clonedMapResults;
|
|
73611
|
+
if (mappingOptions.curationSpec !== "none") {
|
|
73612
|
+
dcmjs7.log.setLevel(dcmjs7.log.levels.ERROR);
|
|
73613
|
+
dcmjs7.log.getLogger("validation.dcmjs").setLevel(dcmjs7.log.levels.SILENT);
|
|
73614
|
+
let dicomData;
|
|
73615
|
+
try {
|
|
73616
|
+
dicomData = dcmjs7.data.DicomMessage.readFile(fileArrayBuffer, {
|
|
73617
|
+
ignoreErrors: true
|
|
73618
|
+
});
|
|
73619
|
+
} catch (error2) {
|
|
73620
|
+
console.warn(
|
|
73621
|
+
`[dicom-curate] Could not parse ${fileInfo.name} as DICOM data:`,
|
|
73622
|
+
error2
|
|
73623
|
+
);
|
|
73624
|
+
const mapResults = {
|
|
73625
|
+
anomalies: [`Could not parse ${fileInfo.name} as DICOM data`],
|
|
73626
|
+
errors: [
|
|
73627
|
+
`File ${fileInfo.name} is not a valid DICOM file or is corrupted`
|
|
73628
|
+
],
|
|
73629
|
+
sourceInstanceUID: `invalid_${fileInfo.name.replace(/[^a-zA-Z0-9]/g, "_")}`,
|
|
73630
|
+
fileInfo: {
|
|
73631
|
+
name: fileInfo.name,
|
|
73632
|
+
size: fileInfo.size,
|
|
73633
|
+
path: fileInfo.path,
|
|
73634
|
+
mtime,
|
|
73635
|
+
preMappedHash,
|
|
73636
|
+
parseError: error2 instanceof Error ? error2.message : String(error2)
|
|
73637
|
+
},
|
|
73638
|
+
curationTime: performance.now() - startTime
|
|
73639
|
+
};
|
|
73640
|
+
return mapResults;
|
|
73641
|
+
}
|
|
73642
|
+
;
|
|
73643
|
+
({ dicomData: mappedDicomData, mapResults: clonedMapResults } = curateDict(
|
|
73644
|
+
`${fileInfo.path}/${fileInfo.name}`,
|
|
73645
|
+
dicomData,
|
|
73646
|
+
mappingOptions
|
|
73647
|
+
));
|
|
73648
|
+
clonedMapResults.mappingRequired = true;
|
|
73649
|
+
} else {
|
|
73650
|
+
mappedDicomData = {
|
|
73651
|
+
write: (...args) => fileArrayBuffer
|
|
73652
|
+
};
|
|
73653
|
+
clonedMapResults = {
|
|
73654
|
+
sourceInstanceUID: `passthrough_${fileInfo.name.replace(/[^a-zA-Z0-9]/g, "_")}`,
|
|
73655
|
+
mappings: {},
|
|
73656
|
+
anomalies: [],
|
|
73657
|
+
errors: [],
|
|
73658
|
+
quarantine: {},
|
|
73619
73659
|
fileInfo: {
|
|
73620
73660
|
name: fileInfo.name,
|
|
73621
73661
|
size: fileInfo.size,
|
|
73622
73662
|
path: fileInfo.path,
|
|
73623
73663
|
mtime,
|
|
73624
|
-
preMappedHash
|
|
73625
|
-
parseError: error2 instanceof Error ? error2.message : String(error2)
|
|
73664
|
+
preMappedHash
|
|
73626
73665
|
},
|
|
73627
|
-
|
|
73666
|
+
outputFilePath: `${fileInfo.path}/${fileInfo.name}`,
|
|
73667
|
+
mappingRequired: false
|
|
73628
73668
|
};
|
|
73629
|
-
return mapResults;
|
|
73630
73669
|
}
|
|
73631
|
-
const { dicomData: mappedDicomData, mapResults: clonedMapResults } = curateDict(`${fileInfo.path}/${fileInfo.name}`, dicomData, mappingOptions);
|
|
73632
|
-
clonedMapResults.mappingRequired = true;
|
|
73633
73670
|
if (!preMappedHash) {
|
|
73634
73671
|
try {
|
|
73635
73672
|
preMappedHash = await hash(fileArrayBuffer, hashMethod || "crc64");
|
package/dist/esm/index.js
CHANGED
|
@@ -81024,6 +81024,12 @@ function collectMappings(inputFilePath, dicomData, mappingOptions) {
|
|
|
81024
81024
|
errors: [],
|
|
81025
81025
|
quarantine: {}
|
|
81026
81026
|
};
|
|
81027
|
+
if (mappingOptions.curationSpec === "none") {
|
|
81028
|
+
return [
|
|
81029
|
+
dcmjs4.data.DicomMetaDictionary.naturalizeDataset(dicomData.dict),
|
|
81030
|
+
mapResults
|
|
81031
|
+
];
|
|
81032
|
+
}
|
|
81027
81033
|
const naturalData = dcmjs4.data.DicomMetaDictionary.naturalizeDataset(
|
|
81028
81034
|
dicomData.dict
|
|
81029
81035
|
);
|
|
@@ -81058,6 +81064,8 @@ function collectMappings(inputFilePath, dicomData, mappingOptions) {
|
|
|
81058
81064
|
}
|
|
81059
81065
|
if (!mappingOptions.skipModifications) {
|
|
81060
81066
|
mapResults.outputFilePath = finalSpec.outputFilePathComponents(parser).join("/");
|
|
81067
|
+
} else {
|
|
81068
|
+
mapResults.outputFilePath = inputFilePath;
|
|
81061
81069
|
}
|
|
81062
81070
|
const rawModality = naturalData.Modality;
|
|
81063
81071
|
let modalityStr = "";
|
|
@@ -81067,7 +81075,7 @@ function collectMappings(inputFilePath, dicomData, mappingOptions) {
|
|
|
81067
81075
|
modalityStr = String(rawModality[0]);
|
|
81068
81076
|
}
|
|
81069
81077
|
const modality = modalityStr.trim().replace(/\W/g, "") || "OT";
|
|
81070
|
-
if (finalSpec.dicomPS315EOptions !== "Off") {
|
|
81078
|
+
if (!mappingOptions.skipModifications && finalSpec.dicomPS315EOptions !== "Off") {
|
|
81071
81079
|
deidentifyPS315E({
|
|
81072
81080
|
naturalData,
|
|
81073
81081
|
dicomPS315EOptions: finalSpec.dicomPS315EOptions,
|
|
@@ -81449,38 +81457,67 @@ async function curateOne({
|
|
|
81449
81457
|
if (canSkip && previousSourceFileInfo) {
|
|
81450
81458
|
return noMapResult();
|
|
81451
81459
|
}
|
|
81452
|
-
|
|
81453
|
-
|
|
81454
|
-
|
|
81455
|
-
|
|
81456
|
-
|
|
81457
|
-
|
|
81458
|
-
|
|
81459
|
-
|
|
81460
|
-
|
|
81461
|
-
|
|
81462
|
-
|
|
81463
|
-
|
|
81464
|
-
|
|
81465
|
-
|
|
81466
|
-
|
|
81467
|
-
|
|
81468
|
-
|
|
81469
|
-
|
|
81460
|
+
let mappedDicomData;
|
|
81461
|
+
let clonedMapResults;
|
|
81462
|
+
if (mappingOptions.curationSpec !== "none") {
|
|
81463
|
+
dcmjs7.log.setLevel(dcmjs7.log.levels.ERROR);
|
|
81464
|
+
dcmjs7.log.getLogger("validation.dcmjs").setLevel(dcmjs7.log.levels.SILENT);
|
|
81465
|
+
let dicomData;
|
|
81466
|
+
try {
|
|
81467
|
+
dicomData = dcmjs7.data.DicomMessage.readFile(fileArrayBuffer, {
|
|
81468
|
+
ignoreErrors: true
|
|
81469
|
+
});
|
|
81470
|
+
} catch (error2) {
|
|
81471
|
+
console.warn(
|
|
81472
|
+
`[dicom-curate] Could not parse ${fileInfo.name} as DICOM data:`,
|
|
81473
|
+
error2
|
|
81474
|
+
);
|
|
81475
|
+
const mapResults = {
|
|
81476
|
+
anomalies: [`Could not parse ${fileInfo.name} as DICOM data`],
|
|
81477
|
+
errors: [
|
|
81478
|
+
`File ${fileInfo.name} is not a valid DICOM file or is corrupted`
|
|
81479
|
+
],
|
|
81480
|
+
sourceInstanceUID: `invalid_${fileInfo.name.replace(/[^a-zA-Z0-9]/g, "_")}`,
|
|
81481
|
+
fileInfo: {
|
|
81482
|
+
name: fileInfo.name,
|
|
81483
|
+
size: fileInfo.size,
|
|
81484
|
+
path: fileInfo.path,
|
|
81485
|
+
mtime,
|
|
81486
|
+
preMappedHash,
|
|
81487
|
+
parseError: error2 instanceof Error ? error2.message : String(error2)
|
|
81488
|
+
},
|
|
81489
|
+
curationTime: performance.now() - startTime
|
|
81490
|
+
};
|
|
81491
|
+
return mapResults;
|
|
81492
|
+
}
|
|
81493
|
+
;
|
|
81494
|
+
({ dicomData: mappedDicomData, mapResults: clonedMapResults } = curateDict(
|
|
81495
|
+
`${fileInfo.path}/${fileInfo.name}`,
|
|
81496
|
+
dicomData,
|
|
81497
|
+
mappingOptions
|
|
81498
|
+
));
|
|
81499
|
+
clonedMapResults.mappingRequired = true;
|
|
81500
|
+
} else {
|
|
81501
|
+
mappedDicomData = {
|
|
81502
|
+
write: (...args) => fileArrayBuffer
|
|
81503
|
+
};
|
|
81504
|
+
clonedMapResults = {
|
|
81505
|
+
sourceInstanceUID: `passthrough_${fileInfo.name.replace(/[^a-zA-Z0-9]/g, "_")}`,
|
|
81506
|
+
mappings: {},
|
|
81507
|
+
anomalies: [],
|
|
81508
|
+
errors: [],
|
|
81509
|
+
quarantine: {},
|
|
81470
81510
|
fileInfo: {
|
|
81471
81511
|
name: fileInfo.name,
|
|
81472
81512
|
size: fileInfo.size,
|
|
81473
81513
|
path: fileInfo.path,
|
|
81474
81514
|
mtime,
|
|
81475
|
-
preMappedHash
|
|
81476
|
-
parseError: error2 instanceof Error ? error2.message : String(error2)
|
|
81515
|
+
preMappedHash
|
|
81477
81516
|
},
|
|
81478
|
-
|
|
81517
|
+
outputFilePath: `${fileInfo.path}/${fileInfo.name}`,
|
|
81518
|
+
mappingRequired: false
|
|
81479
81519
|
};
|
|
81480
|
-
return mapResults;
|
|
81481
81520
|
}
|
|
81482
|
-
const { dicomData: mappedDicomData, mapResults: clonedMapResults } = curateDict(`${fileInfo.path}/${fileInfo.name}`, dicomData, mappingOptions);
|
|
81483
|
-
clonedMapResults.mappingRequired = true;
|
|
81484
81521
|
if (!preMappedHash) {
|
|
81485
81522
|
try {
|
|
81486
81523
|
preMappedHash = await hash(fileArrayBuffer, hashMethod || "crc64");
|
|
@@ -87282,7 +87319,9 @@ function assertNoClosure(fn) {
|
|
|
87282
87319
|
|
|
87283
87320
|
// src/serializeMappingOptions.ts
|
|
87284
87321
|
function serializeMappingOptions(mappingOptions) {
|
|
87285
|
-
|
|
87322
|
+
if (typeof mappingOptions.curationSpec === "function") {
|
|
87323
|
+
assertNoClosure(mappingOptions.curationSpec);
|
|
87324
|
+
}
|
|
87286
87325
|
const { curationSpec, ...rest } = mappingOptions;
|
|
87287
87326
|
const curationSpecStr = curationSpec.toString();
|
|
87288
87327
|
return { ...rest, curationSpecStr };
|
|
@@ -87564,7 +87603,12 @@ async function collectMappingOptions(organizeOptions) {
|
|
|
87564
87603
|
outputTarget.directory = organizeOptions.outputDirectory;
|
|
87565
87604
|
}
|
|
87566
87605
|
const curationSpec = organizeOptions.curationSpec;
|
|
87567
|
-
|
|
87606
|
+
let additionalData;
|
|
87607
|
+
let deIdOpts = "Off";
|
|
87608
|
+
if (typeof curationSpec === "function") {
|
|
87609
|
+
;
|
|
87610
|
+
({ dicomPS315EOptions: deIdOpts, additionalData } = composeSpecs(curationSpec()));
|
|
87611
|
+
}
|
|
87568
87612
|
let columnMappings;
|
|
87569
87613
|
if (organizeOptions.table && additionalData) {
|
|
87570
87614
|
columnMappings = extractColumnMappings(
|
|
@@ -87649,8 +87693,16 @@ async function curateMany(organizeOptions, onProgress) {
|
|
|
87649
87693
|
);
|
|
87650
87694
|
if (organizeOptions.inputType === "directory" || organizeOptions.inputType === "path" || organizeOptions.inputType === "s3") {
|
|
87651
87695
|
const fileListWorker = await initializeFileListWorker();
|
|
87652
|
-
|
|
87653
|
-
|
|
87696
|
+
let specExcludedFiletypes;
|
|
87697
|
+
let noDicomSignatureCheck = false;
|
|
87698
|
+
let noDefaultExclusions = false;
|
|
87699
|
+
if (organizeOptions.curationSpec === "none") {
|
|
87700
|
+
noDicomSignatureCheck = true;
|
|
87701
|
+
noDefaultExclusions = true;
|
|
87702
|
+
} else {
|
|
87703
|
+
const curationSpec = composeSpecs(organizeOptions.curationSpec());
|
|
87704
|
+
specExcludedFiletypes = curationSpec.excludedFiletypes;
|
|
87705
|
+
}
|
|
87654
87706
|
const excludedPathRegexes = organizeOptions.excludedPathGlobs?.map(
|
|
87655
87707
|
(glob) => import_picomatch.default.makeRe(glob).source
|
|
87656
87708
|
);
|
|
@@ -87660,6 +87712,8 @@ async function curateMany(organizeOptions, onProgress) {
|
|
|
87660
87712
|
directoryHandle: organizeOptions.inputDirectory,
|
|
87661
87713
|
excludedFiletypes: specExcludedFiletypes,
|
|
87662
87714
|
excludedPathRegexes,
|
|
87715
|
+
noDicomSignatureCheck,
|
|
87716
|
+
noDefaultExclusions,
|
|
87663
87717
|
fileInfoIndex: organizeOptions.fileInfoIndex
|
|
87664
87718
|
});
|
|
87665
87719
|
} else if (organizeOptions.inputType === "s3") {
|
|
@@ -87668,7 +87722,9 @@ async function curateMany(organizeOptions, onProgress) {
|
|
|
87668
87722
|
bucketOptions: organizeOptions.inputS3Bucket,
|
|
87669
87723
|
excludedFiletypes: specExcludedFiletypes,
|
|
87670
87724
|
excludedPathRegexes,
|
|
87671
|
-
fileInfoIndex: organizeOptions.fileInfoIndex
|
|
87725
|
+
fileInfoIndex: organizeOptions.fileInfoIndex,
|
|
87726
|
+
noDicomSignatureCheck,
|
|
87727
|
+
noDefaultExclusions
|
|
87672
87728
|
});
|
|
87673
87729
|
} else {
|
|
87674
87730
|
fileListWorker.postMessage({
|
|
@@ -87676,7 +87732,9 @@ async function curateMany(organizeOptions, onProgress) {
|
|
|
87676
87732
|
path: organizeOptions.inputDirectory,
|
|
87677
87733
|
excludedFiletypes: specExcludedFiletypes,
|
|
87678
87734
|
excludedPathRegexes,
|
|
87679
|
-
fileInfoIndex: organizeOptions.fileInfoIndex
|
|
87735
|
+
fileInfoIndex: organizeOptions.fileInfoIndex,
|
|
87736
|
+
noDicomSignatureCheck,
|
|
87737
|
+
noDefaultExclusions
|
|
87680
87738
|
});
|
|
87681
87739
|
}
|
|
87682
87740
|
} else if (organizeOptions.inputType === "files") {
|