Skip to content
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

nifti header 'descrip' field returns as zero-d array with bytes #22

Open
arokem opened this issue Mar 19, 2015 · 1 comment
Open

nifti header 'descrip' field returns as zero-d array with bytes #22

arokem opened this issue Mar 19, 2015 · 1 comment

Comments

@arokem
Copy link
Member

arokem commented Mar 19, 2015

This doesn't matter for python 2 uses, but in python 3, you can get things like:

hdr['descrip'].item().split(';')
    ---------------------------------------------------------------------------
    TypeError                                 Traceback (most recent call last)
    <ipython-input-42-a30eaa7f7322> in <module>()
    ----> 1 hdr['descrip'].item().split(';')

    TypeError: 'str' does not support the buffer interface

It's possible to cast this object to a str, but that's a bit sketchy:

str(aa.item())

    "b'te=5.63;ti=0;fa=20;ec=0.0000;acq=[128,128];mt=0;rp=1.0;ves=0.859437;ve=50'"
@arokem
Copy link
Member Author

arokem commented Mar 19, 2015

One solution that works for me right now is to call:

hdr['descrip'].decode('utf-8')

on the resulting description field, but maybe this should be pushed into the creation of this field?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant