Stanford: General fMRI Pipeline

This page is a repository for all the tutorials relevant to running fMRI analysis at Stanford. Before you can start these tasks you need to set up a number of things for your computer. The list is on the Stanford Info page, but we repeat it here because you really can't do any of the other steps until this is done:

  1. Setup FSL: Test this by running 'which fsl' in terminal, it should return your fsl install directory (install instructions).
  2. Setup Freesurfer: Test this by running 'which freesurfer', again it should return your install directory (instructions).
  3. Setup Passwordless SSH: See the instructions for that. Set it up for Oban and cnic7
  4. Get access to the LXC (cnic7). Ask lab members to give you access to our data via NIMS.

Once you are set up there are four major steps to running our Pipeline (before you can start doing analysis):

  1. Run segmentations with mlrReconAll and mlrGetSurf: This will generate your surfaces, you will still need to make the flat maps.
  2. Run dofmricni: This will copy your data locally.
  3. Run mriqc: Generates quality control metrics.
  4. Align your data, load your surfaces, save everything to AnatDB
  5. Draw ROIs for your retinotopy, save everything to AnatDB
  6. Load your Bases, Surfaces, and ROIs from AnatDB

Each of these steps is explain in more detail as a mini-tutorial below.

Segmentation

Downloading Files

Alignment

Loading and re-Saving Surfaces

ROIs and AnatDB

Troubleshooting

fsl roi warning after dofmricni

>> dofmricni
>> Could not find command: fslroi See http://gru.stanford.edu/doku.php/gruprivate/stanford#computer_setup for help setting up your computer
(dofmricni) !!! FSL does not appear to be installed correctly !!!
Do you want to continue to run w/out FSL? This just means it will skip the distortion correction (y/n)?n

You should setup your computer properly setup

gruDispData

There is a file on the CNI server called gruDispData in our /home/username/ folders. It has to be copied to your folder for dofmricni to run.

SSH Passwordless Issues

The main issue we have run into is that you have incorrect access to the .ssh files, usually because somebody else modified them. Try running: chmod 775 ~/.ssh chmod 775 ~/.ssh/authorized_keys On the cnic7 sever while logged in.

MATLAB doesn't see Freesurfer or FSL path

Try adding to your ~/.bash_profile file this line: alias matlab=/Applications/MATLAB_R2013a.app/bin/matlab (you may have to change the version number)

If you have no .bash_profile then cd ~ and run touch .bash_profile to make the file.

Then run matlab -nodesktop in any terminal. Type !which fsl and !which freesurfer to check if this fixes your issue.

Lost Stim Files

  • Did you scan through midnight? Then half of your stimfiles have the wrong date.
  • Does the name of your mgl stimulus code file match the name of your NIMS folder? (e.g. jlg/cohcon on nims, but cohcon1.m was your stimulus code). If they don't match you can find your stimulus files in ~/data/yourstimfile/s03xx/**.mat on Oban.

Non-Linear Fits

Always check your non-linear fits. Otherwise shit like this happens:

left

Segmentation Failure

Looks like this!

Concatenation and Analysis

Specific Tutorials