Differences between revisions 36 and 37
Deletions are marked like this. Additions are marked like this.
Line 63: Line 63:
You can toggle between the brainmask.mgz and the T1.mgz by clicking off the checkmark next to the brainmask.mgz volume in the menu on the left, effectively turning off the brainmask.mgz and allowing the T1.mgz to show through. You can also use the up and down arrows on the top right of the menu to move the aseg.mgz down below the brain mask and move the wm.mgz up above so that it can be overlayed on top of the brainmask. the menu should look like this: <<BR>> While Freeview can load many volumes at once, you cannot necessarily see them all at once. You will be able to see whichever volume is at the top of the list in the menu to the left. An exception to this are volumes such as the wm.mgz and aseg.mz which can be made translucent so you can see their information simultaneously with the volume below it on the list. For example, you are currently seeing information from both the aseg and the brainmask.

You can hide or turn off a layer by unchecking the checkbox next to the layer name. Try this out - uncheck the box next to 'aseg'. Now you can see just the brainmask. You can also use the up and down arrows on the top right of the menu to move the aseg down below the brainmask. You could use the arrows to move the wm to the top of the list but a shortcut would be to double click it. The menu should look like this: <<BR>>
Line 70: Line 72:

At any time, you can hide or turn off a layer by unchecking the checkbox next to the layer name. Additionally, any layers on top will overlay and sometimes obscure layers below them on the list. This is somewhat like photoshop.

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 for a real study. Some outputs are only necessary to check when troubleshooting, for example. However, it is a good idea for new users to become familiar with the variety of outputs and how to view them.

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 data 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 Freeview

With one Freeview command line, you can load several output volumes, such as brainmask.mgz and wm.mgz; the surfaces, rh.white and lh.white; and the subcortical segmentation, aseg.mgz. Copy and paste the command below inside the terminal window and press enter:


freeview -v \
good_output/mri/T1.mgz \
good_output/mri/wm.mgz:colormap=heat:opacity=0.4 \
good_output/mri/brainmask.mgz \
good_output/mri/aseg.mgz:colormap=lut:opacity=0.2 \
-f good_output/surf/lh.white:edgecolor=blue \
good_output/surf/lh.pial:edgecolor=red \
good_output/surf/rh.white:edgecolor=blue \
good_output/surf/rh.pial:edgecolor=red


Some notes on the above command line:

  • good_output : name of subject
  • The flag -v is used to open volumes
    • brainmask.mgz : skull-stripped volume primarily used for troubleshooting
    • wm.mgz : white matter mask also used for troubleshooting.
      • Note, the above command sets this binary volume to the color red and makes it less opaque so you can see through it to the voxel data underneath in the brainmask or T1
  • aseg.mgz : subcortical segmentation is loaded
  • The flag -f is used to open or load surfaces
    • white & pial surfaces are loaded for each hemisphere & the color they should be is indicated by 'edgecolor'

After hitting enter, a freeview window should open showing you the outputs you specified:

good_output.jpeg

Use the sliceoptions.jpeg buttons at the top to change which orthogonal view appears in the main viewing window. You can also use the viewingoptions.jpeg buttons to change the organization of the viewing panes. To change which brain slice you are viewing, you can use the 'Page Up' or 'Page Down' keys on your keyboard. (Mac users: press the fn key while using the up and down arrows.)

While Freeview can load many volumes at once, you cannot necessarily see them all at once. You will be able to see whichever volume is at the top of the list in the menu to the left. An exception to this are volumes such as the wm.mgz and aseg.mz which can be made translucent so you can see their information simultaneously with the volume below it on the list. For example, you are currently seeing information from both the aseg and the brainmask.

You can hide or turn off a layer by unchecking the checkbox next to the layer name. Try this out - uncheck the box next to 'aseg'. Now you can see just the brainmask. You can also use the up and down arrows on the top right of the menu to move the aseg down below the brainmask. You could use the arrows to move the wm to the top of the list but a shortcut would be to double click it. The menu should look like this:

good_output_5.3_sidebar_1.png

and the viewing window should look like this:

good_output_2.jpeg

  • Keyboard Shortcut: Alt-c will allow you to quickly move layers from the top of the list to the bottom. You can use it to quickly flip between all the layers.

When the Navigation button nav.jpeg is chosen, you can move the volume around by holding down the middle mouse button and dragging the mouse where you want the volume to go. Try it out. You can also move the volume more slowly using the up/down and left/right keys. To zoom, scroll with the middle mouse button. In this navigation mode, notice the cursor (little red crosshair) moves to wherever you left click. When you change the orientation (to axial or sagittal) , you will be viewing the slice that intersects with the cursor's location. To illustrate this point, if you are in the viewing pane selected here:

viewingoptions.jpeg

You'll notice all the planes will shift based on where you move the cursor.

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

Either bring the brainmask volume to the top of the volume menu on the left (so that no other volumes can be seen overlaying it) or uncheck and hide the other volumes (aseg + wm). You should only be able to see the brainmask volume and the pial and white surfaces. The white surface (blue 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.

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, click on the 'Surfaces' tab to the right of the volumes tab. Toggle them off and on with by unchecking the box next to the surface name you are checking for accuracy. .pial refers to the pial surface and .white to the white matter surface. The menu looks like this:
good_output_5.3_sidebar_2.png
After you uncheck or hide a surface it should look like this in the viewing window:
good_output_3.jpeg
You can toggle any surface on and off. 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 clicking with your left mouse button on the brain, holding down the 'Shift' key, and moving your mouse around. In the volume tab, you can also adjust the contast by moving the 'Window' and 'Level' sliders to the left of the viewing window. Make sure the brainmask volume is highlighted and not the wm or aseg volumes. You can double check this by clicking on the brainmask volume in the menu and then adjusting the window and level sliders. The contrast of the brain should change.

  • Keyboard Shortcuts: You can also use alt-f to turn on and off whichever surface is highlighted in the surfaces tab.

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, scroll to coronal slice 137 (slice numbers appear in the upper right hand corner of the viewing window).
  • 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

In the volumes tab, using the blue arrows bring the aseg up above the brainmask so that only the brainmask and the aseg are visible. You can also highlight the wm and T1 volumes and click delete volume delete.jpeg so that only the aseg and brainmask remain. The menu should look like this if you've moved them to the top:
good_output_5.3_sidebar_3.png
Or this if you've deleted the other volumes:
good_output_5.3_sidebar_4.png
You are left with your brainmask and segmentation overlay. 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 'Cursor' tab under the viewing window (next to where it says "aseg"). If you hover over a voxel, it will also appear similarly under the 'Mouse' tab. Under the volume tab, click on the aseg to highlight that volume name. Toggle the aseg on and off by pressing 'alt-v' or unchecking the check box 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. you can also adjust the 'Opacity' slider to adjust the segmentation opacity and allow you to better see the underlying brainmask.

Other Things To Do in Freeview

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

Aparc+Aseg segmentation

First, delete or close the aseg volume. Then, to load the aparc+aseg segmentation you can go to File > Load Volume, click on the yellow folder icon, and browse to the aparc+aseg.mgz.Click 'Open', and then 'Ok' once you have selected the file. When it loads 'Grayscale' will be selected as the Colormap. This will obscure the brainmask beneath. Click on the colormap tab and choose lookup table. Then adjust the opacity so that you can see the brainmask and aparc aseg at the same time. When loaded, it will look like this:
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

click on the aparc+aseg volume and press delete volume. 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 reload the T1.mgz by going to File > Load Volume 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 Cursor window (under Cursor, next to where it says "brainmask" to the right there will be a single number). 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 volume. To do this go to File > Load Volume > click on the yellow folder icon and and browse to wm.mgz. Click 'Open', and then 'Ok' This should open: good_output_wm.jpeg
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. For now, you can see the wm mask as an overlay by picking 'Heat' as the Colormap and ajusting the Opacity down to .25. You can now close Freeview by hitting the X on the display window. You can also use Ctrl-q to close it.

Viewing Surfaces in 3D using Freeview

Now that you've checked out everything in the volume using freeview, you can close it and begin to inspect your data on the surface. This exercise will go through visualizing things on the left hemisphere only, but everything works the same on the right hemisphere (except in the freeview command, you would specify rh instead of lh). Here are the things you can look at with freeview:

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

By default freeview will display curvature information on a surface opened using freeview. On several examples below you will turn off the curvature after loading a certain surface just to keep things simple.

To open freeview 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
freeview -f  good_output/surf/lh.pial:annot=aparc.annot:name=pial_aparc:visible=0 \
good_output/surf/lh.inflated:overlay=lh.thickness:overlay_threshold=0.1,3::name=inflated_thickness:visible=0 \
good_output/surf/lh.inflated:overlay=lh.curv:overlay_threshold=0.08,0.4:name=inflated_curv:visible=0 \
good_output/surf/lh.white:visible=0 \
good_output/surf/lh.pial:visible=0 \
good_output/surf/lh.inflated


Once the surface is loaded, you will see the green/red blobs on the surface which correspond to curvature. We will turn them off for now. Do this by selecting Off in the Curvature drop-down menu. To get rid of the yellow lines being displayed on the surface (corresponding to the 3 slice views), right-click on the surface and uncheck Show Slices (3D View), or hit Crtl+Shift+S.

inflated left hemisphere

lh_inflated.jpeg

Alt+C

pial left hemisphere

Again, you will see the green/red blobs on the surface which correspond to curvature. We will turn them off for now. Do this by selecting Off in the Curvature drop-down menu.

lh_pial.jpeg

Alt+C

white left hemisphere

Again, you will see the green/red blobs on the surface which correspond to curvature. We will turn them off for now. Do this by selecting Off in the Curvature drop-down menu.

lh_white.jpeg

Alt+C

curvature on inflated left hemisphere

Again, you will see the green/red blobs on the surface which correspond to curvature. We will turn them off for now. Do this by selecting Off in the Curvature drop-down menu.

lh_curv.jpeg

Alt+C

thickness on inflated left hemisphere

lh_thick.jpeg

Alt+C

aparc on inflated left hemisphere

lh_aparc.jpeg

END


TKSURF text below


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 freeview (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 tksurfer and Freeview together

When you are viewing the same subject in Freeview and Tksurfer at the same time you can click on a point on the aseg in freeview (along the surface, not subcortical structures) and automatically locate the same point on the surface in tksurfer. To do this, first open a new terminal window so you can open up the same subject in Freeview as you have open in Tksurfer:

freeview good_output/mri/brainmask.mgz \
good_output/mri/aseg.mgz:colormap=lut:opacity=0.2 \
-f good_output/surf/lh.white:edgecolor=blue good_output/surf/lh.pial:edgecolor=red \
good_output/surf/rh.white:edgecolor=blue good_output/surf/rh.pial:edgecolor=red

Click on a point along the surface in the aseg in freeview (along the cortical ribbon, not on one of the subcortical structures. Next, go to File > Save point. This will save the cursor position. Then, in the Tksurfer Tools window, click the "goto saved point" button icon_cursor_goto.gif . This will now bring you to the same point, only on the surface. Look for the new location of the cursor on the surface of the volume. When you are done, you can close Tksurfer by going to File > Quit. You can close Freeview 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 freeview 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_freeviewV6.0 (last edited 2022-08-12 15:30:54 by LiamrSennott)