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

The left and right hemisphere seems to be flipped after projected from MNI volume to surface #300

Open
travis827 opened this issue Apr 12, 2021 · 6 comments

Comments

@travis827
Copy link

Hi,
I used on macOS (10.12) with Jupiter notebook (python ver 3.8.5). The pysurfer version is 0.11.0. I tried to project the MNI volume result into the surface. But the surface plots for the left and right hemispheres seem to be flipped after the projection (compared with AFNI volume and surface plots). The code is below:

from surfer import Brain, project_volume_data, io
import os
brain=Brain('fsaverage','split','inflated',views=['lateral','ven'], background='white')
data_file='path/hmr4K_aligned3d_perm_p001.nii.gz'
reg_file=os.path.join(os.environ["FREESURFER_HOME"],"average/mni152.register.dat")
ds_lh=project_volume_data(data_file, "lh", reg_file, smooth_fwhm=3)
ds_rh=project_volume_data(data_file, "rh", reg_file, smooth_fwhm=3)
brain.add_data(ds_lh,hemi='lh',min=1.65, max=3)
brain.add_data(ds_rh,hemi='rh',min=1.65, max=3)

The surface plot seems to be left/ right hemisphere flipped, compared with afni volume and surface plot. Could I know the reason for this issue? Many thanks!

The MNI volume data is here:
hmr4K_aligned3d_perm_p001.nii.gz

@mwaskom
Copy link
Member

mwaskom commented Apr 14, 2021

Did you normalize your data with AFNI? They might have a different L/R orientation convention than Freesurfer uses in the registration file you're supplying.

@travis827
Copy link
Author

Thanks. Yes, we did normalize the data before doing the representational similarity analysis using CosMoMVPA. Could I know how to get the correct L/R orientation? Or which registration file should I use? Many thanks!

@travis827
Copy link
Author

Did you normalize your data with AFNI? They might have a different L/R orientation convention than Freesurfer uses in the registration file you're supplying.

Any thoughts? How could I get the correct L/R hemisphere? Many thanks!

@travis827 travis827 reopened this Apr 16, 2021
@mwaskom
Copy link
Member

mwaskom commented Apr 16, 2021

Sorry, I assumed that you closed the issue because you figured it out yourself.

This orientation business is tricky, and it's been a while since I've engaged with it deeply, and I've never used AFNI.

The registration file that Freesurfer ships is, I believe, specifically designed to put the FSL MNI template in register with fsaverage. You'd think that the definition of the common space would be invariant across packages, but it might not be — there's a lot of arbitrariness.

If I were debugging this, I would probably look at what mri_info says about the affine matrices stored in the template image you used, and compare that to the FSL mni152 template (which I think Freesurfer packages if you don't have FSL, but I'm not certain).

AFNI may also supply a registration file to align its template space with fsaverage, or you might be able to use AFNI's common-space surfaces in PySurfer (provided that they are laid out in a freesurfer-style directory structure).

Someone else who has thought about MRI image registration more recently may also weigh in...

@travis827
Copy link
Author

I plotted the prf angle result (left and right hemisphere V1 represents the right and left visual fields), and the result plotted by pysurfer seems to be left/right flipped.
Could I know how to flip the left/right hemisphere in Pysurfer? I tried to change the affine matrix of the MNI result, from
( 1 0 0 -92,
0 1 0 -127,
0 0 1 -73,
0 0 0 1)
to
( -1 0 0 92,
0 1 0 -127,
0 0 1 -73,
0 0 0 1).
But the plotted surface seems to be still flipped. I also tried to change the 'lh/rh' parameter in surfer.project_volume_data(data_file, 'lh', reg_file). But the result is weird.
Because I would like to use the atlas annotation labels (HCPMM1 atlas), the left/right asymmetry might cause some mistakes.
If I use the default register matrix (os.environ["FREESURFER_HOME"],"average/mni152.register.dat"), how could I shift the left/right? Many thanks!

@mwaskom
Copy link
Member

mwaskom commented May 2, 2021

I think I would suggesting trying to create a surface file within the software ecosystem that you are otherwise processing your imaging data in. Then you can just read that into PySurfer and plot it however you want.

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