|
@@ -2,7 +2,7 @@ const parser = require('dicom-parser');
|
|
|
const fsp = require('fs-promise');
|
|
|
const iconv = require("iconv-lite")
|
|
|
|
|
|
-const filePath = '/Users/fuyu/Desktop/MR/MR1912090041/1.2.392.200036.9125.2.138612190166.20191209000532/816190C2/8A40E178.dcm';
|
|
|
+const filePath = '/Users/fuyu/DX/837DCB82.dcm';
|
|
|
// const filePath = '/Users/fuyu/Desktop/MR/MR1912090041/1.2.392.200036.9125.2.138612190166.20191209000532/517D6718/7F8E6EC3.dcm';
|
|
|
// const filePath = '/Users/fuyu/Downloads/5805957747722467ffe1bbbf31e81a1c';
|
|
|
// const filePath = '/Users/fuyu/Downloads/d1137941cbce83e442eb2978989d059c';
|
|
@@ -13,12 +13,16 @@ let test = async url => {
|
|
|
|
|
|
const fileBuffer = await fsp.readFile(url);
|
|
|
const dataSet = parser.parseDicom(fileBuffer);
|
|
|
+ const patientName = dataSet.string(patientTag.patientName)
|
|
|
+ // console.log(iconv.decode(patientName, 'UTF-8'))
|
|
|
+ const charset = getCharSet(dataSet)
|
|
|
+ console.log(patientName, iconv.decode(patientName, 'GB2312'), charset)
|
|
|
// console.log(dataSet.string('x00080005'));
|
|
|
- [patientTag, studyTag, seriesTag, imageTag].forEach(tags => {
|
|
|
- for (let key in tags) {
|
|
|
- console.log(key, dataSet.string(tags[key]))
|
|
|
- }
|
|
|
- })
|
|
|
+ // [patientTag, studyTag, seriesTag, imageTag].forEach(tags => {
|
|
|
+ // for (let key in tags) {
|
|
|
+ // console.log(key, dataSet.string(tags[key]))
|
|
|
+ // }
|
|
|
+ // })
|
|
|
|
|
|
// const charset = getCharSet(dataSet)
|
|
|
|
|
@@ -56,8 +60,8 @@ const chatSetMap = {
|
|
|
}
|
|
|
const getCharSet = dataSet => {
|
|
|
let specificCharacterSet = dataSet.string('x00080005');
|
|
|
+ console.log(specificCharacterSet, 'specificCharacterSet')
|
|
|
let charset = 'GB2312'
|
|
|
- console.log('specificCharacterSet', specificCharacterSet)
|
|
|
if (specificCharacterSet) {
|
|
|
charset = chatSetMap[specificCharacterSet] || charset
|
|
|
}
|