Structural

From Brain Mapping Unit
Revision as of 12:44, 19 May 2011 by lr344 (talk | contribs)
Jump to navigationJump to search

Freesurfer

The FreeSurfer programme was developed to enable cortical surface reconstructions based on MR image data. The programme itself is available freely for download for all platforms, however both the BCNI and WBIC systems already have it installed.

There are detailed instructions on the FreeSurfer website for how to install and run the programme. Once data have been processed, it is important to check the reconstructions for errors in segmentation that may impact on the accuracy of the surfaces. What follows is a brief description for how to do this.

Setting Up Your FreeSurfer Session

In order to implement FreeSurfer it is necessary to declare where the programme is located, as well as where your subjects are. You can do this from the command line, or else by editing your .bashrc or .tcshrc files. If you are running a bash profile, you can include the following lines

export FREESURFER_HOME=/home/freesurfer

source $FREESURFER_HOME/SetUpFreeSurfer.sh

export SUBJECTS_DIR=/home/Subjects/Study1

Alternatively these can be inputted from the command line. Note FreeSurfer will return errors if you attempt to run it without declaring the appropriate subjects directory.

FreeSurfer generates a lot of data which it automatically files away in specific folders, i.e. there is an ‘mri” folder which contains original and generated volume data, a “surf” folder which contains the files pertaining to the surface, a “stats” folder which contains quantitative results of volumes and surfaces, “lables” contains surface labels which you can apply to look at certain regions only etc... Each subject has the same sequence of sub-folders. When we set up a FreeSurfer run, we declare where all the subjects are (SUBJECTS_DIR) and it can then run iteratively on them...

Note if you are running a tcsh shell you would declare things slightly differently:

setenv FREESURFER_HOME /home/freesurfer

source $FREESURFER_HOME/SetUpFreeSurfer.csh

setenv SUBJECTS_DIR /home/Subjects/Study1

Once you have set up the FreeSurfer environment you can cd into the subjects directory:

cd $SUBJECTS_DIR

ls (gives list of folders and files in directory)

tkmedit R02 brainmask.mgz lh.pial –aux wm.mgz –aux-surface rh.pial (the main “volume” is the brainmask file – the whole brain minus the skull; the auxillary volume is the white matter only – there are two buttons you can use to flick between – when editing it is sometimes very useful to flick to white matter volume to fill in white matter strands that were omitted; FreeSurfer loads left and right surface separately, hence you load lh.pial straight and rh.pial as an auxilary surface. The red surface is the pial surface, and the green / yellow surface delineates the white matter surface. When constructing surface reconstructions, FS first identifies the white matter surface and then “grows” to form the pial surface, hence if there is a problem with the surfaces, it is often only necessary to fix the white matter surface).

In the tkmedit window you can change the appearance of the data to suit your needs. For editing I recommend the following:

View – Configure – Brightness / Contrast

View – Anatomical Sampling – Main Volume – TirLinear

View – Anatomical Sampling – Aux Volume – Tri-Linear

(Trilinear is a smoothing technique; sinc is “better” but drastically slows things down so don’t bother with it).

(Click on mavigation button (left) – with left mouse button you can move around the image, with middle button held down you can scroll).


Editing Reconstructions

When editing a brain, I recommend that you do all edits together. There are three types: control points, white matter and pial edits, and they are applied to correct different errors . Briefly, control points correct grey-scale values, and are used in conjunction with white matter edits to correct the white matter. Accurate identification of the white matter is crucial as the pial surface is generated based on it. Pial edits are applied most commonly when the the skull is not properly stripped away, although overall this happens rarely. Editing is very boring and time consuming. On the FreeSurfer boards they refer to each edit-type as separate session, but I recommend that you do all edits together as it cuts down on the amount of re-edits you have to do... At the minimum I would expect that you have to do at least two editing sessions per brain.

Controls Points

The most common problem will always be the temporal lobes – poor signal to noise ratio. Sometimes these can be fixed with so-called “control points”, these are points that you place in the white matter that has mistakenly NOT been identified as white matter. FS identifies white matter and then sets all voxels identified as such to a grey-scale value of 110. Very ofter if the signal to noise ration os poor, the white matter will have a grey-scale value well below what it should be and hence will not be accurately identified. By adding in control points, you are telling FS that these voxels should have a grey-scale value of 110 and it will up-scale the values appropriately. Note: it is very important to place control points in the white matter ONLY.

To add in control points, click on the button with a paintbrush and a crosshair. Left click in the volume window to activate the window and then use the middle button to add control points. Add control points spairngly, and make sure that you only add them to white matter (very important), and that you only add to white matter that was not previously included as white matter. At regular intervals clike on File – Save Control Poiints (you really don’t want to loose your work half-way through a session, and things can be unreliable over an internet connection). For an illustration of editing see the FS website.

White Matter Edits

Sometimes a white matter strand will not be identified because somewhere along the strand there is a break. To see this you often have to scroll back and forth over a few slices to find the break. I sometimes use the white matter editing in preference to the control points because they have more “weight” (i.e. cp’s sometimes don’t work, whereas wm edits do; means that generally you only have to edit a brain once). White matter edits can also be used to fill in the top of a gyrus, scoop out a sulcus that was erroneously filld-in (only happens on very bad scans), or fill in ventricles which should appear white (not strictly necessary unless the surface actually follows in to the ventricles.

To make a white matter edit you first have to switch the editing volume from the main volume (brainmask) to the auxilary volume (wm). This is Very important.

Tools – Configure Brush Info

A window will appear. You can now choose to edit the Main Volume or the auxilary volume. To edit wm, choose aux volume. Use the middle mouse button to ADD white matter voxels. Use the right mouse button to remove voxels.

Pial Edits

These can be the most difficult and time consuming. To edit do the same as for the white matter edits, only set the target surface to “main” and not “aux”. In general pial edits around the dura are quick and easy to fix, but skull-stripping issues are complex and there are better ways to address these issues than edits (changing the parameters of the skull-stripping step). Mail me if you run in to difficulties.


Running "FreeSurfer"=

FreeSurfer commands can be run one at a time or scripted. I have written out some scripts in my home folder which you can edit to your own ends. Again, to edit use vi.

To run FreeSurfer on brains incorporating saved edits, type

recon-all –subjid (subject) –autorecon-2-cp –autorecon3

The FS process is divided in to three main parts (autorecon1, 2, 3). Edits are done to volumes and surfaces made after autorecon1 so you don’t have to re-run that bit again. Edits are implemented in the order they appear in the processing stream, so by running the control point edits (“-cp”), all other edits are taken in to account.


Back To Main Page

Main Page