Differences between revisions 142 and 159 (spanning 17 versions)
Revision 142 as of 2011-06-27 11:12:36
Size: 19844
Comment:
Revision 159 as of 2013-11-01 14:23:49
Size: 22217
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## page was renamed from FsTutorial/OutputData
Line 2: Line 3:
Line 3: Line 5:
Line 9: Line 10:
Line 15: Line 17:
These two commands set the SUBJECTS_DIR variable to the directory where the data is stored and then navigates into this directory. You can now skip ahead to the tutorial (below the gray line).  These two commands set the SUBJECTS_DIR variable to the directory where the data is stored and then navigates into this directory. You can now skip ahead to the tutorial (below the gray line).
Line 18: Line 20:
If you are '''NOT''' taking one of the formally organized courses, then to follow this exercise exactly be sure you've downloaded the [[FsTutorial/Data|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.
These are the commands that you need to run before getting started:
If you are '''NOT''' taking one of the formally organized courses, then to follow this exercise exactly be sure you've downloaded the [[FsTutorial/Data|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. These are the commands that you need to run before getting started:
Line 26: Line 28:
Notice the command to open tcsh. If you are already running the tcsh command shell, then the 'tcsh' command is not necessary.
If you are not using the tutorial data you should set your {{{SUBJECTS_DIR}}} to the directory in which the recon(s) of the subject(s) you will use for this tutorial are located.
Notice the command to open tcsh. If you are already running the tcsh command shell, then the 'tcsh' command is not necessary. If you are not using the tutorial data you should set your {{{SUBJECTS_DIR}}} to the directory in which the recon(s) of the subject(s) you will use for this tutorial are located.
Line 32: Line 34:
Line 39: Line 42:
 * good_output : name of subject 
 * brainmask.mgz : skull-stripped volume primarily used for troubleshooting (found in $SUBJECTS_DIR/good_output/mri). 

* good_output : name of subject
 * brainmask.mgz : skull-stripped volume primarily used for troubleshooting (found in $SUBJECTS_DIR/good_output/mri).
Line 43: Line 47:
 * -aseg : loads automatic volume segmentation called aseg.mgz 

You should see a tkmedit window open:<<BR>>
(use the zoom {{attachment:icon_zoom_in.gif}} and move {{attachment:icon_navigate.gif}} buttons to match the snapshot below)<<BR>><<BR>>
{{attachment:good_output_128.jpg}}
<<BR>>

You are currently looking at the brainmask.mgz with the surfaces displayed and the aseg.mgz (subcortical segmentation) overlayed. The pial (red line), and white (yellow line) surfaces are shown. You can toggle between the brainmask.mgz (loaded as the "main" volume) and the T1.mgz (loaded as the "auxiliary" or 2nd volume) with buttons {{attachment:icon_aux_volume.gif}} and {{attachment:icon_main_volume.gif}}. As you switch between these two buttons, notice that at the top of the display window, the asterisks (**) surround the name of the volume you are currently looking at.
 '''Keyboard Shortcut''': Alt-c will allow you to quickly switch back and forth between the two volumes instead of clicking between these buttons.    

If you hover your mouse over a button in the Tkmedit Tools window, a pop-up will tell you what it does and its keyboard shortcut. When the Navigation button {{attachment:icon_navigate.gif}} is chosen, you can drag the brain around in the display window. Try it out. Notice, you are not be able to move around the cursor (the little red cross-hair). To change the location of the cursor, choose any button to the right of the Navigation button and then left-click anywhere in the display window. Notice the cursor move to wherever you click.

When you zoom, it will zoom into the location of the cursor. When you change brain orientation, it will change to the slice where the cursor is located.

To change which brain slice you are viewing, you can use the + or - buttons next to where it says "Slice". 
 '''Keyboard Shortcut''': Use the Up or Down arrows on your keyboard to change slices faster (this will only work when the mouse is in the display window and not on the Tools window).   
 * -aseg : loads automatic volume segmentation called aseg.mgz

You should see a tkmedit window open:<<BR>> (use the zoom {{attachment:icon_zoom_in.gif}} and move {{attachment:icon_navigate.gif}} buttons to match the snapshot below)<<BR>><<BR>> {{attachment:good_output_128.jpg}} <<BR>>

You are currently looking at the brainmask.mgz with the surfaces displayed and the aseg.mgz (subcortical segmentation) overlayed. The pial (red line), and white (yellow line) surfaces are shown. You can toggle between the brainmask.mgz (loaded as the "main" volume) and the T1.mgz (loaded as the "auxiliary" or 2nd volume) with buttons {{attachment:icon_aux_volume.gif}} and {{attachment:icon_main_volume.gif}} . As you switch between these two buttons, notice that at the top of the display window, the asterisks (**) surround the name of the volume you are currently looking at.

 .
'''Keyboard Shortcut''': Alt-c will allow you to quickly switch back and forth between the two volumes instead of clicking between these buttons.

If you hover your mouse over a button in the Tkmedit Tools window, a pop-up will tell you what it does and its keyboard shortcut. When the Navigation button {{attachment:icon_navigate.gif}} is chosen, you can drag the brain around in the display window. Try it out. Notice how you are not able to move around the cursor (the little red cross-hair).

 . To change the location of the cursor, choose any button to the right of the Navigation button and then left-click in the display window. Notice the cursor move to wherever you click. When you zoom, it will zoom into the location of the cursor. When you change brain orientation (to axial or sagittal), you will be viewing the slice where the cursor was located in that plane.

To change which brain slice you are viewing, you can use the + or - buttons next to where it says "Slice".

 .
'''Keyboard Shortcut''': Use the Up or Down arrows on your keyboard to change slices faster (this will only work when the Display window is selected and not on the Tools window).
Line 61: Line 64:
 1. Whether the surfaces accurately follow the gray matter and white matter boundaries.  
1. Whether the surfaces accurately follow the gray matter and white matter boundaries.
Line 64: Line 68:
below are a few things to notice about the data you have loaded.
 *intensity normalization
 *skull strip
 *wm.mgz volume
 *the final surfaces
 *subcortical segmentation

