DICOM影像上传过程中,对于匿名字段,只有文件存在时才需要匿名,如果文件本身不存在需要匿名DICOM元素,则不需要做匿名字段
continuous-integration/drone/push Build is running Details

main
wangxiaoshuang 2025-07-29 14:40:43 +08:00
parent 4f7a308cf1
commit 3d096f397f
1 changed files with 4 additions and 2 deletions

View File

@ -15,6 +15,7 @@ export const anonymization = function (file, config) {
let dataset = dcmjs.data.DicomMessage.readFile(buffer)
for (var i = 0; i < AnonymizeFixedList.length; i++) {
let AnonymizeFixed = AnonymizeFixedList[i]
if (!dataset.dict.hasOwnProperty(`${AnonymizeFixed.Group + AnonymizeFixed.Element}`)) continue
if (dataset.dict[AnonymizeFixed.Group + AnonymizeFixed.Element]) {
dataset.dict[AnonymizeFixed.Group + AnonymizeFixed.Element].Value[0] = AnonymizeFixed.ReplaceValue
} else {
@ -28,6 +29,7 @@ export const anonymization = function (file, config) {
}
for (var i = 0; i < AnonymizeNotFixedList.length; i++) {
let AnonymizeNotFixed = AnonymizeNotFixedList[i]
// if (!dataset.dict.hasOwnProperty(`${AnonymizeNotFixed.Group + AnonymizeNotFixed.Element}`)) continue
if (AnonymizeNotFixed.Group + AnonymizeNotFixed.Element === '00100020') {
console.log(`${DicomStoreInfo.TrialCode}_${DicomStoreInfo.SubjectCode}`)
if (dataset.dict[AnonymizeNotFixed.Group + AnonymizeNotFixed.Element]) {
@ -53,9 +55,9 @@ export const anonymization = function (file, config) {
}
}
}
// console.log(dataset)
try {
let newDicomFile = dataset.write()
let newDicomFile = dataset.write({ fragmentMultiframe: false }) // fragmentMultiframe 原始数据是否进行分割
const bufferArray = new Uint8Array(newDicomFile)
const blob = new Blob([bufferArray], { type: 'application/octet-stream' })
resolve({ blob, pixelDataElement })