Failure to create BEM surfaces

Hi,

I am trying to create a head model using a T1 and cortical surfaces created using FreeSurfer as part of the HCP (Human Connectome Project). I am getting really strange results. I think there may be an orientation issue based on the header being somehow messed up. I can import the T1 and display it OK, and I can import the pial surfaces and combine them to make a full brain. But the orientation of the brain is wrong when I plot it, and the BEM surfaces (none of which look right) are oriented strangely as well.

Do you know any way to check the orientation of nifti files prior to importation into Brainstorm?

Oh, and the T1 is 16-bit, not 8-bit like the ones I have had success with in the past. Could this have a bad effect on creating the BEM surfaces?

-Jeff Eriksen

Hi Jeff,

If you processed the T1 with FreeSurfer, you should import the FreeSurfer folder with the menu “Import anatomy folder”:
http://neuroimage.usc.edu/brainstorm/Tutorials/ImportAnatomy#Import_the_anatomy
What you are probably doing wrong here is using the original MRI instead of the volume T1.mgz created by FreeSurfer.

Francois

Hi Francois,

I wish I could do just that, but I need to use the interpolated BOLD data from the HCP pipeline for my dipole simulations, so have to work in their space, probably aligned to MNI space. The T1 I am trying to use is also aligned to their MNI space and, of course, when I open the HCP-provided pial and T1 files with the HCP tools they overlay correctly. But something must be different compared to the original outputs of FreeSurfer (T1.mgz, left.pial and right.pial). The HCP-T1 looks right in the BSt MRI window.

My only idea at this point is to dig into the orientation parameters on the set of files that have worked for me in the past and see if I can find a difference in the HCP-derived files in comparsion.

What about the 8-bit vs. 16-bit resolution?

-Jeff

FreeSurfer writes a re-oriented and re-sampled volume (subfolder mri/T1.mgz), with a fixed size and resolution (256x256x256, voxel size=1x1x1mm). It’s not normalized in MNI space, it’s still in subject space.
Then all the surfaces are aligned on this re-aligned MRI.
The only easy way in Brainstorm to get the FreeSurfer surfaces aligned correctly on the MRI is to use the FreeSurfer T1.mgz volume. Aligning them on the original MRI is relatively complicated, and I never looked into how to do it.
Can you re-align your other volumes and surfaces in this FreeSurfer space?

I don’t think the int8/int16 storage in the file can be an issue. If it were the case, the MRI slices would look completely wrong in the MRI viewer in Brainstorm.

Francois

My longer range plan is definitely to get the BOLD data from the HCP pipeline back to the scanner or subject space, but that has proven difficult so far. My main reason is to avoid any non-linearities in spatial transformations since their effect on source modeling is unpredictable.
I may try some rotations using FSL to see if I can get things in a format Brainstorm can deal with.
Do you know anything about the MEG aspects of the Human Connectome Project? Have any MEG Brainstorm users been using HCP MRIs?
Thanks for your explanations.
-Jeff

Do you know anything about the MEG aspects of the Human Connectome Project? Have any MEG Brainstorm users been using HCP MRIs?

I know some Brainstorm users have been using the HCP-MEG data, I got lots of questions about it, but I don't know exactly for what purpose.
It is in our plans to write a tutorial (and all the missing tools) to import easily the HCP data in Brainstorm, but it was put on hold because we did not have access to the headshape files, which are indispensable for computing a correct registration MRI/MEG. I heard that the last batch of subjects includes these hs files, so we'll get back to this tutorial project soon.

Francois

I just looked at the HCP MEG site, and found a paper describing their pipeline (tried to upload it for you, but got error, so link below). They use FieldTrip for source analysis, and use a simple 3D regular grid of dipoles, NOT the cortical surface which I prefer for EEG, and for aligning to the fMRI BOLD.

-Jeff

http://www.humanconnectome.org/documentation/HCP-pipelines/meg-pipeline.html

The main issue we had to reproduce this pipeline in Brainstorm was the absence of the hs files. They were providing transformation matrices saved in .txt files, but it was then partly processed data, not unprocessed data as initially claimed.
Hopefully we’ll get to work again on this soon.
Right now I’m working on adding the support for more FieldTrip functions (ft_volumesegment, ft_prepare_headmodel, ft_computeleadfield, ft_prepare_sourcemodel, etc), it will help a lot for the side by side comparison of the two environments.
Francois

Hello again,

I have been trying to rotate the HCP-T1 to match the FSrf-T1, and it seems I have it now. They both open with the same orientation in FSLView now. When I open HCP-T1-rot.nii in BSt, it looks the same at the FSrf-T1, and the head surface comes out seemingly correct. Ignoring the cortex for the moment, which will also have to be transformed, I have tried to create the BEM surfaces using this HCP-T1, but still have some strange results. Can you point me to documentation that explains how the three BEM surfaces are generated? Are they generated only from the T1, or is the cortex involved somehow? I assume the latter, since the cortex is required before the process can run. I notice that a space is created for the cerebellum so it will fit within the inner skull, and I assume that space must be estimated from the T1 itself. Also a space for the eyes is incorporated somehow. Is this from the T1 or by somehow expanding the cortex with a convex hull?

Once the inner skull is formed, I assume the outer skull is simply an expansion of 4 mm beyond the inner skull, but being careful to not go outside the head surface. Finally, I assume the outer BEM head tessellation is simply created from the initial head surface. Knowing if I am right here will help me to figure out what might be going wrong.

