-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EOFError: read end of file #33
Comments
I was able to reproduce the error. There's two reasons why the files couldn't be parsed: (i) there was a bug in the package and (ii) the images are JPEG-compressed. The pending pull request should resolve the bug.
and then navigating to the dev directory and pulling the
With the above fix, those DICOM files can be parsed, but the pixel data will be incorrect because this package does not support JPEG-compressed images. These can be decompressed by using an external tool. For reference, I'm including the code that I used to test it out along with a screengrab of the plotted image. The pixel data will likely have to be flipped/transposed to get the right orientation. # The folder containing the DICOM files
datafolder = joinpath(pwd(), "sample.images")
# Get the filenames of only the dicom files
datafiles = readdir(datafolder)
isDICOM = [splitext(file)[2]==".dcm" for file in datafiles]
dicomfiles = datafiles[isDICOM]
# Use GDCM to decompress the dicom files
outfolder = joinpath(pwd(), "samples.images.decompressed")
mkdir(outfolder) # [!] assumes outfolder doesn't exist
for file in dicomfiles
inputfile = joinpath(datafolder, file)
outputfile = joinpath(outfolder, file)
run(`gdcmconv --raw $inputfile $outputfile`)
end
# Pick any of the decompressed files and parse it
using DICOM
chosenfile = joinpath(outfolder, dicomfiles[1])
dicomdata = dcm_parse(chosenfile)
# Display the pixel data from the parsed file
using Plots
gr()
pixeldata = dicomdata[tag"Pixel Data"]
heatmap(pixeldata, aspect_ratio=1, color=:grays) |
WOW, thanks a lot! |
I got some DICOM images from a Kaggle competition and tried parsing one of them in Julia but got this error:
Am I doing something wrong or is this reproducible?
sample images.zip
Versioninfo:
The text was updated successfully, but these errors were encountered: