-
Notifications
You must be signed in to change notification settings - Fork 51
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
error reading and writing large gzip-compressed images #21
Comments
Interesting, thanks for reporting. I'm not yet sure how to resolve this. |
This fixes issue #21. It does so by reading and writing data in chunks. Another change is that the zlib module is now used instead of the gzip module simplifing the code somewhat. Incidentally, this also fixes that writing nrrd files with bzip2 encoding was broken.
It turns out resolving this was not too hard. I'll wait a few days before doing a version bump on PyPi. @dyf, thanks again for reporting. |
That's great, thanks! On Dec 20, 2015 8:47 AM, Maarten Everts notifications@github.com wrote: It turns out resolving this was not too hard. I'll wait a few days before doing a version bump on PyPi. @dyfhttps://github.com/dyf, thanks again for reporting. Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-166134607. |
When reading and writing images with gzip compression, the gzip library does a 32-bit CRC check. This fails when the image array is larger than what can be represented with 32-bit precision.
Here's the traceback for reading:
Traceback (most recent call last):
File "run_all_image_series.py", line 60, in
if name == "main": main()
File "run_all_image_series.py", line 53, in main
density, meta = nrrd.read( density_file )
File "/shared/utils.x86_64/python-2.7/lib/python2.7/site-packages/nrrd.py", line 366, in read
data = read_data(header, filehandle, filename)
File "/shared/utils.x86_64/python-2.7/lib/python2.7/site-packages/nrrd.py", line 264, in read_data
data = np.fromstring(gzipfile.read(), dtype)
File "/shared/utils.x86_64/python-2.7/lib/python2.7/gzip.py", line 261, in read
self._read(readsize)
File "/shared/utils.x86_64/python-2.7/lib/python2.7/gzip.py", line 320, in _read
self._add_read_data( uncompress )
File "/shared/utils.x86_64/python-2.7/lib/python2.7/gzip.py", line 336, in _add_read_data
self.crc = zlib.crc32(data, self.crc) & 0xffffffffL
OverflowError: size does not fit in an int
A very similar error occurs on write.
The text was updated successfully, but these errors were encountered: