Differences between revisions 46 and 47
Deletions are marked like this. Additions are marked like this.
Line 70: Line 70:
Scroll through the brainmask.mgz volume slices and as you go posterior you will see a group of voxels included as white matter. They are surrounded by the white surface (yellow line). This group lies outside of the pial surface (red line) and is clearly not white matter. In order to correct this inaccuracy it is necessary to delete the voxels which are not part of the white matter. Scroll through the brainmask.mgz volume slices and as you go posterior you will see a group of voxels included as white matter, around lice 152. They are surrounded by the white surface (yellow line). This group lies outside of the pial surface (red line) and is clearly not white matter. In order to correct this inaccuracy it is necessary to delete the voxels which are not part of the white matter.

top | previous

Making Edits to the White Matter

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

Sometimes the white matter is not segmented correctly: sometimes voxels that should be white matter are excluded, and other times voxels that should not be white matter are included in error. Either of these occurences can be fixed with simple manual edits. Below you will find examples of a few of the common problems and how to fix them. For some people it is easiest to see these problems when looking at the inflated surface in tksurfer. Others can pick them out while viewing the volumes in tkmedit. Either method is fine for identifying these problems. However they can only be fixed using tkmedit with the wm.mgz volume.

Geometric inaccuracy due to brain lesion

wm1_edits_before is an example of white matter being excluded from the wm.mgz volume due to the presence of a brain lesion. This page will walk you through fixing this specific example as well as other common problems with the wm.mgz volume.

First, make sure you have wm1_edits_before loaded in tkmedit:


tkmedit wm1_edits_before brainmask.mgz -aux wm.mgz -surfs


If you look at coronal slice 160 you will notice an area on the right hemisphere where the white surface (yellow line) does not follow the surface of the brain, but in fact cuts into it. This geometric inaccuracy is caused by a lesion where white matter has been marked as non-white matter.

WMlesionsWMbefore.jpg

You can see this as a dimple or hole on the inflated surface in tksurfer too (see next image). If not already open, in a second terminal window, open the rh surface in tksurfer and you can see the dimple or hole on the medial side:


tksurfer wm1_edits_before rh inflated 


lesiontksurfer.jpg

With the wm.mgz volume loaded into tkmedit you can see that this area has been left out of the wm volume completely.

WMlesionsbefore.jpg

To fix this problem you will need to fill in the missing voxels in the wm.mgz volume. First, it's a good idea to use the arrow keys to scroll through the individual slices in the volume until you get a good idea of where the problem starts and ends. You will want to start filling in voxels when the inaccuracy appears, and keep filling them in slice by slice until the problem is no longer visible. The coronal view and a brush radius of one or two are good settings for painting in voxels. Zoom In and Out either by using the icons in the tkmedit Tool window or by Ctrl-right mouse button (Zoom In) and Ctrl-left mouse button (Zoom Out) to help you see the inaccuracy.

To begin editing voxels, click on the Edit Voxels Tool button icon_edit_volume.gif, then go to Tools --> Configure Brush Info... Set the radius to 2 and Shape to be Circle. By default tkmedit will edit on the main volume loaded, if the wm volume is loaded as your aux volume you will also need to select Aux volume as the Target. Use the middle button on your mouse to begin painting in the voxels. If you fill in too many voxels, the right mouse button acts as an eraser. When you are done filling the region, slice 160 should look like this:

lesionafter.jpg

While filling the hole in slice 160, you will notice that the hole is not completely enclosed. To see where the boundary should be, switch back and forth between the brainmask.mgz and wm.mgz volume with Ctrl-1 and Ctrl-2. Use the brainmask.mgz volume as a guide, and make the boundary of the voxels that you paint in correspond as closely as possible to the boundaries suggested in the brain volume. Go to the next slice, and fill in this slice in the same way. You will need to continue filling in slices in this fashion until the region is completely filled in. If you would like to compare your edits to ones that have been done for you you can open a second tkmedit with the wm1_edits_after wm.mgz volume, and for each slice check your results with the corresponding slice in the wm1_edits_after volume. At any time, you can save the changes you've made to the wm volume by selecting 'Save Volume' in tkmedit's 'File' menu, and clicking 'OK'. You can verify your results by viewing the changes made to the wm1_edits_after wm.mgz volume

Tips:

  • Sometimes regions may appear enclosed in some slices (i.e. appear as holes), open in subsequent slices (i.e. no longer appear as holes), then enclosed again as you scroll forward. The rule of thumb when editing these is to keep filling until you reach the slice where they finally open up and are no longer enclosed.
  • When filling in regions that are in both hemispheres, you may opt to fill them in both hemispheres at the same time, when you become more comfortable with editing inaccuracies. To load the white surface for the other hemisphere you will need to go to File --> Aux Surface --> Load Aux Main Surface and select the other hemisphere's white surface (i.e., rh.white). This will load the rh.white surface as the Aux surface and you can now follow the surfaces for both hemispheres at the same time.

  • When editing geometric inaccuracies in the future, you may find it easier to edit the first slice and last slice first, thereby 'capping' the slices that need filling. Then you just need to fill all the slices between the endcaps.
  • Sometimes there is variation between a subject's left and right hemispheres, so that in a particular slice one hemisphere's region will finally 'open up', but the other hemisphere's region is still enclosed. In such cases, continue to fill the enclosed region only, even though the other is open. This will address the topological problem.
  • Problems like the one shown here, due to brain lesions, should always be fixed with edits to the wm.mgz volume. Do not use control points to try and automatically adjust the intensity in these areas.

After you have saved all of your edits, you could recreate the final surfaces with the command:

recon-all -autorecon2-wm -subjid wm1_edits_before

Do not run this command if you are conducting the tutorial! This step will take a long time and there is no need to run it for the tutorial purposes.

Non-white matter classified as white matter

Sometimes non-white matter (i.e., skull) is included as white matter. To load in the example use this command:


tkmedit wm2_edits_before wm.mgz -aux brainmask.mgz -surfs


Scroll through the brainmask.mgz volume slices and as you go posterior you will see a group of voxels included as white matter, around lice 152. They are surrounded by the white surface (yellow line). This group lies outside of the pial surface (red line) and is clearly not white matter. In order to correct this inaccuracy it is necessary to delete the voxels which are not part of the white matter.

BMbefore.jpg

WMbeforejpg.jpg

Using Ctrl-1 and Ctrl-2 to switch back and forth between the brain and wm volumes, you can clearly see that this region should not be labeled as white matter. To delete these voxels, click the Edit Voxels Tool icon_edit_volume.gif button in the tkmedit toolbar, and put your mouse cursor over the voxels you want to delete. Delete them with the right mouse button. This is what slice 152 should look like after you have deleted the errant voxels:

WMvoxdelete.jpg

Go through the slices with the up and down arrows, continuing to delete voxels until the inaccuracy is no longer there. (It spans approximately 30 slices.) You can check your results by looking at the wm2_edits_after wm.mgz volume in tkmedit. Note that in this volume, only a few of the voxels have been removed from each slice, instead of removing the entire inaccuracy. This is because you only need to remove as many voxels as is necessary for the segmentation to classify this region as non-white matter. Until you are more comfortable with editing inaccuracies, go ahead and remove all of the voxels. More practice will give you a better feel for how many voxels need to be removed.

Once you have made all the edits to the wm.mgz volume you would regenerate the surfaces using the following command:

recon-all -autorecon2-wm -autorecon3 -subjid wm2_edits_before

Do not run this command if you are conducting the tutorial! This step will take a long time and there is no need to run it for the tutorial purposes.

Lateral Ventricle

The automatic edits made to to wm volume will fill the lateral ventricles. On occasion they are not filled entirely. Open wm3_edits_before in tkmedit.


tkmedit wm3_edits_before wm.mgz -aux brainmask.mgz -surfs


As you scroll to the posterior portions of the brainmask.mgz you will see the white surface (yellow line) start to follow the edge of the ventricle (look around coronal slice 53).

111_before_ventricleBRAIN.jpg

When you toggle between wm and the brain volume, you can see that this portion of the ventricle should be filled in. This inaccuracy can be corrected in the same fashion as the inaccuracies above, using the Edit Voxels tool to fill in the missing voxels.

occlobe1.jpg

When you are finished filling in slice 53, it should look like this:

occlobe2.jpg

Continue filling in this region until the hole disappears. The geometric inaccuracy is present from slices 50 through 168. Once you have fully edited the wm.mgz volume you would regenerate the surfaces with the following command:

recon-all -autorecon2-wm -autorecon3 -subjid wm3_edits_before

Do not run this command if you are conducting the tutorial! This step will take a long time and there is no need to run it for the tutorial purposes.

FsTutorial/WhiteMatterEdits_tktools (last edited 2013-11-01 14:27:56 by MaritzaEbling)