Correcting topological defects
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 topological fixer fails which leads the white matter (WM) surface (yellow line) to exclude some voxels that are white matter. Simple edits to wm.mgz volume can correct this defect.
Editing the Volume
Subject topo_defect_before is an example of topological defect and this page will walk you through fixing it.
Open topo_defect_before in tkmedit.
tkmedit topo_defect_before brainmask.mgz -aux wm.mgz -surfs
Use the arrow keys to scroll through the volume to find the error in white matter surface. If you look at coronal slice 57, there is a defect in the left hemisphere closer to the midline, where some white matter voxels are segmented incorrectly. This type of topological defect is called a 'hole' which needs to be filled as opposed to a handle which needs to be cut.
As you can see in wm.mgz, some white matter voxels are excluded from the white matter surface.
To view the defect in the surface viewer, first open another terminal:
and then open the surface viewer:
tksurfer topo_defect_before lh smoothwm.nofix
Below are couple of images of lh.smooth.nofix loaded in tksurfer and zoomed in image of lh.smooth.nofix with Wireframe Overlay turned on (View --> Wireframe Overlay), respectively. You can see the error as pointed by the yellow arrow, which is a hole that needs to be filled to correct this type of topological defect.
Now back to the tkmedit display, if you scroll through slice by slice, you'll notice that there is a small group of white matter voxels which disconnect and connect back again after a few slices. The white matter surface doesn't include these voxels when they are disconnected.
This area is too thin to add control points to extend the WM surface. You'll need to add some white matter voxels to fix this error. But first scroll through the slices in the brainmask.mgz volume and make a note of where the white surface is just beginning to exclude voxels and where the problem ends. In this case, the problem starts at coronal slice 53 and goes on upto slice 60.
To begin editing, click on the Edit Voxels Tool button on the tkmedit tool bar, then go to Tools --> Configure Brush Info... Since wm.mgz is loaded as aux volume, select Aux volume as the Target. Use the middle mouse button to begin painting in the voxels. Use the right mouse button to delete voxels.
Start adding the voxels to wm.mgz volume on coronal slice 53. Toggle between the brainmask.mgz and wm.mgz using Ctrl-1 and Ctrl-2. Use brainmask.mgz as a guide while painting. Only add as many voxels as is needed to correct the error. Switch between the coronal, sagittal and horizontal views to check if you need to add more for the white matter to be labelled correctly. With more practice, it becomes easier to decide where to add voxels to correct the defect.
At any time, you can save the changes you've made to the wm volume by selecting 'Save Aux Volume' in tkmedit's 'File' menu, and clicking 'OK'
You can look at wm.mgz volume of topo_defect_after to compare your edits with the tutorial data.
Coronal slice 57 in brainmask.mgz looks like this after correction.
Regenerating the Surface
Once you have made all the edits to the wm.mgz volume, you can run the following command to regenerate the surfaces:
recon-all -autorecon2-wm -autorecon3 -subjid topo_defect_before
Do not run this command if you are conducting the tutorial!