top | previous

Making Edits to the White Matter

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 lh.white -aux wm.mgz -aux-surface rh.white


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 lh surface in tksurfer:


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 You will notice in slice 160 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:

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

recon-all -autorecon2-wm -subjid subject2_before

This will take a long time to run, so there is no need for you to run it now.

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 111_manual_edits_before wm.mgz lh.white -aux brainmask.mgz -aux-surface rh.white


Scroll through the brainmask.mgz volume slices and as you get towards the frontal lobe 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.

111_before_frontallobeBRAIN.jpg

frontlobe1.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 179 should look like after you have deleted the errant voxels:

frontlobe2.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 111_manual_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 111_manual_edits_before

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. Continue looking at 111_manual_edits_before in tkmedit, with the lh.white surface loaded on top. 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 111_manual_edits_before

This step will take a long time and there is no need to run it for the tutorial purposes.