-
Notifications
You must be signed in to change notification settings - Fork 262
discrepancy in writing/reading CIFTI #603
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
Comments
it also needs to be added that a cifti file from hcp is loaded fine by |
What's the intent code of your image? nibabel/nibabel/cifti2/parse_cifti2.py Lines 83 to 93 in e48b746
Try: img = nb.cifti2.load('test.dtseries.nii')
nb.cifti2._parse_cifti2._Cifti2AsNiftiHeader(img.header).get_intent('code') You may need to tweak that line to observe the right result, but I think that's likely to be the check that's failing. |
an hcp file:
our generated file:
|
aha - so that's what needs to be set. |
I see. So we're not exposing some necessary NIFTI functionality through This may require some thinking about how to properly provide access to both the binary and XML portions of the header, but in the short term, you should be able to take your |
however, there is |
Ah. I guess that was the API that was settled on way back when. @mgxd, does using |
Looks good, I'll update the tests to include this. |
Hi there, I want to save the values of the ciftifile (voxels values) in a matrix. I can read the file with the command Thanks a lot and have a nice day, Aldo |
I solved my problem using the following commands: new_img = nib.Cifti2Image(np.transpose(matrix), header=img.header, nifti_header=img.nifti_header) |
Sorry I missed this before. I would recommend creating a new issue rather than posting to a closed thread. When you do, could you provide your full code, with what your inputs are and what you're trying to do? |
I'm using data from Nifti/Gifti files to generate a
Cifti2Image
- my approach is inspired bynibabel/nibabel/cifti2/tests/test_new_cifti2.py
Lines 206 to 217 in e48b746
This outputs a seemingly fine CIFTI file, which is successfully interpreted as a
Cift2Image
when opened withnibabel.cifti2.load
, but when usingnibabel.load
it is interpreted as aNifti2Image
instead.Here's the sniff of the test-generated image I grabbed while debugging
Making of note of this here as it will require a bit more inspection.
The text was updated successfully, but these errors were encountered: