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 occurrences can be fixed with simple manual edits. Below you will find an example of a wm segmentation error and how to fix it. For some people it is easiest to see these problems when looking at the inflated surface in freeview. Others can pick them out while viewing the volumes in freeview. Either method is fine for identifying these problems. However they can only be fixed using freeview with the wm.mgz volume.

Geometric inaccuracy due to white matter hypointensity

wm1_edits_before is an example of white matter being excluded from the wm.mgz volume due to the presence of a white matter hypointensity. 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 freeview (you may have already run this command):


freeview -v wm1_edits_before/mri/brainmask.mgz \
wm1_edits_before/mri/wm.mgz:colormap=heat:opacity=0.4 \
-f wm1_edits_before/surf/lh.white:edgecolor=yellow \
wm1_edits_before/surf/lh.pial:edgecolor=red \
wm1_edits_before/surf/rh.white:edgecolor=yellow \
wm1_edits_before/surf/rh.pial:edgecolor=red \
wm1_edits_before/surf/rh.inflated:visible=0 \
wm1_edits_before/surf/lh.inflated:visible=0


Again, this will bring up the brainmask.mgz volume, the wm.mgz volume, and the surfaces for both hemispheres. Make sure the wm.mgz is on top of the brainmask.mgz and highlighted and then click in the main viewing area and use Alt-V to toggle the wm.mgz on and off to see the brain underneath. You may also use Alt-C or the arrows arrows.jpeg to flip between the wm.mgz, brainmask.mgz, and T1.mgz if you have more than two volumes loaded. If you are using a Mac, please see this page for the proper keyboard shortcuts. With the wm.mgz loaded on top of the brainmask.mgz volume, it should look like this:
wm_view.jpg
If you look at coronal slice 133 you will notice an area on the left hemisphere where the white surface (yellow line) does not follow the white matter, but in fact cuts into it. A huge indicator that this is a problem is that you can also see the pial surface (in red) in the hypointense voxels on slice 134- the pial surface should never be seen inside an area contained by the white matter surface. This geometric inaccuracy is caused when hypointense white matter is marked as non-white matter.
wm_defect_vol.gif.png wm_defect_volv6a.png
Depending on where the segmentation error is, you can sometimes see this as a dimple or hole on the inflated surface in the 3D view. In this example, you cannot see the defect on the inflated surface. To view another segmentation error where you can see a hole on the inflated surface, please refer the previous version of this tutorial.
With the wm.mgz volume loaded into freeview you can see that the area just inferior to the hypointensity has been left out of the wm volume (coronal slice 132, 133 and 134).
wm_defect_v6_slice132.png wm_defect_v6_slice133.png wm_defect_v6_slice134.png


It is always a good idea to look at this area in all three views, to make sure that the hole you see is indeed a segmentation error (it can be very difficult to determine the shape of a 3D object in a 2D slice). What appears to be a hole can sometimes actually be a sulcus.

To fix this problem and correct the white and pial surfaces you will need to fill in the missing voxels in the wm.mgz volume. First, it's a good idea to use the page up and down keys (or the up and down arrows) 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 scroll button on your mouse.To begin editing voxels, make sure the wm.mgz is highlighted in the volumes list, and is on top of the brainmask.mgz. Click on the Recon Edit option ( recon_edit.jpg ) and enter a brush size of either 1 or 2. You will see that the recon editing checkbox has set the brush value to 255 and the eraser value to 1. Remember: the wm.mgz must be on top and the 'Recon editing' box checked (brush value set to 255) in order to edit voxels in the wm.mgz, if it is not visible on top you will be editing the brainmask.mgz. You should only be editing the brainmask for pial edits and not wm edits.


You are now ready to edit. Use your left mouse button fill in the wm hole with voxels. If you fill in too many, you can press Shift while using your left mouse button to erase voxels. You can keep flipping back between the brainmask and the wm volume using your Alt-V or Alt-C combination if you want to check that what you are filling in is indeed white matter. At any time you can use the Crtl-Z combination to undo as many actions as you like.

While filling the hole in slice 134, 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 Alt-C. 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 freeview window 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 by clicking on the wm.mgz (for the sake of the course, do not press save), making sure it is highlighted in the menu to the left side of the viewing area and click the save volume button save_volume.gif.jpeg or save in the file menu. You can verify your results by viewing the changes made to the wm1_edits_after wm.mgz volume to view this corrected subject (which was corrected by following the detailed instructions provided to you):

freeview -v wm1_edits_after/mri/brainmask.mgz \
wm1_edits_after/mri/wm.mgz:colormap=heat:opacity=0.4 \
-f wm1_edits_after/surf/lh.white:edgecolor=yellow \
wm1_edits_after/surf/lh.pial:edgecolor=red \
wm1_edits_after/surf/rh.white:edgecolor=yellow \
wm1_edits_after/surf/rh.pial:edgecolor=red \
wm1_edits_after/surf/rh.inflated:visible=0 \
wm1_edits_after/surf/lh.inflated:visible=0

Here are the same three slices after voxels were added and before recon-all was run. You may have to edit many slices to achieve the result you desire. For example, even though only three slices are shown, slices 122-140 of this volume were edited to fully fill in the hypointensity.
wm_lesion_edit_v6_slice132.png wm_lesion_edit_v6_slice133.png wm_lesion_edit_v6_slice134.png

Tips:

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

recon-all -autorecon2-wm -autorecon3 -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.

After running recon-all, if you view the edited subject using the freeview commands above, you will see that the white and pial surfaces have been corrected. The hole in the white matter is no longer affecting the surfaces.
wm_edit_after_v6_slice133.png

FsTutorial/WhiteMatterEditsV6.0 (last edited 2018-03-19 09:43:50 by EmmaBoyd)