Doing Freesurfer in Steps with Recon-all Flags

Create Data Folder

  1. Connect to PC and pull over subjects T1 co file into: /usr/local/freesurfer/subjects
  2. Open terminal and go into subjects folder
    1. cd $SUBJECTS_DIR

Run Recon1

  1. At prompt type: recon-all -autorecon1 -subjid 2RO1CD -i 0001.dcm

Edit Talairach

  1. Make sure you’re in 2RO1CD folder
    1. cd $SUBJECT_DIR/2RO1CD
  2. At prompt type: tkregister2 –mgz –s 2RO1CD –fstal
  3. Opens window with your brain and talairach brain
  4. Align movable to target
  5. Click compare button to see how aligned they are- use sliders to move brain up, down, etc. and to resize.
  6. When finished click save reg button

Rerun Recon1

  1.  At prompt type: recon-alll -autorecon1 -s 2RO1CD

Edit Brainmask (Skull Strip)

  1. Make sure you’re in mri folder
    1. cd $SUBJECTS_DIR/2RO1CD/mri/
  2. Examine skull strip by typing: freeview -v T1.mgz brainmask.mgz
    1. This will open your original T1 brain and the skull stripped brainmask- if there is a lot of dura left on the brainmask, run gcut (see bellow)
  3. If not running gcut- you can begin editing- when skull stripping you are making edits to brainmask, so make sure brainmask is checked and above T1 in the volumes tab.
  4. Shortcuts:
    1. To move, click navigate in the upper left – head w/ plus sign
    2. Right click and drag to enlarge or reduce brain
    3. Shift and left click and drag to create contrast
  5. To edit click voxel edit in upper left corner- head w/ pencil.
    1. Change reference to T1 and keep brush size at 2 (can change if need larger or smaller)
    2. Freehand icon lets you delete- top left button, looks like tilde; clone voxel lets you add two rectangles; compute screen tool, lets you put back voxels
  6. To compare brainmask to T1, use arrows in volumes tab
  7. To scroll fn and up or down arrows or pg up or pg down – have to be in brain area, outside edge highlights.
  8. Remove all remaining skull and dura- going slice by slice in coronal then check in sagittal
  9. To save click save volume button on left (make sure brainmask is in the top of list)- head w/ disk
  10. If running gcut, at prompt type: recon-all -skullstrip -clean-bm -gcut -subjid 2RO1CD
    1. Make sure you’re in the subjects folder!
    2. After gcut runs, skull-strip as described above, make especially sure to check that it did not cut out too much brain- may also want to look at what gcut did if so in freeview:
      1. file- load volume- choose brainmask.gcuts.mgz- change opacity so you can see the brain- this will allow you to see what was taken out.

Run Recon2

  1. Make sure you’re in the subjects folder
    1. If were just skull stripping go up 2 levels (cd ../..), otherwise cd $SUBJECTS_DIR
  2. At prompt type: recon-all -recon2 -s 2RO1CD

Edit white matter and pial surface

  1. Make sure you’re in mri folder
    1. $SUBJECTS_DIR/2RO1CD/mri
  2. To edit white matter, at prompt type: freeview -v brainmask.mgz wm.mgz:colormap=heat:opacity=0.3
  3. Go to file- load surface- surf folder- and add lh.white, rh.white
  4. All white matter should be filled in light red. You are adding or subtracting red to help the yellow rh. White and lh. White lines align more closely w/ the white matter (the lines will not change, you are just editing the red, but after you re-run recon2 the lines will move).
  5. To edit click voxel edit in upper left corner- head w/ pencil- this opens a window
  6. In window make sure recon editing is clicked and use freehand icon (top left button)
  7. Shortcuts
    1. Left click adds and shift and left click removes voxels
  8. When finished save volume w/ button (make sure wm is highlighted)
  9. To edit pial surface, at prompt type: freeview -v T1.mgz brainmask.mgz
  10. Go to file- load surface- surf folder and add lh.pial, rh.pial
  11. To edit click voxel edit- make sure recon editing is checked and freehand icon.
  12. Shift and left click removes voxels, not really a way to add back in pial unless they are missing.

Rerun Recon2

  1. Make sure you’re in the subjects folder- if were editing go up 2 levels (cd ../..) otherwise cd $SUBJECTS_DIR
  2. At prompt type: recon-all -autorecon2-wm -s 2RO1CD
  3. Quickly double check white matter as above

Run Recon3

  1. Make sure you’re in the subjects folder
  2. At prompt type: recon-all -autorecon3 -s 2RO1CD
  3. Open it up and check out ROIs
  4. Type
freeview -f
2RO1CD/surf/lh.pial:annot=aparc.annot:name=pial_aparc:visible=0\
2RO1CD/surf/lh.inflated:overlay=lh.thickness:overlay_threshold=0.1,3::name=inflated_thickness:visible=0\
2RO1CD/surf/lh.inflated:visible=0\
2RO1CD/surf/lh.white:visible=0\
2RO1CD/surf/lh.pial\
--viewport 3d

(This command is saved in a text file on the desktop, so you just need to change the subject number)

To Get Data Out

  1. Go to subjects directory
    1. cd $SUBJECTS_DIR
  2. For cortical regions, at prompt type: aparcstats2table –subjects 2RO1CD –hemi rh –meas thickness –tablefile aparc_stats.txt
    1. After meas flag can be whatever variable you want (i.e. volume, etc.)
    2. This saves a text file called aparc_stats which can be opened in excel.
    3. In excel, file- import- text file, then click next- this opens an excel file with each subject listed with the thickness for each region.
  3. For subcortical regions, at prompt type: asegstats2table –subjects 2RO1CD –meas volume –tablefile aseg_stats.txt
    1. This saves a text file called aseg_stats.txt which can be opened in excel as above.
    2. If intracranial volume is not pulled into the file it is located in the aseg.stats file.