文件上传失败检测
continuous-integration/drone/push Build is passing Details

uat_us
wangxiaoshuang 2024-06-26 17:14:25 +08:00
parent 64a0e68448
commit bb6bf409b7
1 changed files with 11 additions and 6 deletions

View File

@ -1,6 +1,6 @@
import dicomParser from "dicom-parser"; import dicomParser from "dicom-parser";
import dcmjs from './dcmjs' import dcmjs from './dcmjs'
import {encoder} from "./encoder"; import { encoder } from "./encoder";
export const anonymization = function (file, config) { export const anonymization = function (file, config) {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
@ -32,7 +32,7 @@ export const anonymization = function (file, config) {
if (AnonymizeNotFixed.Group + AnonymizeNotFixed.Element === '00100020') { if (AnonymizeNotFixed.Group + AnonymizeNotFixed.Element === '00100020') {
console.log(`${DicomStoreInfo.TrialCode}_${DicomStoreInfo.SubjectCode}`) console.log(`${DicomStoreInfo.TrialCode}_${DicomStoreInfo.SubjectCode}`)
if (dataset.dict[AnonymizeNotFixed.Group + AnonymizeNotFixed.Element]) { if (dataset.dict[AnonymizeNotFixed.Group + AnonymizeNotFixed.Element]) {
dataset.dict[AnonymizeNotFixed.Group + AnonymizeNotFixed.Element].Value[0] = `${DicomStoreInfo.TrialCode}-${DicomStoreInfo.SubjectCode}` dataset.dict[AnonymizeNotFixed.Group + AnonymizeNotFixed.Element].Value[0] = `${DicomStoreInfo.TrialCode}-${DicomStoreInfo.SubjectCode}`
} else { } else {
dataset.dict[AnonymizeNotFixed.Group + AnonymizeNotFixed.Element] = { dataset.dict[AnonymizeNotFixed.Group + AnonymizeNotFixed.Element] = {
vr: AnonymizeNotFixed.ValueRepresentation, vr: AnonymizeNotFixed.ValueRepresentation,
@ -55,10 +55,15 @@ export const anonymization = function (file, config) {
} }
} }
// console.log(dataset) // console.log(dataset)
let newDicomFile = dataset.write() try {
const bufferArray = new Uint8Array(newDicomFile) let newDicomFile = dataset.write()
const blob = new Blob([bufferArray], { type: 'application/octet-stream' }) const bufferArray = new Uint8Array(newDicomFile)
resolve({blob, pixelDataElement}) const blob = new Blob([bufferArray], { type: 'application/octet-stream' })
resolve({ blob, pixelDataElement })
} catch (err) {
console.log(err)
resolve(false);
}
}; };
reader.readAsArrayBuffer(file); reader.readAsArrayBuffer(file);
} catch (e) { } catch (e) {