-
-
Notifications
You must be signed in to change notification settings - Fork 471
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
Default read_size in read_undefined_length_value() in fileutil.py is too small and slows down reading large DICOM files #436
Comments
There is a somewhat related issue (#139), which deals with reading pixel data via |
I'm +1. I'm not sure where the original 128 came from, certainly higher makes more sense. And mmap sounds good, but is there a performance hit for reading the whole file that way? Or is it reasonable to open only when needing to read larger values and skip to the right offset? How does an mmap solution handle reading a set of dicom files and dealing with the values after the file is closed? |
Maybe we could just change the default size for now (4096 would be my pick), and handle the |
Experiments using the same SSD above, this time with a smaller file (15MB). Can we go for 8KB? Will send a PR
|
read_undefined_length_value() has a default read size of 128 bytes.
This gets called once when reading large files with large amounts of PixelData (e.g. 70MB) causes it to take ~2s to open file. When changing to say 1024, or 8192 speeds up dramatically.
E.g a 69 MB file, loaded from a Samsung EVO 830 SSD via USB3.
What do you think the default should be?
Actually, it is a shame that in python opening a file as binary e.g.
doesn't give you a find function i.e.
f.find()
and we have to do this awkward read, check for EOF, read again in case, append, find etc.
If you read it as
you get a find function on file_m and it saves you all this code, and is much faster.
I have patched my local version to use mmap; but don't know if this is a reasonable thing for mainline.
Matt
The text was updated successfully, but these errors were encountered: