Differences between revisions 8 and 9
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
As you probably noticed, the skullstrip only failed at the first timepoint for this subject, OAS2_0088_MR1. There is quite a lot of skull left behind and that adversely affected the surfaces and the aseg. The image below is taken at slice 90. <<BR>>
{{attachment:0088_tp1_90_before.jpg}}<<BR>>
Although the surfaces and the aseg look pretty bad for this timepoint, the surfaces in the base are correct, therefore the surfaces in the long is also correct (since surfaces are copied from the base to the long). However, notice that in OAS2_0088_MR1.long.OAS2_0088, the aseg for the cerebellum is still overlabeling to the dura. Image below at slice 100. <<BR>>
{{attachment:0088_long1_100_before.jpg}}<<BR>>
It is then good to correct this problem. You can simply correct this by adjusting the watershed parameter for timepoint 1. Because the default threshold is always 25, to remove more skull, we need to decrease it. This should only take a couple minutes to complete, so feel free to run the command.
<<TableOfContents>>
=== Identifying the problem ===

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.<<BR>>
{{attachment:0004_tp1_125_before.jpg}} <<BR>>
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. <<BR>>
{{attachment:0004_tp2_66bm_before.jpg}} {{attachment:0004_tp2_66t1_before.jpg}} <<BR>>
=== 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.
Line 10: Line 16:
recon-all -subjid OAS2_0088_MR1 -skullstrip -wsthresh 20 -clean-bm -no-wsgcaatlas recon-all -subjid OAS2_0004_MR1 -skullstrip -wsthresh 20 -clean-bm -no-wsgcaatlas
Line 12: Line 18:
----
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:
Line 15: Line 19:
freeview -v OAS2_0088_MR1_fixed/mri/T1.mgz \
            OAS2_0088_MR1_fixed/mri/brainmask.mgz \
            OAS2_0088_MR1_fixed/mri/aseg.mgz:colormap=lut:opacity=0.2 \
         -f OAS2_0088_MR1_fixed/surf/lh.pial:edgecolor=red \
            OAS2_0088_MR1_fixed/surf/rh.pial:edgecolor=red \
            OAS2_0088_MR1_fixed/surf/lh.white:edgecolor=blue \
            OAS2_0088_MR1_fixed/surf/rh.white:edgecolor=blue
recon-all -subjid OAS2_0004_MR2 -skullstrip -wsthresh 55 -clean-bm -no-wsgcaatlas
Line 23: Line 21:
After you are satisfied with the results, remember to run the rest of the cross sectional recon-all steps. Notice that although the extra skull is stripped off, the surfaces and the aseg are still incorrect, you'll need to run the following command in order to recreate the surfaces and the aseg. (This step will take very long so you don't need to run it for this tutorial.) 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:
Line 25: Line 24:
recon-all -subjid OAS2_0088_MR1 -autorecon2 -autorecon3 recon-all -subjid OAS2_0004_MR1 -autorecon2 -autorecon3
Line 27: Line 26:
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. Or you can wait until the entire recon is done to check whether the surfaces and aseg are updated. They should. To check the corrected version:
Line 29: Line 27:
freeview -v OAS2_0088_MR1_fixed/mri/T1.mgz \
            OAS2_0088_MR1_fixed/mri/brainmask.mgz \
            OAS2_0088_MR1_fixed/mri/aseg.mgz:colormap=lut:opacity=0.2 \
         -f OAS2_0088_MR1_fixed/surf/lh.pial:edgecolor=red \
            OAS2_0088_MR1_fixed/surf/rh.pial:edgecolor=red \
            OAS2_0088_MR1_fixed/surf/lh.white:edgecolor=blue \
            OAS2_0088_MR1_fixed/surf/rh.white:edgecolor=blue
recon-all -subjid OAS2_0004_MR2 -autorecon2 -autorecon3
Line 37: Line 29:
Notice the major improvement on the same slice 90 for OAS2_0088_MR1. <<BR>>
{{attachment:0088_tp1_90_after.jpg}}<<BR>>
Once that step is complete, you can start recreating your base (remove/rename the base dir if it existed, e.g. {{{mv OAS2_0088 OAS2_0088_old}}}, before running this).
To recreate the base using the newly created timepoint(s), use the following command:
These _fixed versions were already ran with -autorecon2 and -autorecon3.
Line 42: Line 31:
recon-all -base OAS2_0088 -tp OAS2_0088_MR1 -tp OAS2_0088_MR2 -all 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.<<BR>>
{{attachment:0004_tp1_125_after.jpg}} {{attachment:0004_tp2_66bm_after.jpg}} <<BR>>
*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
Line 46: Line 64:
recon-all -long OAS2_0088_MR1 OAS2_0088 -all recon-all -long OAS2_0004_MR1 OAS2_0004 -all
Line 49: Line 67:
recon-all -long OAS2_0088_MR2 OAS2_0000 -all recon-all -long OAS2_0004_MR2 OAS2_0004 -all
Line 51: Line 69:
**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, e.g. {{{mv OAS2_0004 OAS2_0004_old}}}. **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 ===
Line 54: Line 73:
freeview -v OAS2_0088_fixed/mri/T1.mgz \
            OAS2_0088_fixed/mri/brainmask.mgz \
            OAS2_0088_fixed/mri/aseg.mgz:colormap=lut:opacity=0.2 \
         -f OAS2_0088_fixed/surf/lh.pial:edgecolor=red \
            OAS2_0088_fixed/surf/rh.pial:edgecolor=red \
            OAS2_0088
_fixed/surf/lh.white:edgecolor=blue \
            OAS2_0088_fixed/surf/rh.white:edgecolor=blue
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.pi
al:edgecolor=red \
            OAS2_0004
_fixed/surf/lh.white:edgecolor=blue \
            OAS2_0004_fixed/surf/rh.white:edgecolor=blue
Line 63: Line 81:
freeview -v OAS2_0088_MR1.long.OAS2_0088_fixed/mri/T1.mgz \
            OAS2_0088_MR1.long.OAS2_0088_fixed/mri/brainmask.mgz \
            OAS2_0088_MR1.long.OAS2_0088_fixed/mri/aseg.mgz:colormap=lut:opacity=0.2 \
         -f OAS2_0088_MR1.long.OAS2_0088_fixed/surf/lh.pial:edgecolor=red \
            OAS2_0088_MR1.long.OAS2_0088_fixed/surf/rh.pial:edgecolor=red \
            OAS2_0088_MR1.long.OAS2_0088_fixed/surf/lh.white:edgecolor=blue \
            OAS2_0088_MR1.long.OAS2_0088_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
Line 72: Line 89:
freeview -v OAS2_0088_MR2.long.OAS2_0088_fixed/mri/T1.mgz \
            OAS2_0088_MR2.long.OAS2_0088_fixed/mri/brainmask.mgz \
            OAS2_0088_MR2.long.OAS2_0088_fixed/mri/aseg.mgz:colormap=lut:opacity=0.2 \
         -f OAS2_0088_MR2.long.OAS2_0088_fixed/surf/lh.pial:edgecolor=red \
            OAS2_0088_MR2.long.OAS2_0088_fixed/surf/rh.pial:edgecolor=red \
            OAS2_0088_MR2.long.OAS2_0088_fixed/surf/lh.white:edgecolor=blue \
            OAS2_0088_MR2.long.OAS2_0088_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
Line 81: Line 97:
You should not notice any changes to the base and the long for timepoint 2, however there is an improvement on the aseg for the long of timepoint 1. Here is the same slice 100 as shown above. <<BR>>
{{attachment:0088_long1_100_after.jpg}}<<BR>>
----
Now that was a fairly simple case, if you are still up for it, click [[FsTutorial/LongSkullStripFix2_freeview|here]] for a bigger challenge.
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. <<BR>>
{{attachment:0004_120_before.jpg}} {{attachment:0004_120_after.jpg}} <<BR>>
And here are the longitudinals for OAS2_0004_MR2.long.OAS2_0004. Before (left) at slice 145 and after (right) at the same slice. <<BR>>
{{attachment:0004_long2_145_before.jpg}} {{attachment:0004_long2_145_after.jpg}} <<BR>>
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.

top | Longitudinal Tutorial

Fixing a bad skull strip

  • To follow this exercise exactly be sure you've downloaded the tutorial data set before you begin. If you choose not to download the data set you can follow these instructions on your own data, but you will have to substitute your own specific paths and subject names.

Identifying the problem

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.

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:

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.

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 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/LongSkullStripFix_freeview (last edited 2017-09-26 11:21:04 by MorganFogarty)