'''Checking the Surfaces'''
'''''Tip''''': It may be easier to concentrate on the surfaces if you toggle off the aseg with the {attachment:icon_seg_volume.gif}} button.
 '''Keyboard Shortcut''': Ctrl-g will also turn off the aseg.

Toggle to the brainmask volume, if not already in view, by using the {{attachment:icon_main_volume.gif}} button or Alt-c. The white surface (yellow line) is used to calculate total white matter volume and should accurately follow the boundary between white matter and gray matter. The pial surface is used to calculate cortical gray matter volume. The distance between the pial and the white is how cortical thickness is calculated. The pial surface should accurately follow the boundary between the gray matter and the CSF. As you scroll through the slices keep in mind that you are looking at a 2-dimensional rendering of a 3-dimensional image, be sure to look at more than just one view too (i.e., sagittal, coronal and horizontal). To check your surfaces you will need to toggle them back on with the {{attachment:icon_pial_surface.gif}} for the pial surface and {{attachment:icon_main_surface.gif}} for the white surface.

There are regions where the surfaces are not intended to be accurate that you should be aware of. Areas around the hippocampus and amygdala, as well as along the midline cutting plane will often show some inaccuracies. The pial surfaces will not follow the border of the amygdala, instead it will curve inward, mimicking the white surface (see coronal slice 137). Along the midline cut it is possible to see some overlapping of the surfaces from one hemisphere to another.

'''Subcortical Segmentation'''

Toggle on the subcortical segmentation with the {{attachment:icon_seg_volume.gif}} button. This will show the complete segmentation of the subcortical structures. Each structure is labeled with a unique color/number distinction. If you click on a voxel the structures name and number label will be shown in the Tkmedit Toolbox. Scrolling through the slices you will be able to see that everything is labeled, and done so accurately. Sometimes it is easier to see the structures and their boundaries looking in either the sagittal or horizontal view, so be sure to check around in all of them.

'''Intensity Normalization'''

Scroll through the brainmask volume and notice that the intensity is all uniform. You should not see any very bright or very dark spots. If you click on any voxel that is in the wm you can see that it has been normalized to an intensity of (or very close to) 110. The voxel intensity is shown in the Tkmedit Toolbox. This check and the following, Skull Strip check, can be done simultaneously since they both require you to look at features on the brainmask volume.

'''Skull Strip'''

Scroll through the brainmask volume and notice that there is no skull left in your image. Notice also that the cerebellum is still included in the brainmask volume. You should not see any large areas of skull left behind, or any areas of cortex or cerebellum removed from this volume. You should compare the brainmask.mgz volume to the T1.mgz volume that is also loaded to ensure that the skullstrip has worked properly. You can switch between views in a number of ways, ctrl-1 will show the main volume and ctrl-2 will show the auxiliary volume, or you can use the buttons {{attachment:icon_aux_volume.gif}} and {{attachment:icon_main_volume.gif}}. Alt-c will allow you to quickly switch back and forth between the two volumes. This check and the previous, Intensity Normalization check, can be done simultaneously since they both require you to look at features on the brainmask volume.

'''White Matter Volume'''

To check the wm volume you should load it in as a new aux volume. To do this go to ''' File -> Aux Volume -> Load Aux Volume ''' and browse to {{{wm.mgz}}}. This will open the white matter volume, which will look like this:
=== Checking the Surfaces ===
Toggle to the brainmask volume, if not already in view, by using the {{attachment:icon_main_volume.gif}} button or Alt-c. The white surface (yellow line) is used to calculate total white matter volume and should accurately follow the boundary between white matter and gray matter. The pial surface is used to calculate cortical gray matter volume and should accurately follow the boundary between the gray matter and the CSF.

''Tip: It may be easier to concentrate on the surfaces if you toggle off the aseg with the {{attachment:icon_seg_volume.gif}} button.''

 . '''Keyboard Shortcut''': Ctrl-g will also turn off the aseg.

As you scroll through the slices checking the surfaces, keep in mind that you are looking at a 2-dimensional rendering of a 3-dimensional image - be sure to look at more than just one view (i.e., sagittal, coronal and horizontal). To check your surfaces, toggle them off and on with {{attachment:icon_pial_surface.gif}} for the pial surface and {{attachment:icon_main_surface.gif}} for the white surface. Would you draw the boundary in the same location? Adjust the brightness and contrast so you can see the shift in intensity between gray and white. You can do this by going to '''View > Configure > Brightness/Contrast''' in the Tkmedit Tools window and then moving the sliders to adjust the levels.

 . '''Keyboard Shortcut''''''s''': You can also use Ctrl-p and Cltr-m to turn on and off the pial and white surfaces.
 . If the Tkmedit Tools window is highlighted, Ctrl+b will open the Brightness/Contrast window. Alternatively, you can hold down the shift button and drag the left mouse button in the display window and this will change the brightness/contrast without using the sliders.

There are regions where the surfaces are not intended to be accurate that you should be aware of:

 * Areas around the hippocampus and amygdala. The surfaces will not completely include or exclude certain subcortical regions. These inaccuracies can be ignored as subcortical regions are excluded from the cortical measures and subcortical volume is measured by the aseg, not the surfaces.
  * For an example of this, see coronal slice 137 (enter 137 into the box next to where it says "Slice" and hit enter).
 * Along the midline cut, it is possible to see some overlapping of the surfaces from one hemisphere to another. The medial wall is not included in the cortical measures so this can generally be ignored.

=== Subcortical Segmentation ===
Toggle on the subcortical segmentation with the {{attachment:icon_seg_volume.gif}} button or Ctrl-g. This will show the complete segmentation of the subcortical structures. Each structure is labeled with a unique color/number distinction. If you click on a voxel the structures name and number label will be shown in the Tkmedit Tools window (under where it says "Cursor"). Toggle the aseg on and off to make sure the aseg is accurately following the underlying intensity boundaries of each structure. Scrolling through the slices you will be able to see that everything is labeled, and done so accurately. Sometimes it is easier to see the structures and their boundaries looking in either the sagittal or horizontal view, so be sure to check around in all of them. If you hold down the Ctrl button and left click on the {{attachment:icon_seg_volume.gif}} button, a window will pop up that will allow you to adjust the segmentation opacity.

=== Other Things To Do in Tkmedit ===
Below, we introduce you to other volumes and techniques which are good to be familiar with, especially when troubleshooting.

==== Aparc+Aseg segmentation ====
To load the aparc+aseg segmentation you can go to '''File > Load Segmentation''' and browse to the {{{aparc+aseg.mgz}}}. Hit '''OK''' once you have selected the file and then '''OK''' again in the Load Segmentation window. When loaded, it will look like this:

{{attachment:aparc_aseg.jpg}}

This segmentation shows the same subcortical structures that are labeled in the aseg.mgz, but also displays the cortical parcellation labels in the volume (later we will look at the labels on the surface). Click around the cortex to see the name of each cortical region in the Tools window. The aparc+aseg.mgz uses the Desikan-Killiany atlas. To see the Destrieux atlas, you would load the aparc.a2009s+aseg.mgz

==== Skull Strip ====
Turn off the segmentation (Ctrl-g) and scroll through the brainmask volume. Notice that there is no skull left in your image. Notice also that the cerebellum is still included in the volume. You should not see any large areas of skull left behind, or any areas of cortex or cerebellum removed from this volume. You can toggle between the brainmask.mgz volume and the non-skull-stripped, T1.mgz volume using Alt-c to ensure that the skullstrip has worked properly. In the TroubleshootingData tutorial, we'll go over what to do if there was a skull strip error.

==== Intensity Normalization ====
Scroll through the brainmask volume and notice that the intensity is all uniform. You should not see any very bright or very dark spots in the white matter or gray matter. If you click on a voxel in the white matter, you can see that it has been normalized to an intensity of (or very close to) 110 in the Tkmedit Tools Window (under Cursor, next to where it says "brainmask.mgz val"). When wm voxels are not close to 110, they may be erroneously excluded from the white surface. In the TroubleshootingData tutorial, we'll go over what to do if there was an intensity normalization error.

==== WM Volume ====
To check the wm volume you should load it in as a new aux volume. To do this go to ''' File > Aux Volume > Load Aux Volume ''' and browse to {{{wm.mgz}}}. This should open:
Line 97: Line 110:
This volume is comprised of all the voxels that freesurfer is calling white-matter, shown in shades of gray. These are the voxels that were normalized to an intensity of, or very close to, 110 as described above. The bright white voxels are voxels that have been added to the volume during the automatic editting of the wm volume. These edits fill the entire ventricle and basal ganglian defect. You can alternate between the wm.mgz volume ( {{attachment:icon_aux_volume.gif}} button) and the brainmask.mgz volume ({{attachment:icon_main_volume.gif}} button) to see how well freesurfer has classified the white matter.




'''Aparc+Aseg segmentation'''

To load in the aparc+aseg.mgz segmentation you can go to '''File --> Load Segmentation''', and browse to the {{{aparc+aseg.mgz}}}, which will look like this:

{{attachment:aparc_aseg.jpg}}

This segmentation shows the same subcortical structures that are labeled in the aseg.mgz, but uses the cortical parcellation labels around the cortex.
This volume is !FreeSurfer's initial segmentation of the white matter (shown in shades of gray) with additions from the automatic topology fixer (in white). This "mask" is the starting point for the white surface which grows out from here and stops at a more accurate location along the wm/gm boundary using the intensity gradients in the brainmask.mgz volume as a guide. The wm.mgz can be used to add missing wm voxels or delete voxels that are not wm but were included in the surface. In the TroubleshootingData tutorial, we'll go over what to do if there was a wm segmentation error.

You can now close Tkmedit by hitting the '''X''' on the display window. You can also use Ctrl-q to close it.
Line 111: Line 115:

Now that you've checked out everything in tkmedit you can close it and begin to inspect the surfaces that are output, for this you will use tksurfer. Tksurfer displays one hemisphere at a time. This exercise will go through visualizing things on the left hemisphere only, but everything works the same on the right hemisphere (except in the initial command you should specify rh instead of lh if you want to look at the right hemisphere).  To become more familar with the buttons in the Tksurfer Toolbox, please read the [[FsTutorial/Tools|Freesurfer Tools]] section of this tutorial.
Now that you've checked out everything in the volume using tkmedit, you can close it and begin to inspect your data on the surface. For this, you will use tksurfer. Tksurfer displays one hemisphere at a time. This exercise will go through visualizing things on the left hemisphere only, but everything works the same on the right hemisphere (except in the Tksurfer command, you would specify rh instead of lh).
Line 115: Line 118:
 *pial, white and inflated surface
 *sulc and curv curvature files
 *thickness files
 *
cortical parcellation

To open tksurfer with the left hemisphere inflated surface of your subject, '''open a new terminal window''', then use the following command:

 *
pial, white and inflated surface
 * sulc and curv curvature files
 * thickness maps
 *
cortical parcellation

To open Tksurfer with the left hemisphere inflated surface of your subject, '''open a new terminal window''', then use the following command:
Line 128: Line 133:
You should see a tksurfer window open up to this: <<BR>>
{{attachment:tksurfer.jpg}}

You are currently looking at the inflated surface. The surface can be rotated using the buttons in the navigation toolbar: {{attachment:icon_arrow_rot_x_pos.gif}} {{attachment:icon_arrow_rot_z_neg.gif}} {{attachment:icon_arrow_rot_y_neg.gif}} {{attachment:icon_arrow_rot_x_neg.gif}} {{attachment:icon_arrow_rot_y_pos.gif}} {{attachment:icon_arrow_rot_z_pos.gif}}. Use the redraw button {{attachment:icon_redraw.gif}} to repaint the image if it gets corrupted by window movement.
You should see a Tksurfer window open up to this: <<BR>> {{attachment:tksurfer.jpg}}

You are currently looking at the inflated surface. The surface can be rotated using the buttons in the navigation toolbar: {{attachment:icon_arrow_rot_x_pos.gif}} {{attachment:icon_arrow_rot_z_neg.gif}} {{attachment:icon_arrow_rot_y_neg.gif}} {{attachment:icon_arrow_rot_x_neg.gif}} {{attachment:icon_arrow_rot_y_pos.gif}} {{attachment:icon_arrow_rot_z_pos.gif}} . Use the redraw button {{attachment:icon_redraw.gif}} to repaint the image if it gets corrupted by window movement.

 . '''Mouse Shortcut''': Right click in the Tksurfer window to redraw.
Line 135: Line 141:
The inflated surface is good to look at when checking to see if you need to make edits to the wm.mgz volume. You'll notice as you inspect this surface that it is smooth and free from holes, bumps and other defects. If you click on the surface, you will see the coordinates of the vertex you clicked on in the Tools window. To clear the marks made on the surface after clicking on it, you can do Ctrl+Shift+middle click on each mark to erase it. The inflated surface is good to look at when checking to see if you need to make edits to the wm.mgz volume. You'll notice as you inspect this surface that it is smooth and free from holes, bumps and other defects. If you click on the surface, you will see the coordinates of the vertex you clicked on in the Tools window under "Cursor". To clear the marks made on the surface after clicking on it, you can go to Edit > Unmark All Vertices.

 . '''Keyboard Shortcut''': You can unmark one vertex at a time by using
Ctrl+Shift+middle click on each.
 '''Troubleshooting Tip''': If at any point clicking in the Tksurfer window automatically causes you to zoom in, your Ctrl key is stuck. Trying hitting the Ctrl button a few times to get it unstuck.
