[pymvpa] NiftiImage from stream or string object

Michael Hanke michael.hanke at gmail.com
Fri Mar 27 05:44:59 UTC 2009


On Thu, Mar 26, 2009 at 03:26:47PM -0700, James Kyle wrote:
> I've run into something that I need a bit of clarification on in the  
> NiftiImage lib. Specifically in the updateNiftiHeaderFromDict method.
>
> Line 238 of utils.py throws an exception if the data_type field is > 9. 
> From my reading of the nifti spec and parsing of the raw header file, 
> this field appears to be a char[10]. (char data_type[10]).
>
> Where'd the other byte go?

I'm not exactly sure why I did that, but I suspect it was because of the
'\0' appendix of strings in C. If the Python string has 10 elements it
would probably need 11 in a C representation and hence writting it to
the header probably corrupts it (unless special care is taken) -- I
might be wrong.

Is this critical? If you need to store more information, you might want
to consider a header extension.


Michael
-- 
GPG key:  1024D/3144BE0F Michael Hanke
http://apsy.gse.uni-magdeburg.de/hanke
ICQ: 48230050



More information about the Pkg-ExpPsy-PyMVPA mailing list