User Tools

Site Tools


cortical_thickness

This is an old revision of the document!



Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /nfs/bronfs/uwfs/hw00/d36/bdelab/wiki/inc/parser/handler.php on line 1458

Warning: preg_match(): Compilation failed: invalid range in character class at offset 3093 in /nfs/bronfs/uwfs/hw00/d36/bdelab/wiki/inc/parser/lexer.php on line 118
A PCRE internal error occured. This might be caused by a faulty plugin

Page describing how we analyze cortical thickness with freesurfer ====Setting up Freesurfer and MATLAB==== First make sure that you have the correct lines in your .bashrc file to run freesurfer: <code>export FREESURFER_HOME=/usr/local/freesurfer source $FREESURFER_HOME/SetUpFreeSurfer.sh > /dev/null export SUBJECTS_DIR=/mnt/diskArray/projects/freesurfer</code> Next make sure that you have the right tool boxes in your matlab search path. This should be done through your startup.m file <code>addpath(genpath('~/git/yeatmanlab'));</code> ====Create a T1 weighted nifti image for the subject==== Step 1: In a terminal, convert the PAR/REC files to nifti images. You may not need to do this if you have already gone through the [[anatomy|Anatomy Pipeline]] <code>cd /mnt/diskArray/projects/MRI/[subid] parrec2nii -c -b *.PAR</code> Step 2: In MATLAB compute the root mean squared (RMS) image. Once again this might have already been done in the [[anatomy|Anatomy Pipeline]] so you can re-use that RMS image <code>T1path = 'Path to t1 weighted image'; T1path = mri_rms(T1path); % Root mean squared image</code> ====Freesurfer Segmentation==== Freesurfer is a useful tool for segmenting a T1-weighted image and building a cortical mesh. To segment the subject's T1-weighted image using freesurfer from the command line type: <code>recon-all -i /home/projects/MRI/[subjid]/[YYYYMMDD]/[subjid]_WIP_MEMP_VBM_SENSE_13_1_MSE.nii.gz -subjid [subid] -all</code> The MATLAB script **parallel_recon.m** has been written to (with slight adjustments in order to specify file input and output) automate and parallelize the process, which typically takes 6-10 hours per file. It is also recommended that the process be executed on multiple servers in order to further divide the work. ====Longitudinal Analysis==== ===Pre-processing=== Following the segmentation of the T1-weighted image, two further pre-processing steps are necessary to proceed with longitudinal analysis of the data. Firstly, an unbiased template must be created for each subject, taking into account all time-points/sessions. Secondly, each time-point must be processed again using these templates in order to standardize subject data across time-points. The command to create the unbiased template is: <code>recon-all -base [output file name] -tp [time-point 1 file] -tp [time-point 2 file] ... -tp [time-point n file] -all</code> Next, the command to process each time-point using this template is: <code>recon-all -long [template file] [time_point file] -all</code> The **recon-all -base** command will take about as long as the original FreeSurfer segmentation, however each iteration of the **recon-all -long** command will take approximately half the time. Using helper functions, the **paralell_recon.m** script will also generate and execute these commands. There are several different options for longitudinal data analysis, each which provides unique and useful information about the data and how subjects change over time. ===Qdec Files=== A first step of several different forms of longitudinal analysis is the generation of a qdec file. A qdec file is a text file, which serves as a consolidation of subjects of interest, along with any other relevant measures or covariates. The file is used to extract, organize, and analyze data for subjects/time-points listed. For a longitudinal qdec file, the components should be organized in the following manner: - The first column should list subjects' relevant time-points, with the column header **fsid** listed in the first row. - The second column, **fsid-base**, should list the base template for each subject/time-point. - Unless otherwise specified, the third column will be considered the time variable. Therefore, it is encouraged to default to that organization in order to avoid unexpected confounds. - The following columns can contain any relevant data, including behavioral measures, which can be used for further analysis, e.g. correlational Because for some analyses data is numerically sorted using information from the qdec file, one version of the file should represent subjects' time-points and base templates strictly numerically. However, an original file should be kept which lists subjects time-points and base templates so they correspond with the file name, which contains the data for that/those time-point(s). ===Pre-processing pt. 2=== In order to complete the following analyses, two steps are needed to collect and process data. The two commands used are **mris_preproc** and **mri_surf2surf**. For example: <code>mris_preproc --qdec-long long.qdec.table.dat --target fsaverage --hemi lh --meas thickness --out lh.thickness.stack.mgh</code> <code>mri_surf2surf --hemi lh --s fsaverage --sval lh.thickness.stack.mgh --tval lh.thickness.stack.fwhm10.mgh --fwhm-trg 10 --cortex --noreshape</code> Further documentation for both [[https://surfer.nmr.mgh.harvard.edu/fswiki/mris_preproc|mris_preproc]] and [[https://surfer.nmr.mgh.harvard.edu/fswiki/mri_surf2surf|mri_surf2surf]] can be found at these links. The output of **mri_surf2surf** along with the numerical qdec file can then be used as inputs for the function **long_prepare_LME.m**. The output of this function is an array which contains (among other things) data for the relevant subjects and a data matrix containing information from the qdec file. Outputs of this function will be used for the following analyses. ===Correlational Analysis=== A whole brain correlational analysis has the potential to illuminate the relationship between behavioral measures and the anatomy of the brain. The analysis subsequently provides an assortment of regions of interest whose structural change over time can be investigated. Using the outputs of **long_prepare_LME**, the function **make_correlation_map.m** will create an "mgh" file which can be mapped onto the cortical surface for visualization for regions correlated with a given covariate. This file can later be used in order to extract clusters (a process which is described under **ROI Analysis**) with which the function **corrplot_ROIs.m** calculates the correlation value and its signficance and plots the data to a graph. An optional output of this function is a 3D matrix containing information about the ROIs which can be used for plotting the data longitudinally (using **long_mtx_2_longplot.m**) or analyzed using the linear mixed effects model (described below). We will follow the steps outlined in the [[https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/LongitudinalTutorial|Freesurfer Wiki]] for analyzing cortical thickness. The first steps are described [[https://surfer.nmr.mgh.harvard.edu/fswiki/LongitudinalProcessing|here]].

cortical_thickness.1501793855.txt.gz · Last modified: 2017/08/03 20:57 by mpenrod