Line 139: Line 148:
You can load in other surfaces, and tksurfer will then allow you to switch between them all. The easiest way to do this is to hold down CONTROL and click with the right mouse button on the various surface buttons. To load the Pial Surface hold ctrl and right click the pial surface button {{attachment:icon_pial_surface.gif}} a box will pop up where you could browse to the location of the surface you want to load, but it should be already filled in with the path to the lh.pial surface - so you can hit ok. This is what the pial surface will look like: All surfaces (pial, white, orig) have been loaded as a default along with the inflated surface. You can switch to the pial surface by clicking the {{attachment:icon_pial_surface.gif}} button. You should see this:
Line 143: Line 152:
The pial surface is showing you the outer boundary of the gray matter/CSF. This is the same file that was viewed in tkmedit, just represented as a surface image rather than the red outline on the volume. You can inspect this surface by rotating it around as you wish. The pial surface is showing you the outer boundary between the gray matter and CSF (cerebrospinal fluid). This is the same file that was viewed in Tkmedit, just represented as a 3D surface image rather than the red outline on the 2D slices in the brainmask volume. You can inspect this surface by rotating it around as you wish.
Line 147: Line 156:
You can follow the same procedure that you used to load the pial surface for the white surface, except this time hold ctrl and right click the white surface button {{attachment:icon_white_surface.gif}}  You can inspect this surface by rotating it around as you wish.  This is what the white surface will look like: Click on the {{attachment:icon_white_surface.gif}} button to view the white surface. This is what the white surface will look like:
Line 151: Line 160:
The white surface shows the boundary between the white and the gray matter. Again, this is the same file that was viewed in tkmedit (as the yellow outline) just represented in a 3D manner. The white surface shows the boundary between the white and the gray matter. Again, this is the same file that was viewed in Tkmedit (as the yellow outline) just represented in a 3D manner. You can inspect this surface by rotating it around as you wish.
Line 155: Line 164:
Switch back to viewing the inflated surface of the brain by pushing the {{attachment:icon_main_surface.gif}} button. You can now load in the curvature file, lh.curv, by holding ctrl and right clicking on the {{attachment:icon_curv.gif}} button on the tksurfer Tools window. The box that pops up will automatically have selected the lh.curv file, so click ok. The curvature file will look like this: Switch back to viewing the inflated surface of the brain by pushing the {{attachment:TkSurferGuide/TkSurferGeneralUsage/TkSurferInterface/icon_surface_inflated.gif}} button. You can now load in the curvature file, lh.curv, by holding Ctrl and right clicking on the {{attachment:icon_curv.gif}} button on the Tksurfer Tools window. The box that pops up will automatically have selected the lh.curv file, so click ok. The curvature file will look like this:
Line 161: Line 170:
To view the sulc file you could have changed the dialog box to say lh.sulc, or now you can go to '''File -> Curvature -> Load Curvature''' and browse to the {{{lh.sulc file}}} (found in {{{$TUTORIAL_DATA/buckner_data/tutorial_subjs/good_output/surf/}}}). Be sure you select the curvature file for the correct hemisphere, if you select the wrong one it will not look right. The lh.sulc file will load a slightly different display of green/red values than the lh.curv. These are showing the sulcal depth and again here the red regions are sulcal and the green regions are gyral. You can view this as you click on the pial and/or white surfaces. To view the sulc file you could have changed the dialog box to say lh.sulc when right clicking on the curv button as described above, or you can go to '''File > Curvature > Load Curvature''' and browse to the {{{lh.sulc file}}} (found in {{{$TUTORIAL_DATA/buckner_data/tutorial_subjs/good_output/surf/}}}). Be sure you select the curvature file for the correct hemisphere, if you select the wrong one it will not look right. The lh.sulc file will load a slightly different display of green/red values than the lh.curv. These are showing the sulcal depth and again here the red regions are sulcal and the green regions are gyral. You can still view this overlay as you switch to the pial or white surfaces using the {{attachment:icon_pial_surface.gif}} and {{attachment:icon_white_surface.gif}} buttons.
Line 165: Line 174:
To view the thickness maps it is probably best to toggle off the curvature {{attachment:icon_curv.gif}}. You can load the thickness map, lh.thickness, by holding ctrl and right clicking {{attachment:icon_overlay.gif}} on the tksurfer Tools window and browse to the lh.thickness file (you may have to go up a directory - it's found in {{{$TUTORIAL_DATA/buckner_data/tutorial_subjs/good_output/surf/}}}). Be sure you select the thickness file for the correct hemisphere, if you select the wrong one it will not look right. The lh.thickness map should open up and look like this (after the threshold is changed to Linear): To view the thickness maps it is probably best to toggle off the curvature {{attachment:icon_curv.gif}} . You can load the thickness map, lh.thickness, by holding Ctrl and right clicking {{attachment:icon_overlay.gif}} on the Tksurfer Tools window. Browse to the lh.thickness file (you may have to find the subject "good_output" from the list of subjects, then navigate to the {{{surf}}} directory and select {{{lh.thickness}}}). Be sure you select the thickness file for the correct hemisphere, if you select the wrong one it will not look right. The lh.thickness map should open up and look like this:
Line 169: Line 178:
You can adjust the thresholds of the map by going to ''' View -> Configure -> Overlay''' which will open a new window that will allow you to change the thresholds. First click the '''Thresholds: Linear''' checkbox to make the image match that shown above. Then try some different settings and see how it affects the display on the map (some options to try min of 1.0 and max of 3.0, min of 2 max of 5, etc). After you change the min and max values be sure to hit apply. You can adjust the thresholds of the map by going to ''' View > Configure > Overlay''' which will open a new window that will allow you to change the thresholds. First click the '''Thresholds: Linear''' checkbox. Then try some different settings and see how it affects the display on the map (try a Min of 1.0 and Max of 3.0, Min of 2 and Max of 5, etc). After you change the min and max values be sure to hit Apply to see the changes. If the Apply button is not visible to you, hit the space bar to Apply the changes.
Line 173: Line 182:
To view the cortical parcellation it is probably best to toggle off the curvature {{attachment:icon_curv.gif}} and thickness files {{attachment:icon_overlay.gif}} , and to switch to the pial surface, {{attachment:icon_pial_surface.gif}}. You can load the parcellation by going to '''File -> Label -> Import Annotation''' and browsing to the {{{lh.aparc.annot file}}} (found in {{{$TUTORIAL_DATA/buckner_data/tutorial_subjs/good_output/label/}}}). Be sure you select the label file for the correct hemisphere, if you select the wrong one it will not look right. The lh.aparc.annot should open up and like this: To view the cortical parcellation it is probably best to toggle off the curvature {{attachment:icon_curv.gif}} and thickness files {{attachment:icon_overlay.gif}} (if any are still visible), and to switch to the pial surface, {{attachment:icon_pial_surface.gif}} . You can load the parcellation by going to '''File > Label > Import Annotation''' and browsing to the {{{lh.aparc.annot file}}} (found in {{{$TUTORIAL_DATA/buckner_data/tutorial_subjs/good_output/label/}}}). Be sure you select the label file for the correct hemisphere, if you select the wrong one it will not look right. The lh.aparc.annot should open up and like this:
Line 177: Line 186:
You can inspect the parcellation by rotating the surface to see all sides. You can switch to the inflated view, or turn the labels to outline view, whichever way is most comfortable for you to view the parcellations. The parcellation that is loaded here was created with the Desikan-Killiany atlas. By default there are two parcellations that are made when recon-all is run. The second parcellation, called ?h.aparc.a2005s.annot, is created with the Destrieux atlas. The difference is the number and designation of the areas that are labeled. You can load this second parcellation by first going to '''File -> Label -> Delete all Labels'''. This will remove the first parcellation. Then you can repeat the steps for loading a parcellation, this time browsing to lh.aparc.a2005s.annot to load the second parcellation. Click on a color and view the name of the cortical region in the Tksurfer Tools box. Rotate the brain so you are looking at the medial wall. Notice that all subcortical gray matter is not a part of the surface labels (because again, those areas do not count towards the cortical surface measures). You can also switch to the inflated view and turn the labels to outlines using the {{attachment:TkSurferGuide/TkSurferGeneralUsage/TkSurferInterface/icon_label_outline.gif}} button.

The parcellation that is loaded here was created with the Desikan-Killiany atlas. By default there are two parcellations that are made when recon-all is run. The second parcellation, called ?h.aparc.a2009s.annot, is created with the Destrieux atlas. The difference is the number and designation of the areas that are labeled. You can load this second parcellation by first going to '''File -> Label -> Delete all Labels'''. This will remove the first parcellation. Then you can repeat the steps for loading a parcellation, this time browsing to lh.aparc.a2009s.annot to load the second parcellation.
Line 180: Line 191:

When you are viewing the same subject in tkmedit and tksurfer at the same time (generally done using two separate terminals, one to launch tkmedit and one to launch tksurfer) you can use some tools to switch from one point on the surface (in tksurfer) to the same point in the volume (in tkmedit). To do this, first put your cursor at the point you want in tksurfer. Next, click the save point button {{attachment:icon_cursor_save.gif}} in tksurfer. This will save the cursor position. Then, in the tkmedit toolbox window, click the goto saved point button {{attachment:icon_cursor_goto.gif}} . This will now bring you to the same point, only in the volume. Look for the red plus sign (it is small and can be hard to find, depending on the saved point, but should be near the surface for this example). This technique is very useful when you see something wrong on the surface of a subject (in tksurfer) and you want to see what is happening in the volume in that same place.
When you are viewing the same subject in Tkmedit and Tksurfer at the same time you can click on a point on the surface (in tksurfer) and automatically locate the same point in the volume (in tkmedit). To do this, first open a '''new''' terminal window so you can open up the same subject in Tkmedit as you have open in Tksurfer:

----
{{{
tkmedit good_output brainmask.mgz \
        -aux T1.mgz -surfs -aseg
}}}
----
Click on a location in Tksurfer. Next, click the save point button {{attachment:icon_cursor_save.gif}} in the Tksurfer Tools window. This will save the cursor position. Then, in the Tkmedit Tools window, click the "goto saved point" button {{attachment:icon_cursor_goto.gif}} . This will now bring you to the same point, only in the volume. Look for the new location of the cursor in Tkmedit. If you are having trouble finding it, the red lines on the edges of the Tkmedit display window will indicate which row and column it is located within. You can also click on a point in Tkmedit, save it using the {{attachment:icon_cursor_save.gif}} button and opening the same point in Tksurfer using the {{attachment:icon_cursor_goto.gif}} button.

This technique is very useful when you see something wrong on the surface of a subject (in Tksurfer) and you want to see what is happening in the volume in that same place and vice versa.

When you are done, you can close Tksurfer by going to '''File > Quit'''. You can close Tkmedit by hitting the '''X''' on the display window or going to '''File > Quit '''. You can also do Ctrl-q to quit for both.

-----

top | previous | next

Inspection of Freesurfer Output

In this exercise you will visualize and inspect correctly processed output data so that you can become familiar with what the end product should look like. The exercise will take you through a variety of output, but is not necessarily the recommended procedure to take when trying to verify each subject. Some outputs are only necessary to check when there are problems or for a particular type of study. However it is a good idea for new users to become familiar with what the expected output should look like and how to view it.

Preparations

If You're at an Organized Course

If you are taking one of the formally organized courses, everything has been set up for you on the provided laptop. The only thing you will need to do is run the following commands in every new terminal window (aka shell) you open throughout this tutorial. Copy and paste the commands below to get started:

setenv SUBJECTS_DIR $TUTORIAL_DATA/buckner_data/tutorial_subjs
cd $SUBJECTS_DIR

To copy: Highlight the command in the box above, right click and select copy (or use keyboard shortcut Ctrl+c), then use the middle button of your mouse to click inside the terminal window (this will paste the command). Press enter to run the command.

These two commands set the SUBJECTS_DIR variable to the directory where the data is stored and then navigates into this directory. You can now skip ahead to the tutorial (below the gray line).

If You're not at an Organized Course

If you are NOT taking one of the formally organized courses, then 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. These are the commands that you need to run before getting started:

tcsh
source your_freesurfer_dir/SetUpFreeSurfer.csh
setenv SUBJECTS_DIR $TUTORIAL_DATA/buckner_data/tutorial_subjs
cd $SUBJECTS_DIR

Notice the command to open tcsh. If you are already running the tcsh command shell, then the 'tcsh' command is not necessary. If you are not using the tutorial data you should set your SUBJECTS_DIR to the directory in which the recon(s) of the subject(s) you will use for this tutorial are located.


Viewing Volumes with Tkmedit

Output volumes can be loaded into tkmedit, along with surface outlines and the subcortical segmentation. With one command line, you can load in the brainmask.mgz and wm.mgz volumes, the rh.white and lh.white surfaces (outlines), and the subcortical segmentation. Copy and paste the command below inside the terminal window:


tkmedit good_output brainmask.mgz \
        -aux T1.mgz -surfs -aseg


Some notes on the above command line:

  • good_output : name of subject
  • brainmask.mgz : skull-stripped volume primarily used for troubleshooting (found in $SUBJECTS_DIR/good_output/mri).
  • -aux T1.mgz : pre-skull-stripped volume loaded as 2nd volume (in $SUBJECTS_DIR/good_output/mri)
  • -surfs : loads all surfaces (orig, white, and pial, for left and right hemispheres)
  • -aseg : loads automatic volume segmentation called aseg.mgz

You should see a tkmedit window open:
(use the zoom icon_zoom_in.gif and move icon_navigate.gif buttons to match the snapshot below)

good_output_128.jpg

You are currently looking at the brainmask.mgz with the surfaces displayed and the aseg.mgz (subcortical segmentation) overlayed. The pial (red line), and white (yellow line) surfaces are shown. You can toggle between the brainmask.mgz (loaded as the "main" volume) and the T1.mgz (loaded as the "auxiliary" or 2nd volume) with buttons icon_aux_volume.gif and icon_main_volume.gif . As you switch between these two buttons, notice that at the top of the display window, the asterisks (**) surround the name of the volume you are currently looking at.

  • Keyboard Shortcut: Alt-c will allow you to quickly switch back and forth between the two volumes instead of clicking between these buttons.

If you hover your mouse over a button in the Tkmedit Tools window, a pop-up will tell you what it does and its keyboard shortcut. When the Navigation button icon_navigate.gif is chosen, you can drag the brain around in the display window. Try it out. Notice how you are not able to move around the cursor (the little red cross-hair).

  • To change the location of the cursor, choose any button to the right of the Navigation button and then left-click in the display window. Notice the cursor move to wherever you click. When you zoom, it will zoom into the location of the cursor. When you change brain orientation (to axial or sagittal), you will be viewing the slice where the cursor was located in that plane.

To change which brain slice you are viewing, you can use the + or - buttons next to where it says "Slice".

  • Keyboard Shortcut: Use the Up or Down arrows on your keyboard to change slices faster (this will only work when the Display window is selected and not on the Tools window).

Now that you know the basics, you can make your way through the data. To verify that FreeSurfer did a good job, you will want to check:

  1. Whether the surfaces accurately follow the gray matter and white matter boundaries.
  2. Whether the aseg accurately follows the subcortical intensity boundaries.

Checking the Surfaces

Toggle to the brainmask volume, if not already in view, by using the icon_main_volume.gif button or Alt-c. The white surface (yellow line) is used to calculate total white matter volume and should accurately follow the boundary between white matter and gray matter. The pial surface is used to calculate cortical gray matter volume and should accurately follow the boundary between the gray matter and the CSF.

Tip: It may be easier to concentrate on the surfaces if you toggle off the aseg with the icon_seg_volume.gif button.

  • Keyboard Shortcut: Ctrl-g will also turn off the aseg.

As you scroll through the slices checking the surfaces, keep in mind that you are looking at a 2-dimensional rendering of a 3-dimensional image - be sure to look at more than just one view (i.e., sagittal, coronal and horizontal). To check your surfaces, toggle them off and on with icon_pial_surface.gif for the pial surface and icon_main_surface.gif for the white surface. Would you draw the boundary in the same location? Adjust the brightness and contrast so you can see the shift in intensity between gray and white. You can do this by going to View > Configure > Brightness/Contrast in the Tkmedit Tools window and then moving the sliders to adjust the levels.

  • Keyboard Shortcuts: You can also use Ctrl-p and Cltr-m to turn on and off the pial and white surfaces.

  • If the Tkmedit Tools window is highlighted, Ctrl+b will open the Brightness/Contrast window. Alternatively, you can hold down the shift button and drag the left mouse button in the display window and this will change the brightness/contrast without using the sliders.

There are regions where the surfaces are not intended to be accurate that you should be aware of:

  • Areas around the hippocampus and amygdala. The surfaces will not completely include or exclude certain subcortical regions. These inaccuracies can be ignored as subcortical regions are excluded from the cortical measures and subcortical volume is measured by the aseg, not the surfaces.
    • For an example of this, see coronal slice 137 (enter 137 into the box next to where it says "Slice" and hit enter).
  • Along the midline cut, it is possible to see some overlapping of the surfaces from one hemisphere to another. The medial wall is not included in the cortical measures so this can generally be ignored.

Subcortical Segmentation

Toggle on the subcortical segmentation with the icon_seg_volume.gif button or Ctrl-g. This will show the complete segmentation of the subcortical structures. Each structure is labeled with a unique color/number distinction. If you click on a voxel the structures name and number label will be shown in the Tkmedit Tools window (under where it says "Cursor"). Toggle the aseg on and off to make sure the aseg is accurately following the underlying intensity boundaries of each structure. Scrolling through the slices you will be able to see that everything is labeled, and done so accurately. Sometimes it is easier to see the structures and their boundaries looking in either the sagittal or horizontal view, so be sure to check around in all of them. If you hold down the Ctrl button and left click on the icon_seg_volume.gif button, a window will pop up that will allow you to adjust the segmentation opacity.

Other Things To Do in Tkmedit

Below, we introduce you to other volumes and techniques which are good to be familiar with, especially when troubleshooting.

Aparc+Aseg segmentation

To load the aparc+aseg segmentation you can go to File > Load Segmentation and browse to the aparc+aseg.mgz. Hit OK once you have selected the file and then OK again in the Load Segmentation window. When loaded, it will look like this:

aparc_aseg.jpg

This segmentation shows the same subcortical structures that are labeled in the aseg.mgz, but also displays the cortical parcellation labels in the volume (later we will look at the labels on the surface). Click around the cortex to see the name of each cortical region in the Tools window. The aparc+aseg.mgz uses the Desikan-Killiany atlas. To see the Destrieux atlas, you would load the aparc.a2009s+aseg.mgz

Skull Strip

Turn off the segmentation (Ctrl-g) and scroll through the brainmask volume. Notice that there is no skull left in your image. Notice also that the cerebellum is still included in the volume. You should not see any large areas of skull left behind, or any areas of cortex or cerebellum removed from this volume. You can toggle between the brainmask.mgz volume and the non-skull-stripped, T1.mgz volume using Alt-c to ensure that the skullstrip has worked properly. In the TroubleshootingData tutorial, we'll go over what to do if there was a skull strip error.

Intensity Normalization

Scroll through the brainmask volume and notice that the intensity is all uniform. You should not see any very bright or very dark spots in the white matter or gray matter. If you click on a voxel in the white matter, you can see that it has been normalized to an intensity of (or very close to) 110 in the Tkmedit Tools Window (under Cursor, next to where it says "brainmask.mgz val"). When wm voxels are not close to 110, they may be erroneously excluded from the white surface. In the TroubleshootingData tutorial, we'll go over what to do if there was an intensity normalization error.

WM Volume

To check the wm volume you should load it in as a new aux volume. To do this go to File > Aux Volume > Load Aux Volume and browse to wm.mgz. This should open:

wm.jpg

This volume is FreeSurfer's initial segmentation of the white matter (shown in shades of gray) with additions from the automatic topology fixer (in white). This "mask" is the starting point for the white surface which grows out from here and stops at a more accurate location along the wm/gm boundary using the intensity gradients in the brainmask.mgz volume as a guide. The wm.mgz can be used to add missing wm voxels or delete voxels that are not wm but were included in the surface. In the TroubleshootingData tutorial, we'll go over what to do if there was a wm segmentation error.

You can now close Tkmedit by hitting the X on the display window. You can also use Ctrl-q to close it.

Viewing Surfaces with Tksurfer

Now that you've checked out everything in the volume using tkmedit, you can close it and begin to inspect your data on the surface. For this, you will use tksurfer. Tksurfer displays one hemisphere at a time. This exercise will go through visualizing things on the left hemisphere only, but everything works the same on the right hemisphere (except in the Tksurfer command, you would specify rh instead of lh).

Here are the things you can look at with tksurfer:

  • pial, white and inflated surface
  • sulc and curv curvature files
  • thickness maps
  • cortical parcellation

To open Tksurfer with the left hemisphere inflated surface of your subject, open a new terminal window, then use the following command:


setenv SUBJECTS_DIR $TUTORIAL_DATA/buckner_data/tutorial_subjs
cd $SUBJECTS_DIR
tksurfer good_output lh inflated


You should see a Tksurfer window open up to this:
tksurfer.jpg

You are currently looking at the inflated surface. The surface can be rotated using the buttons in the navigation toolbar: icon_arrow_rot_x_pos.gif icon_arrow_rot_z_neg.gif icon_arrow_rot_y_neg.gif icon_arrow_rot_x_neg.gif icon_arrow_rot_y_pos.gif icon_arrow_rot_z_pos.gif . Use the redraw button icon_redraw.gif to repaint the image if it gets corrupted by window movement.

  • Mouse Shortcut: Right click in the Tksurfer window to redraw.

Inflated surface

The inflated surface is good to look at when checking to see if you need to make edits to the wm.mgz volume. You'll notice as you inspect this surface that it is smooth and free from holes, bumps and other defects. If you click on the surface, you will see the coordinates of the vertex you clicked on in the Tools window under "Cursor". To clear the marks made on the surface after clicking on it, you can go to Edit > Unmark All Vertices.

  • Keyboard Shortcut: You can unmark one vertex at a time by using Ctrl+Shift+middle click on each. Troubleshooting Tip: If at any point clicking in the Tksurfer window automatically causes you to zoom in, your Ctrl key is stuck. Trying hitting the Ctrl button a few times to get it unstuck.

Pial Surface

All surfaces (pial, white, orig) have been loaded as a default along with the inflated surface. You can switch to the pial surface by clicking the icon_pial_surface.gif button. You should see this:

pial.jpg

The pial surface is showing you the outer boundary between the gray matter and CSF (cerebrospinal fluid). This is the same file that was viewed in Tkmedit, just represented as a 3D surface image rather than the red outline on the 2D slices in the brainmask volume. You can inspect this surface by rotating it around as you wish.

White Surface

Click on the icon_white_surface.gif button to view the white surface. This is what the white surface will look like:

white.jpg

The white surface shows the boundary between the white and the gray matter. Again, this is the same file that was viewed in Tkmedit (as the yellow outline) just represented in a 3D manner. You can inspect this surface by rotating it around as you wish.

Curv and Sulc Files

Switch back to viewing the inflated surface of the brain by pushing the TkSurferGuide/TkSurferGeneralUsage/TkSurferInterface/icon_surface_inflated.gif button. You can now load in the curvature file, lh.curv, by holding Ctrl and right clicking on the icon_curv.gif button on the Tksurfer Tools window. The box that pops up will automatically have selected the lh.curv file, so click ok. The curvature file will look like this:

curv.jpg

This is showing the slightly smoothed mean curvature. It has the units of 1/mm, and with an outward pointing normal vector field. Negative regions are folded-out and shown in green (gyral), and positive regions are folded-in and shown in red (sulcal)

To view the sulc file you could have changed the dialog box to say lh.sulc when right clicking on the curv button as described above, or you can go to File > Curvature > Load Curvature and browse to the lh.sulc file (found in $TUTORIAL_DATA/buckner_data/tutorial_subjs/good_output/surf/). Be sure you select the curvature file for the correct hemisphere, if you select the wrong one it will not look right. The lh.sulc file will load a slightly different display of green/red values than the lh.curv. These are showing the sulcal depth and again here the red regions are sulcal and the green regions are gyral. You can still view this overlay as you switch to the pial or white surfaces using the icon_pial_surface.gif and icon_white_surface.gif buttons.

Thickness Maps

To view the thickness maps it is probably best to toggle off the curvature icon_curv.gif . You can load the thickness map, lh.thickness, by holding Ctrl and right clicking icon_overlay.gif on the Tksurfer Tools window. Browse to the lh.thickness file (you may have to find the subject "good_output" from the list of subjects, then navigate to the surf directory and select lh.thickness). Be sure you select the thickness file for the correct hemisphere, if you select the wrong one it will not look right. The lh.thickness map should open up and look like this:

lh.thickness.jpg

You can adjust the thresholds of the map by going to View > Configure > Overlay which will open a new window that will allow you to change the thresholds. First click the Thresholds: Linear checkbox. Then try some different settings and see how it affects the display on the map (try a Min of 1.0 and Max of 3.0, Min of 2 and Max of 5, etc). After you change the min and max values be sure to hit Apply to see the changes. If the Apply button is not visible to you, hit the space bar to Apply the changes.

Cortical Parcellations

To view the cortical parcellation it is probably best to toggle off the curvature icon_curv.gif and thickness files icon_overlay.gif (if any are still visible), and to switch to the pial surface, icon_pial_surface.gif . You can load the parcellation by going to File > Label > Import Annotation and browsing to the lh.aparc.annot file (found in $TUTORIAL_DATA/buckner_data/tutorial_subjs/good_output/label/). Be sure you select the label file for the correct hemisphere, if you select the wrong one it will not look right. The lh.aparc.annot should open up and like this:

parcellation.jpg

Click on a color and view the name of the cortical region in the Tksurfer Tools box. Rotate the brain so you are looking at the medial wall. Notice that all subcortical gray matter is not a part of the surface labels (because again, those areas do not count towards the cortical surface measures). You can also switch to the inflated view and turn the labels to outlines using the TkSurferGuide/TkSurferGeneralUsage/TkSurferInterface/icon_label_outline.gif button.

The parcellation that is loaded here was created with the Desikan-Killiany atlas. By default there are two parcellations that are made when recon-all is run. The second parcellation, called ?h.aparc.a2009s.annot, is created with the Destrieux atlas. The difference is the number and designation of the areas that are labeled. You can load this second parcellation by first going to File -> Label -> Delete all Labels. This will remove the first parcellation. Then you can repeat the steps for loading a parcellation, this time browsing to lh.aparc.a2009s.annot to load the second parcellation.

Using Tkmedit and Tksurfer together

When you are viewing the same subject in Tkmedit and Tksurfer at the same time you can click on a point on the surface (in tksurfer) and automatically locate the same point in the volume (in tkmedit). To do this, first open a new terminal window so you can open up the same subject in Tkmedit as you have open in Tksurfer:


tkmedit good_output brainmask.mgz \
        -aux T1.mgz -surfs -aseg


Click on a location in Tksurfer. Next, click the save point button icon_cursor_save.gif in the Tksurfer Tools window. This will save the cursor position. Then, in the Tkmedit Tools window, click the "goto saved point" button icon_cursor_goto.gif . This will now bring you to the same point, only in the volume. Look for the new location of the cursor in Tkmedit. If you are having trouble finding it, the red lines on the edges of the Tkmedit display window will indicate which row and column it is located within. You can also click on a point in Tkmedit, save it using the icon_cursor_save.gif button and opening the same point in Tksurfer using the icon_cursor_goto.gif button.

This technique is very useful when you see something wrong on the surface of a subject (in Tksurfer) and you want to see what is happening in the volume in that same place and vice versa.

When you are done, you can close Tksurfer by going to File > Quit. You can close Tkmedit by hitting the X on the display window or going to File > Quit . You can also do Ctrl-q to quit for both.


This tutorial was meant as an introduction to Tkmedit and Tksurfer. For information on buttons or menu options not covered here, you can find out about them on the Freesurfer Tools wiki.

top | previous | next

FsTutorial/OutputData_tktools (last edited 2013-11-01 14:23:49 by MaritzaEbling)