Autorecon1

From CCN Wiki
Revision as of 08:36, 7 April 2016 by 192.168.1.1 (talk) (Created page with "The first step in Freesurfer data processing is brain segmentation and skull-stripping. == Stage 1a: Skull Stripping == Calling <code>recon-all</code> with the -autorecon1 fl...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The first step in Freesurfer data processing is brain segmentation and skull-stripping.

Stage 1a: Skull Stripping

Calling recon-all with the -autorecon1 flag performs a number of steps related to segmenting the anatomical MRI image into brain/non-brain voxels. A shell script called autorecon1.sh can be found on the ubfs Scripts/Shell folder. This script simply acts as a wrapper (i.e., a convenient shortcut for executing computer code that might have a bunch of parameters that are error-prone or annoying to have to specify). You can copy this script to your ~/bin directory to be able to run it yourself:

cp ~/ubfs/cpmcnorg/Scripts/Shell/autorecon1.sh ~/bin/

Before you run the script, be sure to first open it up in a text editor so that you can: 1) see what it's actually doing, and 2) modify it so that it matches your particular requirements:

nano ~/autorecon1.sh

If you do so, you will find that it sets some environment variables that you will want to change, such as your $PROJECTROOT After you have modified your copy of the script, you can run it thus:

autorecon1.sh 501

Where you would replace 501 with the appropriate subject number in your project directory. For example, if I want to execute autorecon1 on subject 501 found in ~/ubfs/cpmcnorg/openfmri/booth/ then my script would have the following line:

PROJECTROOT=/home/chris/ubfs/cpmcnorg/openfmri/booth/

When operating on data stored locally on either wernickesarea or brocasarea, this step takes between 20 and 30 minutes to complete. At the other extreme, operating on data stored on the ubfs network drive using the accumbens micro-computer took 2:18 hours to complete. However, note that this step can be run remotely via ssh, even from the comfort of your own home. If you are not physically seated at either of the main workstations, it is recommended that you use an ssh terminal connection into one of those two computers and run this step that way:

nohup autorecon1.sh 501 &

The nohup directive tells linux to keep the program going, even if you log off. That way your computer isn't held hostage over the internet while you wait for the skull stripping step to finish. Be sure to add the ampersand character to the end of your command.

Stage 1b. Brain Mask Editing

The skull stripping stage creates a binary mask that identifies which voxels correspond to the brain and which do not. By binary, I mean to say that it is a 3D block of 1's and 0's: Every location in this block that the previous step has determined contains brain matter gets a 1, and everywhere else gets a 0.

Unfortunately, because voxel identity is determined algorithmically, sometimes the process breaks down. For example, there is generally a gap surrounding the brain (the cerebrospinal fluid in which the brain floats) which can be used to help identify where to make the partition. However in some regions, this gap may be smaller than the width of a single voxel, and in these cases the gap might not be detectable, and the algorithm might decide that a brain region continues into voxels that are actually part of the skull. For this reason we manually inspect the anatomical image with the brain mask overlaid. We can use Freesurfer tools to tweak the mask to exclude these errors.