最近老板提出了一个新的功能要求,希望可以把图片转成dcm,在实现功能的问题中遇见了很多问题和掉过许多坑。于是在此记录下来。
问题:第一次在进行Jpg2Dcm时,可以进行图片转dcm,但是出现中文乱码 乱码的原因在于我使用的是dcm4che-tool-jpg2dcm-3.3.7.jar版本的jar包 通过查看class文件,发现该jar编码值默认设 定为ISO_IR 100,所以中文显示乱码 解决办法: 1.将dcm4che-tool-jpg2dcm-3.3.7.jar替换为dcm4che-tool-dcm2jpg-5.19.0.jar 2.将commons-cli-1.2.jar替换为commons-cli-1.4.jar 3.在encapsulatedPDFMetadata.xml中加入 GB1808支持中文显示
最后转码成功,中文正常显示 secondaryCaptureImageMetadata.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><NativeDicomModel xml-space="preserved"> <DicomAttribute keyword="PatientName" tag="00100010" vr="PN"> <PersonName number="1"> <Alphabetic> <FamilyName>这是一条测试数据</FamilyName> </Alphabetic> </PersonName> </DicomAttribute> <DicomAttribute keyword="PatientID" tag="00100020" vr="LO"> <Value number="1">20191205112600000053</Value> </DicomAttribute> <DicomAttribute keyword="PatientBirthDate" tag="00100030" vr="DA"> <Value number="1">20080822</Value> </DicomAttribute> <DicomAttribute keyword="PatientSex" tag="00100040" vr="CS"> <Value number="1">0000</Value> </DicomAttribute> <DicomAttribute keyword="IssuerOfPatientID" tag="00100021" vr="LO"> <Value number="1">041G04:20061118:120819573:001183</Value> </DicomAttribute> <DicomAttribute keyword="StudyInstanceUID" tag="0020000D" vr="UI"> <Value number="1">1.2.3.4.5.6.7.8.9.11.1573094135199</Value> </DicomAttribute> <DicomAttribute keyword="StudyDate" tag="00080020" vr="DA"> <Value number="1">20080729</Value> </DicomAttribute> <DicomAttribute keyword="StudyTime" tag="00080030" vr="TM"> <Value number="1">125554.000000</Value> </DicomAttribute> <DicomAttribute keyword="ReferringPhysicianName" tag="00080090" vr="PN"> <PersonName number="1"> <Alphabetic> <FamilyName>JANE</FamilyName> <GivenName>DOE</GivenName> </Alphabetic> </PersonName> </DicomAttribute> <DicomAttribute keyword="StudyID" tag="00200010" vr="SH"> <Value number="1">333111</Value> </DicomAttribute> <DicomAttribute keyword="AccessionNumber" tag="00080050" vr="SH"> <Value number="1">A10003204947</Value> </DicomAttribute> <DicomAttribute keyword="StudyDescription" tag="00081030" vr="LO"> <Value number="1">CAT SCAN CARDIAC</Value> </DicomAttribute> <DicomAttribute keyword="Modality" tag="00080060" vr="CS"> <Value number="1">CT</Value> </DicomAttribute> <DicomAttribute keyword="SeriesInstanceUID" tag="0020000E" vr="UI"> <Value number="1">1.2.3.4.5.6.7.8.9.11.1573094135299.1</Value> </DicomAttribute> <DicomAttribute keyword="Manufacturer" tag="00080070" vr="LO"> <Value number="1">SomeManufacturer</Value> </DicomAttribute> <DicomAttribute keyword="InstanceNumber" tag="00200013" vr="IS"> <Value number="1">1000</Value> </DicomAttribute> <DicomAttribute keyword="SOPClassUID" tag="00080016" vr="UI"> <Value number="1">1.2.840.10008.5.1.4.1.1.2</Value> </DicomAttribute> <DicomAttribute keyword="SOPInstanceUID" tag="00080018" vr="UI"> <Value number="1">1.2.3.4.5.6.7.8.9.11.1575516413577</Value> </DicomAttribute> <DicomAttribute keyword="SpecificCharacterSet" tag="00080005" vr="CS"> <!-- GB18030 --> <Value number="1">GB18030</Value> </DicomAttribute> </NativeDicomModel>