dprice80 / mni2fs

MNI2FS: Surface Rendering of MNI Space Volumes for MATLAB
GNU General Public License v3.0
15 stars 6 forks source link

LH plotted as RH and vice-versa #3

Closed espressofiend closed 6 years ago

espressofiend commented 6 years ago

Hi

Great package! However, when I plot data that were generated with FSL, the functional data from the right hemisphere are plotted on the surface of the LH, and vice-versa. I'm suspecting this may be related to long-standing differences between how SPM and FSL encode the data, if you've developed the package based on SPM files. But there might be other reasons. Regardless, the data get plotted ot the opposite hemisphere using mni2fs than using other packages like fslview or mricroGL.

At any rate, to reproduce the issue, you can use this script: http://gofile.me/2NHQ0/8jVC2jk4Q with this nifti file: http://gofile.me/2NHQ0/ATUvAJjRq

thanks in advance

dprice80 commented 6 years ago

Hi

Thanks for reporting this.

It shouldn't matter which software generates the data. MNI2FS plots the data purely in MNI coordinate space, so the slice order should not matter. Basically, the coordinates are taken from the colin27 brain template (which is not in any particular format - it's just a bunch of coordinates) and used as a cookie cutter on whichever image you happen to input.

Would you mind sending the me the file /study_silent_tfce_corrp_tstat1_thr095.nii somehow?

Thanks Darren

espressofiend commented 6 years ago

Hi Darren

I put a link to the file in my post - it's the second link. I just tried and it does give you dire warnings about the security certificate not being trusted, but I assure you it's actually safe.

If you have troubles though, direct-mail me at NCIL@dal.ca and we'll sort it out.

Thanks in advance for looking into it, Aaron

On Mon, 2 Oct 2017 at 07:23 dprice80 notifications@github.com wrote:

Hi

Thanks for reporting this.

It shouldn't matter which software generates the data. MNI2FS plots the data purely in MNI coordinate space, so the slice order should not matter. Basically, the coordinates are taken from the colin27 brain template (which is not in any particular format - it's just a bunch of coordinates) and used as a cookie cutter on whichever image you happen to input.

Would you mind sending the me the file /study_silent_tfce_corrp_tstat1_thr095.nii somehow?

Thanks Darren

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/dprice80/mni2fs/issues/3#issuecomment-333496208, or mute the thread https://github.com/notifications/unsubscribe-auth/AJlu17UWhg3TZZ5Q4hlKmBZ6tx1zM-b5ks5soLmmgaJpZM4PjWOY .

--

Aaron J Newman, PhD

Professor

Director, RADIANT Neurotechnology Innovation Training Program

Director, NeuroCognitive Imaging Lab (NCIL)

FACULTY OF SCIENCE

Department of Psychology & Neuroscience

FACULTY OF MEDICINE

Departments of Pediatrics, Psychiatry, and Surgery

Aaron.Newman@dal.ca

+1.902.488.1973 | fax: +1.902.494.6585

Box 15000, Life Sciences Centre, Halifax NS B3H 4R2 Canada

DALHOUSIE UNIVERSITY

NCIL.science http://ncil.science/ dal.ca/RADIANT http://www.dal.ca/RADIANT

dprice80 commented 6 years ago

I see. Sorry, my mistake. I have checked the file and as I suspected there is a negative value in the transformation matrix

     srow_x: [-2 0 0 90]
     srow_y: [0 2 0 -126]
     srow_z: [0 0 2 -72]

which effectively flips the slice order.

Normally an mni space image looks like this srow_x: [2 0 0 -90] srow_y: [0 2 0 -126] srow_z: [0 0 2 -72]

Your image is not wrong though, so mni2fs should really take the negative value into account. I will attempt to fix the problem. For now you can simply reslice the image (basically applying the transformation in the header). reslice_nii('study_silent_tfce_corrp_tstat1_thr095.nii','study_silent_tfce_corrp_tstat1_thr095_rs.nii') resulting in the following transform in the header

     srow_x: [2 0 0 -90]
     srow_y: [0 2 0 -126]
     srow_z: [0 0 2 -72]

Which then gives you the correct image for right and left :)

dprice80 commented 6 years ago

I have updated the repository. Now, when a user tries to use an image with a negative value in the transformation matrix, the image is automatically resliced in-memory using reslice_return_nii. A warning is also displayed alerting the user to the fact that the image could be resliced before running the code (to save time).