From Van Essen Lab

Revision as of 17:16, 31 January 2012 by Donna (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Note: To make the surfaces onto which myelin content will be mapped as outlined, you must have FreeSurfer, FSL, and Caret_command installed and working on your system.

Preliminaries: Producing brain surfaces in FreeSurfer

1. Run FreeSurfer recon-all on T1-weighted (T1w) image. It is best if the image is not resampled with trilinear interpolation either by FreeSurfer or outside of FreeSurfer, as this blurs the image. Resampling with spline interpolation works well. Oblique sforms/qforms in the header of the T1w may result in unwanted resampling or poor alignment between volume and surface later, so avoid oblique sforms. In the directory containing your T1 image file, (in this case named T1w.nii.gz), and using your chosen subject name for <Subject>, use this syntax:

recon-all -i T1w.nii.gz -all -subjid <Subject>

This will create a directory named <Subject> in your FreeSurfer default directory that will contain all outputs from FreeSurfer in subdirectories, including ‘mri’ and ‘surf’, containing the files indicated below.

2. Convert FreeSurfer outputs to GIFTI and NIFTI formats. FreeSurfer outputs need to be converted to GIFTI so that Caret can read them.

 a.	Volume outputs like ribbon.mgz need to be converted. From your <Subject> directory, use this command:

mri_convert -rl mri/rawavg.mgz mri/ribbon.mgz ribbon.nii.gz

 b.	Surface outputs ?h.white and ?h.pial need to be converted to GIFTI (? Refers to l or r, as in the FreeSurfer convention, ? means you need to run the command on first the left and then the right hemisphere). From your <Subject> directory, use these commands:

caret_command -file-convert -sc -is FSS surf/?h.white -os CARET ?h.white.coord.gii ?h.white.topo.gii FIDUCIAL CLOSED -struct left (or right)

caret_command -file-convert -sc -is FSS surf/?h.pial -os CARET ?h.pial.coord.gii ?h.pial.topo.gii FIDUCIAL CLOSED -struct left (or right)

 c.	To realign the surface and volume in Caret space, one needs to find the c_ras offset from FreeSurfer and apply it to the left and right hemisphere white and pial surfaces using the following commands (from your <Subject> directory):

MatrixX=`mri_info mri/brain.finalsurfs.mgz | grep "c_r" | cut -d "=" -f 5 | sed s/" "/""/g` MatrixY=`mri_info mri/brain.finalsurfs.mgz | grep "c_a" | cut -d "=" -f 5 | sed s/" "/""/g` MatrixZ=`mri_info mri/brain.finalsurfs.mgz | grep "c_s" | cut -d "=" -f 5 | sed s/" "/""/g` Matrix1=`echo "1 0 0 ""$MatrixX"` Matrix2=`echo "0 1 0 ""$MatrixY"` Matrix3=`echo "0 0 1 ""$MatrixZ"` Matrix4=`echo "0 0 0 1"` Matrix=`echo "$Matrix1"" ""$Matrix2"" ""$Matrix3"" ""$Matrix4"`

caret_command -surface-apply-transformation-matrix ?h.white.coord.gii ?h.white.topo.gii ?h.white.coord.gii -matrix $Matrix

caret_command -surface-apply-transformation-matrix ?h.pial.coord.gii ?h.pial.topo.gii ?h.pial.coord.gii -matrix $Matrix

 d.	Thickness and curvature of the left and right hemisphere surfaces must also be converted to GIFTI from FreeSurfer formats:

caret_command -file-convert -fsc2c surf/?h.thickness surf/?h.white ?h.thickness.metric caret_command -metric-math ?h.thickness.metric ?h.thickness.metric 1 "abs[@1@]" caret_command -file-convert -fsc2c surf/?h.curv surf/?h.white ?h.curv.metric

 e.	Register T2w to T1w.  We prefer FreeSurfer’s BBR registration for this, as the registration is cross modal and needs to be highly accurate.  It is important that spline interpolation is used the resample the T2w to the T1w, however, so the final resampling needs to be applied with FSL.  The following is a bit convoluted, but it works (it is necessary to get the FSL affine matrix in the correct format and not in FreeSurfer space):

Before doing this, copy or move the T1 and T2 image files (in this case, T1w.nii.gz and OrigT2w.nii.gz) to your <Subject> directory.

mri_convert OrigT2w.nii.gz OrigT2w_conform_RAS.nii.gz --conform bbregister --s <Subject> --mov OrigT2w_conform_RAS.nii.gz --reg fsreg.dat --init-fsl --t2 --o T2w_conform_RAS2T1wbb.nii.gz --fslmat T2w2T1wbb.mat applywarp --interp=spline -i OrigT2w.nii.gz -r T1w.nii.gz --premat=T2w2T1wbb.mat -o T2w2T1w_translated.nii.gz mri_convert -rl T1w.nii.gz T2w_conform_RAS2T1wbb.nii.gz T2w_conform_RAS2T1wbb.nii.gz flirt -dof 6 -nosearch -in T2w2T1w_translated.nii.gz -ref T2w_conform_RAS2T1wbb.nii.gz -omat translate.mat -out T2w2T1w_not_translated.nii.gz convert_xfm -omat T2w2T1w.mat -concat translate.mat T2w2T1wbb.mat applywarp --interp=spline -i OrigT2w.nii.gz -r T1w.nii.gz --premat=T2w2T1w.mat -o T2w.nii.gz

 f.	Average white and pial to create midthickness of the left and right hemisphere surfaces.

caret_command -surface-average ?h.midthickness.coord.gii ?h.white.coord.gii ?h.pial.coord.gii

Run Myelin Mapping

Now that all of the data are in Caret-readable GIFTI and NIFTI formats, we can run Myelin Mapping using caret_command (this is all one command):

caret_command -myelin-mapping lh.midthickness.coord.gii rh.midthickness.coord.gii lh.white.topo.gii rh.white.topo.gii T1w.nii.gz T2w.nii.gz ribbon.nii.gz lh.thickness.metric rh.thickness.metric lh.curv.metric rh.curv.metric L.MyelinMapping.metric R.MyelinMapping.metric T1wDividedByT2w.nii.gz T1wDividedByT2w_ribbon.nii.gz -neighbor-depth 10 -number-of-standard-deviations 2 -smoothing-FWHM 5 -volume-outliers 1

The output files are: L.MyelinMapping.metric R.MyelinMapping.metric T1wDividedByT2w.nii.gz T1wDividedByT2w_ribbon.nii.gz

These include a metric file for each hemisphere with these columns: a raw myelin map (with no outlier correction) a corrected myelin map, a smoothed myelin map, and a cortical thickness corrected for surface curvature. Additional outputs are the T1w/T2w volume, and the same volume containing only the voxels of the cortical ribbon.

Myelin mapping Data

We will release the published myelin mapping data in SumsDB soon together with a fixed version of the fs_LR atlas and revised data with further methodological improvements.

Personal tools
Sums Database