[Neuroimaging] [nibabel] reading corrupt *.nii.gz files
Dimitri Papadopoulos Orfanos
dimitri.papadopoulos at cea.fr
Thu Oct 1 12:22:58 CEST 2015
Hi Matthew,
Le 30/09/2015 21:29, Matthew Brett a écrit :
> [...]
> Would the friendly error be much different from the unfriendly one
> though? I guess it would just be something like 'Error reading
> compressed image data : Error -3 while decompressing: invalid code
> lengths set' ?
> [...]
I was thinking of intercepting this specific error -3 (Z_DATA_ERROR) and
emitting a message such as:
Error reading compressed image data: the compressed file is corrupted,
most probably truncated (zlib reports: invalid code lengths set).
The zlib documentation (http://www.zlib.net/manual.html) reads:
inflate() returns [...] Z_DATA_ERROR if the input data
was corrupted (input stream not conforming to the zlib
format or incorrect check value) [...] If Z_DATA_ERROR
is returned, the application may then call inflateSync()
to look for a good compression block if a partial
recovery of the data is desired.
Best,
Dimitri
More information about the Neuroimaging
mailing list