top | Longitudinal Tutorial

Fixing a bad skull strip

Identifying the problem

After looking at the completely misaligned average image in the base, you can see, that the skull strip for this subject is very poor for both timepoints MR1 and MR2 (cross), 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. The commands to load these subjects (copied from the main LongitudinalTutorial page) are here:

freeview -v OAS2_0004_MR1/mri/T1.mgz \
            OAS2_0004_MR1/mri/brainmask.mgz \
         -f OAS2_0004_MR1/surf/lh.pial:edgecolor=red \
            OAS2_0004_MR1/surf/rh.pial:edgecolor=red \
            OAS2_0004_MR1/surf/lh.white:edgecolor=blue \
            OAS2_0004_MR1/surf/rh.white:edgecolor=blue

freeview -v OAS2_0004_MR2/mri/T1.mgz \
            OAS2_0004_MR2/mri/brainmask.mgz \
         -f OAS2_0004_MR2/surf/lh.pial:edgecolor=red \
            OAS2_0004_MR2/surf/rh.pial:edgecolor=red \
            OAS2_0004_MR2/surf/lh.white:edgecolor=blue \
            OAS2_0004_MR2/surf/rh.white:edgecolor=blue

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 (This command is optional).

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. It is necessary to run the rest of the cross sectional recon-all steps for all timepoints that you made an adjustment to:

Don't run these commands

It will take > 6h and has already been done for you.

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.

freeview -v OAS2_0004_MR1_fixed/mri/T1.mgz \
            OAS2_0004_MR1_fixed/mri/brainmask.mgz \
         -f OAS2_0004_MR1_fixed/surf/lh.pial:edgecolor=red \
            OAS2_0004_MR1_fixed/surf/rh.pial:edgecolor=red \
            OAS2_0004_MR1_fixed/surf/lh.white:edgecolor=blue \
            OAS2_0004_MR1_fixed/surf/rh.white:edgecolor=blue

freeview -v OAS2_0004_MR2_fixed/mri/T1.mgz \
            OAS2_0004_MR2_fixed/mri/brainmask.mgz \
         -f OAS2_0004_MR2_fixed/surf/lh.pial:edgecolor=red \
            OAS2_0004_MR2_fixed/surf/rh.pial:edgecolor=red \
            OAS2_0004_MR2_fixed/surf/lh.white:edgecolor=blue \
            OAS2_0004_MR2_fixed/surf/rh.white:edgecolor=blue

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:

Don't run these commands

It will take a while and has already been done for you.

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 existing 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.

Don't run these commands

It will take a while and has already been done for you.

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.

freeview -v OAS2_0004_fixed/mri/T1.mgz \
            OAS2_0004_fixed/mri/brainmask.mgz \
         -f OAS2_0004_fixed/surf/lh.pial:edgecolor=red \
            OAS2_0004_fixed/surf/rh.pial:edgecolor=red \
            OAS2_0004_fixed/surf/lh.white:edgecolor=blue \
            OAS2_0004_fixed/surf/rh.white:edgecolor=blue

freeview -v OAS2_0004_MR1.long.OAS2_0004_fixed/mri/T1.mgz \
            OAS2_0004_MR1.long.OAS2_0004_fixed/mri/brainmask.mgz \
         -f OAS2_0004_MR1.long.OAS2_0004_fixed/surf/lh.pial:edgecolor=red \
            OAS2_0004_MR1.long.OAS2_0004_fixed/surf/rh.pial:edgecolor=red \
            OAS2_0004_MR1.long.OAS2_0004_fixed/surf/lh.white:edgecolor=blue \
            OAS2_0004_MR1.long.OAS2_0004_fixed/surf/rh.white:edgecolor=blue

freeview -v OAS2_0004_MR2.long.OAS2_0004_fixed/mri/T1.mgz \
            OAS2_0004_MR2.long.OAS2_0004_fixed/mri/brainmask.mgz \
         -f OAS2_0004_MR2.long.OAS2_0004_fixed/surf/lh.pial:edgecolor=red \
            OAS2_0004_MR2.long.OAS2_0004_fixed/surf/rh.pial:edgecolor=red \
            OAS2_0004_MR2.long.OAS2_0004_fixed/surf/lh.white:edgecolor=blue \
            OAS2_0004_MR2.long.OAS2_0004_fixed/surf/rh.white:edgecolor=blue


If you were horrified while looking at the base earlier, which is the left image at coronal slice 120 below, compare it to the right image, also at coronal 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.