top | Longitudinal Tutorial

Fixing a bad skull strip

Identifying the problem

Very rarely, you will see FreeSurfer fail completely in the skullstrip step (usually associated with many other errors) as is clearly the case in the following example. For the purpose of this tutorial we will only focus on and fix the skull strip error.

Please take a look at subject OAS2_0004 in tkmedit, examine all cross, longs, and base (in separate terminals):

tkmedit OAS2_0004 brainmask.mgz  -aux T1.mgz -surfs
tkmedit OAS2_0004_MR1 brainmask.mgz  -aux T1.mgz -surfs
tkmedit OAS2_0004_MR2 brainmask.mgz  -aux T1.mgz -surfs
tkmedit OAS2_0004_MR1.long.OAS2_0004 brainmask.mgz  -aux T1.mgz -surfs
tkmedit OAS2_0004_MR2.long.OAS2_0004 brainmask.mgz  -aux T1.mgz -surfs

As you can see, the skull strip for this subject is very poor for both timepoints MR1 and MR2, therefore affecting the results of the base and the longitudinals downstream. Don't be overwhelmed by other problems presented in this case. You should always find out if there is a skullstrip error first, fix that, then attack the rest of the problems. You'll be surprised how much less you'll have to go through in the end.

Take it one step at a time. First, take a look at the coronal slice 125 for OAS2_0004_MR1, you can see that the entire neck is still present.
0004_tp1_125_before.jpg

Now look at OAS2_0004_MR2. This timepoint looks even worse with parts of the skull still present and parts of the brain stripped off. If you scroll to slice 66, you will see that a great part of the brain is missing. Below is the comparison between the brainmask.mgz and T1.mgz for slice 66.
0004_tp2_66bm_before.jpg 0004_tp2_66t1_before.jpg

Fixing the problem

The best way to fix a problem like this is to adjust the watershed parameters. As mentioned earlier, this can only be done on the cross-sectionals, and you'll have to use the edited cross-sectionals to recreate the base and the longitudinals afterwards.

Adjust the watershed parameters for both MR1 and MR2 using the following commands. Feel free to run these commands (separately) since this step is fairly quick.

recon-all -subjid OAS2_0004_MR1 -skullstrip -wsthresh 20 -clean-bm -no-wsgcaatlas
recon-all -subjid OAS2_0004_MR2 -skullstrip -wsthresh 55 -clean-bm -no-wsgcaatlas

For OAS2_0004_MR1, the brain is intact while a lot of the skull is left behind, therefore we decreased the watershed threshold. As for OAS2_0004_MR2, we don't want to strip away more brain so we increased the threshold. Play around with different numbers and see what you get.

If you ran the commands, take a look at your output volumes (directory w/o _fixed), or simply check our edited volumes, and verify that the result of the new skull stripping is correct. Don't forget to run the rest of the cross sectional recon-all steps for all timepoints that you made an adjustment to:

recon-all -subjid OAS2_0004_MR1 -autorecon2 -autorecon3
recon-all -subjid OAS2_0004_MR2 -autorecon2 -autorecon3

These _fixed versions were already ran with -autorecon2 and -autorecon3.

tkmedit OAS2_0004_MR1_fixed brainmask.mgz -aux T1.mgz -surfs
tkmedit OAS2_0004_MR2_fixed brainmask.mgz -aux T1.mgz -surfs

To save time, you can check in with the recon-all-status.log in the scripts directory of these subjects to see if the normalization step is complete. Once that step is complete, you can start recreating your base (remove/rename the base dir if it existed, e.g. mv OAS2_0004 OAS2_0004_old, before running this). Alternatively, you can wait until the recons are complete to check whether all surfaces are updated as desired.

Here are the results for OAS2_0004_MR1 slice 125 and OAS2_0004_MR2 slice 66.
0004_tp1_125_after.jpg 0004_tp2_66bm_after.jpg

*Notice the huge improvement between OAS2_0004_MR2_fixed and the original one. You might not arrive at this output if you just ran the watershed parameter with threshold 55 and rerunning -autorecon2 -autorecon3 once. After those initial runs, we noticed that there was still a good amount of skull left over, so we ran the following commands:

recon-all -skullstrip -subjid OAS2_0004_MR2
recon-all -autorecon2 -autorecon3 -subjid OAS2_0004_MR2

Sometimes just rerunning the -skullstrip step will help fix the problem without you having to do any extra adjustments. This is because during this step, FreeSurfer uses the exisiting brainmask.mgz as input and that can make a big difference on the output.

Recreating base and longs

Now you are ready to recreate the base. These steps take very long so you do not need to run them for the tutorial.

recon-all -base OAS2_0004 -tp OAS2_0004_MR1 -tp OAS2_0004_MR2 -all

Then, the final step is to recreate the longitudinals once base and cross sectional runs are complete:

recon-all -long OAS2_0004_MR1 OAS2_0004 -all
recon-all -long OAS2_0004_MR2 OAS2_0004 -all

**NOTE: When recreating the base and longitudinals, it is recommended to remove or rename the existing base and longitudinal directories and start those processes from scratch, if possible.

Viewing final results

You can examine the corrected version of the base and longitudinals by using the following commands in separate terminals.

tkmedit OAS2_0004_fixed brainmask.mgz -aux T1.mgz -surfs
tkmedit OAS2_0004_MR1.long.OAS2_0004_fixed brainmask.mgz -aux T1.mgz -surfs
tkmedit OAS2_0004_MR2.long.OAS2_0004_fixed brainmask.mgz -aux T1.mgz -surfs


If you were horrified while looking at the base earlier, which is the left image at slice 120 below, compare it to the right image, also at slice 120, after the skullstrip fix.
0004_120_before.jpg 0004_120_after.jpg

And here are the longitudinals for OAS2_0004_MR2.long.OAS2_0004. Before (left) at slice 145 and after (right) at the same slice.
0004_long2_145_before.jpg 0004_long2_145_after.jpg

Note that, although much has been fixed, there are still problems here that need special treatment (e.g. exclusion of wm from the surfaces at various places). With these, you can start making manual edits on the wm or you can use other appropriate methods.

*Take home message* - although your case might appear like this one we just went through, and you might think that it's impossible to remedy, take it one step at a time. Usually several adjustments to the skullstrip parameters can make this big of a difference.


For more details on skull strip errors and the different ways to fix them, refer back to the Troubleshooting Skull Strip Tutorial.

FsTutorial/LongSkullStripFix2 (last edited 2013-04-23 17:00:48 by MartinReuter)