Segment Ex-vivo White Matter

Koen Van Leemput has created a GUI to help you view the segmentation as you are creating it. It also allows you to use intensity information from several different scans to find a good gm/wm threshold.

Threshold Out Noise
The first step is to threshold out structures that are not of any interest (air, plp, bag, etc.) and thus create a mask consisting of only the tissue classes you want to segment. By loading multiple volumes, you can interactively define threshold values on one volume and apply the resulting mask on another volume. Choose the volume(s) where plp, bag, and air are a different contrast from brain. It's okay if there is not a lot of contrast between wm and gm. The orig.mgz will be used as the volume to create the mask (to be used for segmentation later).

kvlThresholdImage  orig.mgz  /path/to/second_volume.mgz

Where it says Image to mask, choose the orig volume. Where it says Image to threshold, choose the other volume you loaded. Use the scroll bar to change the Lower threshold and Upper threshold until you see a purple overlay covering all the stuff that you do not want (you do not want to cover gm or wm).

Pressing the Mask image button will write out a file called "*_masked.mgz" (in this case orig_masked.mgz). This file will be the one you want to segment with in the next step (kvlEMSegment). (You can also choose to press the Write mask button to get a mask.mgz volume of just the mask and not the volume with noise masked out.)

Segment WM
The second step is to actually segment the wm from the gm. This will classify tissues using an automatically estimated Gaussian mixture and polynomial MR bias field model. You would use this command from the directory where the masked volume is:

kvlEMSegment  orig_masked.mgz  numberOfGaussians  biasFieldOrder  downSamplingFactor

The suggested values to start with are:

kvlEMSegment  orig_masked.mgz 2 4 4

**Every case is different so it is worth playing around with the different values above if you are unhappy with the segmentation (definitely try using 3 different tissue classes and/or a down samping factor of 1 to see if it improves your segmentation).

View Segmentation Results
Results are written out as crispPosterior_classX.mgz, one for each class (with 0 being wm and 1 being gm). To see the result of the automated segmentation overlaid on the original MR image, you can use:

kvlViewImage  orig_masked.mgz  crispPosterior_class0.mgz

Or if you have several wm segmentations you would like to view at the same time to see which is better, you can use Freeview:

freeview -v orig.mgz  wm_file1.mgz:colormap=heatscale  wm_file2.mgz:colormap=jet

If you are not satisfied with the segmentation, you can tweak the thresholds in the kvlThresholdImage step or try out different parameters in the kvlEMSegment step.