Incorrect T1 orientation when loading infant freesurfer output

Hi brainstorm experts,

I used infant freesufer output for the infant MEG data. The structure of infant Freesurfer output is the same as regular Freesurfer output. However, the orientation of T1.mgz was incorrect in the MRI viewer. When I import the regular Freesurfer output from same subject's, the orientation of T1.mgz is correct in brainstorm MRI viewer.

I have used different viewer to load the T1.mgz from infant Freesurfer and regular Freesurfer output, and they were correctly labeled. So is it possible that the orientation of T1 images is hard coded when I choose Freesurfer as the file type of anatomy folder? So it doesn't actually read the orientation information in T1.mgz file? If so, is it hard to fix the brainstorm code to recognize the orientation from T1.mgz (which is the same orientation from the original *.dcm file)?

Below is a screenshot as an example:
using brainstorm mriviewer

using Freeview to view the same T1.mgz

Thank you!
Best, Yuhan

Could you please share the T1.mgz file, so I can look into this issue?

  • Upload the file somewhere
  • Post the download link here (or send it to me as a private message if this sensitive data)

Thanks

Thank you for sharing an example file.
However, what you sent is not a T1.mgz as created by the recon-all command.
Therefore, you can't use the default import procedure that is specifically developed for the import of the recon-all output.

What you did is: convert a .nii.gz file to a .mgz with mri_convert, then import the .mgz in Brainstorm.
In this configuration: simply import the .nii.gz file in the Brainstorm database.

If you nevertheless want to import this .mgz file in the Brainstorm database, you have to answer NO to the first question (use standard FreeSurfer orientation) and then YES (re-orientation in Brainstorm standard). This will give you a MRI correctly oriented.

Your MRI viewer uses the "bone" colormap instead of "gray", which seems to indicate an older version of Brainstorm. Make sure you update Brainstorm before testing this procedure.

image

image

Thank you Francois!

By default infant Freesurfer does not output a T1.mgz like regular Freesurfer, it outputs a .nii.gz file. If I understand correctly, should I not select "import anatomy folder" and choose the file type "Freesurfer + volume atlases + thickness", and instead import MRI file (.nii.gz) and and cortical surface separately?

If that's the case, is there a way to import Freesurfer cortical thickness measures? Before when I choose to import freesurfer+volume atlases + thickness" it will automatically create the cortical thickness measures in their surface. If I load MRI and surface separately I am not sure how to do that. Let me know what you think.

Thank you!

Best, Yuhan

It would be complicated to reproduce manually all the import steps for this file.
As I've never used InfantFS, I can't give you directions on how to adjust to the differences between this and the standard FreeSurfer recon_all.

I think the simplest solution would be for us to add a direct support for the output of the infant_recon_all pipeline (as called by the menu Import anatomy folder).

Could you please share the full output folder (zipped), so I can adapt the import function for FreeSurfer to this specific format?
It might be as easy as adjusting how the initial MRI is loaded, it might be a lot more complicated if it introduces new transformations that are not handled correctly.

Hi Francois,

That sounds great. Please note that the output from infant Freesurfer (infant_recon_all) are quite different from regular Freesurfer. Please let me know if you encounter any issue.

Below is the link of the infant FS output:
https://www.dropbox.com/s/1fqzvctmdlsxqoy/infantFS_test_brainstorm.zip?dl=0

Thank you!
Best, Yuhan

Where is the original T1.mgz or T1.nii.gz, in the folder you sent me?

It looks like some of the files are missing: I can't work on a procedure to import an InfantFS folder if I don't have the complete folder exactly as generated by the infant_recon_all pipeline...

Is it the file BBC018_V2/mprage.nii.gz ?
Is this file not copied at all into the mri subfolder, or have you deleted some files manually?

Can you please give me the exact sequence of commands you executed in a terminal in order to obtain this folder?
Is it like with the regular recon_all, where the input MRI gets copied to a SUBJECTS_DIR folder?
Or does it create all the subfolders (mri, labels, etc) anywhere the input MRI is?

Can this work with both T1 and T2, or only a T1?
If so, how to do you distinguish the two in the output subject folder?

I've already added a few lines of code to read any .nii.gz file in the root folder of the subject selected when using the menu Import anatomy folder:

Simply update Brainstorm to get this commit.
The MRI and surface seem to be already correctly aligned (see below), but we might have further adjustments to make depending on your answers to the previous questions, in order to make this import function as robust as possible for all the use cases of InfantFS.

image

Sorry for my late reply - was off during Xmas week.

By default infant_recon_all created mprage.nii.gz in the folder under $SUBJECTS_DIR, not in the $SUBJECTS_DIR/mri folder.

To run infant_recon_all, the full commands in the terminal is (including setting up the bash environment):

source YOUR_FREESURFER_ENVIRONMENT
setenv SUBJECTS_DIR your_data_path or export SUBJECTS_DIR=your_data_path
infant_recon_all --s SUBJ --age age_in_months

Infant FreeSurfer does not create exactly the same output in ./surf and ./stats folders. It still creates all the files in ./surf folder that are needed for cortical surface.

Regarding the T1 and T2 images, Lilla Zollei (the developer) just replied me last week that it doesn't work with T2w at the moment but she is working on implementing it so the segmentation can be improved. So right now by default there is only T1 images output. For infants younger than 6 months old the T1 contrasts are reversed (i.e., so gray matter is white and white matter is gray), and vice versa for T2. There is a big variability across individuals when T1 will look like adult T1 (gray matter is in gray color).

I will update the brainstorm now and check again and let you know soon. Really appreciate that you are adding this option for importing anatomy. FYI, I am in the process of comparing the results of MEG source reconstruction using the outputs from regular freesurfer and infant freesurfer. The reason we are using infant freesufer, as you already know, is that freesurfer often failed for infants under 18 months due to the poor contrast, issues with skull stripping, and the reversed contrast that changes rapidly during the first year of life with huge individual variabilities.

Yuhan