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

Add code back in to fix tlrc issue #6

Open
cgc opened this issue Mar 9, 2017 · 0 comments
Open

Add code back in to fix tlrc issue #6

cgc opened this issue Mar 9, 2017 · 0 comments

Comments

@cgc
Copy link
Contributor

cgc commented Mar 9, 2017

Some images are interpreted as tlrc-space by AFNI (whether they are or not), but this script assumes inputs will be orig-space. We need to force input headers to orig-space to avoid this issue. The script below accomplishes this.

'''
Usage:
python fix-headers.py input.nii.gz output.nii.gz
'''
import nibabel as nib
import sys

image = nib.load(sys.argv[1])

for key in ['qform_code', 'sform_code']:
    if image.header[key] == 2:
        image.header[key] = 1

nib.save(image, sys.argv[2])
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