I also wonder if the grayscale values of the T1 (range and distribution) might be having an effect? Look at the pictures I am attaching to see what I mean here. Are certain intensity ranges (used as barriers or stopping criteria) hard-coded?

The screenshots depict the brain upside down, I know, but that should not affect the 3 BME surfaces, should it? Again, if I knew the details of the BEM creation I would figure some of this out on my own and make some reasonable hypotheses as to what to try next.

Thanks,

-Jeff

PS. added side-by-side comparison of the final headers of the two T1 volumes. Left it the FSrf-T1, and the right one is the rotated HCP-T1.

Hi Jeff,

The head surface is estimated by Brainstorm only from the MRI volume:

The BEM surfaces are a projection of the inner skull and outer skull surfaces from the default anatomy of your protocol (probably ICBM152) transformed to the surface space. A radial deformation field (in spherical coordinates, only the radius is changed) is computed based on the ratio between the subject head surface and the template head surface. It might not work well in the case where the subject head is not realistic (like on your pictures).
The cortex surface is used in this process to constrain the inner skull not to intersect the cortex. In many places in the interface, the convex hull of the cortex is used if there is no inner skull surface available, but this should not have any impact here.

You can try using the new fieldtrip wrapper for ft_volumesegment (in the process group “Import anatomy”), it would generate another set of BEM surfaces based on a SPM registration with a template.

Cheers,
Francois

Francois,

This is all helpful, thanks. I do not understand how the default anatomy is decided/defined/provided, so can you enlighten me more there? I guess that must be determined in FSrf during its recon-all pipeline when it registers to the MNI average brain for alignment purposes.

Cheers,
-Jeff

The default anatomy is what you have in the folder (Default anatomy) in your Brainstorm protocol.
It is copied from the Brainstorm distribution (brainstorm3/defaults/anatomy) when you create a new protocol.
It is then used automatically for many purposes.

OK, right, I now recall this from the first BSt class I took,
-Jeff

I want to re-open this in the light of Sylvain's recent response to me and the HCP listserve in which he referenced a video showing how to import HCP files into Brainstorm. I do not this helps me any since it looks specific to the HCP-MEG pipeline.

Though I originally reported a problem with creating BEM surfaces, the real problem occurs before any attempt to create these. The basic problem is seen when I simply import an T1 volume and a surface. For discussion, say I have the FreeSurfer T1 (FS-T1) and left and right pial surfaces (FS-L, FS-R, nifty format). From our local HCP pipeline I have from the same subject the HCP-T1 and the HCP-L and HCP-R surfaces (gifti format). Both these sets display properly aligned in the HCP workbench (HCP-WB) program and FreeView (a FreeSurfer display program).

I have no problem with the FS set importing into Brainstorm. When I import the HCP set, however, the T1 and the brain surfaces are not aligned. Rather the brain is plotted with a large translation and is also flipped on several axes. It seems to me that Brainstorm is somehow unable to properly interpret something in the HCP surface file header which leads to this misalignment. An example is show below:


To look at the actual vertex coordinates, I opened the surface files using Matlab scripts (load_nifti.m for the FS pial surfaces, gifti.m for the HCP gifti surface files) and determined the min, max and range of the X, Y, and Z coordinates. Then I imported them into BS and exported the surface vertices to the Matlab workspace. The spreadsheet below shows the results. The main thing to note is the large offsets (translation) that BS added to the HCP surface vertices, but did not add to the FS surface vertices. (the X-Y exchange I presume is not a real problem, perhaps a re-definition of coordinate spaces in BS). These numbers still do not explain the apparent flipping of axes, but they do demonstrate the large translation pretty clearly.


I am at the limit of what I can do here, unless you can think of any more troubleshooting steps I can take.
-Jeff

Have you tried following this tutorial?
http://neuroimage.usc.edu/brainstorm/Tutorials/HCP-MEG
This also imports the nii+gii files.

I tried to download all 4 packages, but Apsera kept losing its connection and restarting. However, I did get the two smaller packages downloaded, and those are the only ones I need since I am not doing actual MEG processing.

I unzipped them in my Downloads folder and got this:



Then I selected the import folder and got this:


After which I got this:


and finally this:

I did not expect to be asked how many vertices - I assumed it would import them all. It also seems to be confused if it is looking for lh.pial and rh.pial in this context.

So next I tried to manually import, and this worked without incident until I tried to view the T1 and surfaces:




And so you see that this is the exact problem I have had with our local data sets.

???????????????

-Jeff

-Jeff

Francois,

My post two days ago may have been confusing, or looked like too much to answer quickly, so in a nutshell:

I tried the HCP-EEG import as you and Sylvain suggested, and it did not work. As with the previous HCP imports I tried on my own, the surfaces did not line up with the T1. So my original problem remains. It seems like if we can figure out why I cannot get the tutorial example to work and fix that, then my own problem will be solved as well.

This is on my critical path right now - when do you think you can get back to me on this?

Thanks,
-Jeff

Please follow [B]carefully[/B] the instructions in this tutorial:
http://neuroimage.usc.edu/brainstorm/Tutorials/HCP-MEG

(this includes selecting the format “File format: HCP MEG/anatomy (pipeline v3)”, and not “FreeSurfer”, like you did - this is not a FreeSurfer folder)

Francois,

I did select the anatomy folder, as shown on my screenshot below. I include it here again. But it does not have the (pipeline v3) string for some reason.

http://neuroimage.usc.edu/forums/attachment.php?attachmentid=1452&d=1486344082

-Jeff

Update Brainstorm again. These are functions I added in the past few weeks.