The Java crashed when attempting
opening dicom file whether using Weasis, dcm2txt or other dcm4che
utilities.
It took me some time to figure out solution which I
would like to share with others.
This is an output from
dcm2txt
...
2332:(0029,0010) LO #18 [SIEMENS CSA HEADER]
Private Creator Data Element
2362:(0029,0011) LO #22 [SIEMENS
MEDCOM HEADER] Private Creator Data Element
2396:(0029,1008) UN #6
[SOM 5 ] ?
2414:(0029,1009) UN #12 [VA10A 971201]
?
2438:(0029,1010) UN #640
[\00\00\04\00LT\0A\001\004\004\005\000\00\00\00\05\00
3090:(0029,1140)
UN #-1 ?
3102:>(FFFE,E000) #-1 Item
3110:>(0029,0010) LO
#20053 [ SIEMENS MEDCOM HEADER )A UN
SOM 5 TPOS)
dcm2txt:
Failed to dump /home/janusz/tmp/17/DCM/S0001/SE0001/IM00001:
null
java.io.EOFException
at
org.dcm4che2.io.DicomInputStream.readFully(DicomInputStream.java:351)
at
org.dcm4che2.io.DicomInputStream.readBytes(DicomInputStream.java:651)
...
The
same happen with other Java program DicomBrowser.
The
file can be opened with gdcmdump, gdcmraw or gdcmconv linux utility
and more when converted by gdcmconv easily opened by Weasis or other
dcm4che utilities.
Since gdcmconv uses only single file name I
propose to run python script:
import os
import
subprocess
output_dir = "/home/janusz/tmp2"
source_dir
= "/home/janusz/tmp1"
for root, dirs, files in
os.walk(source_dir):
for name in files:
file = name
ext = root
extfile =
ext.replace("/", ".")
subprocess.call(["gdcmconv" , "-i" , ext+"/"+file
, "-o" , output_dir+"/C"+extfile+"."+file])
print(extfile)
print('Job done.')