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 to surface does not work #4

Closed
seralouk opened this issue Mar 19, 2021 · 2 comments
Closed

Nifti to surface does not work #4

seralouk opened this issue Mar 19, 2021 · 2 comments

Comments

@seralouk
Copy link

Hello,

First of all, thanks for this amazing repo.

I have a 3D nifti file that I would like to project to the fsaverage surface for a nice visualization output.
My nifti file is already in MNI space.

I have tried the following but the output an empty nii.gz files.

lh, rh = vol_to_fsaverage("/Users/makis/Desktop/stat_map.nii", 'output', template_type='MNI152_orig')

How can I solve this issue?

Data:https://easyupload.io/260ldc
Pass: makis

@danjgale
Copy link
Owner

Hi @seralouk,

Thanks for opening this issue and providing the data. I tested this out with the CLI and vol_to_fsaverage and tried to replicate your problem, but couldn't. Here are the commands I ran:

CLI:
regfusion -s stat_map.nii -o output

And with vol_to_fsaverage:
lh, rh = vol_to_fsaverage("stat_map.nii", 'output', template_type='MNI152_orig')

The output viewed in freeview:

Screenshot from 2021-03-20 11-41-02

So, it seems to be working as expected on my end. I'm running this on a Linux machine (Ubuntu 20.04).

However, when checked your file I noticed it included several NaNs, which were also flagged by freeview (18542 vertices in the left hemisphere, 17465 vertices in the right hemisphere). Perhaps replacing NaNs in your file might resolve things on your end?

@danjgale
Copy link
Owner

danjgale commented Mar 20, 2021

I noticed in the above figure that the sign has been swapped (i.e negative voxels are positive vertices on the surface, and vice versa). This was true even after replacing NaNs with 0.

I checked with two other stat maps I have, each created using different software (nilearn and SPM) and the projections were correct (no sign flipping). So this issue seems to be specific to your file.

As a temporary fix, you could a) replace the NaNs with 0, and b) flip the sign of voxels stat_map.nii so that they would be correct on the surface. Not sure what is causing this issue that is specific to your file.

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

2 participants