Skip to content

T1 preprocessing Spatial Normalization

Michelle Voss edited this page Sep 26, 2024 · 2 revisions

T1 preprocessing

The goals of this lab are to learn (1) the basic steps of T1 image preprocessing including bias correction and brain extraction, (2) learn how to interact with T1 images via fsleyes to examine the output of bet, and (3) practice running spatial normalization to the MNI template and use fsleyes to examine output. We will complete these steps as described in Muschelli et al., 2015 using fslr.

Access FastX through the remote login:
https://fastx.divms.uiowa.edu:3443/

Download our data for today:

  • Open the terminal
  • Change directories from your home directory to fmrilab with the command: cd fmrilab
  • To download data, copy/paste to the terminal wget -O T1w_practice.tar.gz https://osf.io/yz79v/download/
  • To unpack your download copy/paste tar -xvf T1w_practice.tar.gz
  • Move yourself into the folder with data by typing cd T1w_practice


Step 1: Install fslr on R in fastx

  • Open RStudio: Within your MATE session, navigate to Applications -> Statistics -> RStudio
  • Move to T1w_practice folder: Navigate Session -> Set Working Directory -> Choose Directory... -> Click on the T1w_practice directory you just downloaded
  • Install fslr: Within RStudio, navigate to Tools -> Install Packages -> type fslr into the prompt and keep install dependencies checked
  • As in the reading, type the following in the prompt for setup
  • TIPS! Notice our fsl path is different than the paper and you should type each line one at a time followed by enter.
library(fslr)
options(fsl.path = “/opt/fsl”)
options(fsl.outputtype = “NIFTI_GZ”)


Step 2: Brain extraction with Bias Correction + BET

  • Code for running brain extraction and bias correction as described in the paper:
fslbet(infile="sub-003_T1w",outfile="sub-003_T1w_T1_FSL_BiasCorrect_Brain",opts = "-B -f 0.1 -v",betcmd="bet",intern=FALSE)
  • Once completed we will use fsleyes to open both the original and bias corrected and let's observe differences
  • Understand how to view an image histogram to understand Figure 1 in the paper
  • Understand two important outputs: (1) brain extracted image and (2) mask file, and how to use overlays to emulate Figure 6 in the paper
  • Modify the code above to run bet and bias correction on sub-004
  • Compare results of bet for sub-003 and sub-004
  • Walk through parameters of bet to refine results when needed


Step 3: Spatial normalization of brain extracted T1 image to MNI template

  • Code for running spatial normalization as described in the paper:
fnirt_with_affine(infile = "sub-003_T1w_T1_FSL_BiasCorrect_Brain",
reffile = file.path(fsldir(), "data", "standard","MNI152_T1_1mm_brain"),
flirt.omat = "sub-003_T1w_T1_FSL_BiasCorrect_Brain_affine_toMNI.mat",
flirt.outfile = "sub-003_T1w_T1_FSL_BiasCorrect_Brain_affine_toMNI",
outfile = "sub-003_T1w_T1_FSL_BiasCorrect_Brain_toMNI")
  • Once completed we will use fsleyes to open original brain extracted T1, affine transformed, and non-linear transformed image
  • Understand how to compare alignment by picking benchmarks and toggling between images
  • Compare and contrast the affine and non-linear and understand their differences
  • The goal of spatial normalization is to transform sub-003 and sub-004 into a common space that is a population average brain, or the shape of an average brain. If we succeed, this means the anatomy for these two participants now directly overlaps. How could we check that in fsleyes?