上传dicom文件处理
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
10a2238cba
commit
10283bbceb
|
@ -68,6 +68,8 @@ let dicom = {
|
||||||
};
|
};
|
||||||
// 需要设置默认值
|
// 需要设置默认值
|
||||||
let defaultKey = ['Rows', 'Columns', 'SliceLocation', 'NumberOfFrames'];
|
let defaultKey = ['Rows', 'Columns', 'SliceLocation', 'NumberOfFrames'];
|
||||||
|
let uintKey = ['Rows', 'Columns'];
|
||||||
|
let intStringKey = ['SliceLocation', 'NumberOfFrames'];
|
||||||
// 需要格式解析
|
// 需要格式解析
|
||||||
let pormatParseKey = ['PatientName', 'SeriesDescription', 'StudyDescription'];
|
let pormatParseKey = ['PatientName', 'SeriesDescription', 'StudyDescription'];
|
||||||
// 解析dicom文件
|
// 解析dicom文件
|
||||||
|
@ -81,28 +83,19 @@ export const parseDicom = (file, name = false) => {
|
||||||
if (name && Array.isArray(name)) {
|
if (name && Array.isArray(name)) {
|
||||||
name.forEach((item) => {
|
name.forEach((item) => {
|
||||||
if (dicom[item]) {
|
if (dicom[item]) {
|
||||||
res[item] = data.string(dicom[item]) || data.uint16(dicom[item]) || data.intString(dicom[item]) || '';
|
res[item] = data.string(dicom[item]) || '';
|
||||||
}
|
|
||||||
if (item === 'SliceLocation') {
|
|
||||||
res[item] = data.intString(dicom[item])
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (name) {
|
} else if (name) {
|
||||||
if (dicom[name]) {
|
if (dicom[name]) {
|
||||||
res[name] = data.string(dicom[name]) || data.uint16(dicom[name]) || data.intString(dicom[name]) || '';
|
res[name] = data.string(dicom[name]) || '';
|
||||||
if (name === 'SliceLocation') {
|
|
||||||
res[name] = data.intString(dicom[name])
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
console.log("name is inexistence");
|
console.log("name is inexistence");
|
||||||
resolve(false)
|
resolve(false)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Object.keys(dicom).forEach((key) => {
|
Object.keys(dicom).forEach((key) => {
|
||||||
res[key] = data.string(dicom[key]) || data.uint16(dicom[key]) || data.intString(dicom[key]) || '';
|
res[key] = data.string(dicom[key]) || '';
|
||||||
if (key === 'SliceLocation') {
|
|
||||||
res[key] = data.intString(dicom[key])
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
pormatParseKey.forEach(key => {
|
pormatParseKey.forEach(key => {
|
||||||
|
@ -119,6 +112,12 @@ export const parseDicom = (file, name = false) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
uintKey.forEach(key => {
|
||||||
|
res[key] = data.uint16(dicom[key])
|
||||||
|
})
|
||||||
|
intStringKey.forEach(key => {
|
||||||
|
res[key] = data.intString(dicom[key])
|
||||||
|
})
|
||||||
defaultKey.forEach(key => {
|
defaultKey.forEach(key => {
|
||||||
if (!res[key] && res.hasOwnProperty(key)) {
|
if (!res[key] && res.hasOwnProperty(key)) {
|
||||||
res[key] = 0;
|
res[key] = 0;
|
||||||
|
|
Loading…
Reference in New Issue