| Using mrGray: Segmentation and Visualization
Introduction. This program, mrGray, can be used in a stand-alone
mode to visualize data, segment gray matter, and produce flat maps
of visual cortex. Because it can be used in isolation, we distribute
it and mrFlatMesh (along with source). This page describes the basic
uses of mrGray. The documents in the unfolding software describe
how to use the output from mrGray to produce flat maps.
1.
Setup: It is important to establish a directory structure where
you will keep the anatomy data and the results of the mrGray analysis.
We use an directory structure that looks like this:
subjectName/anatomyFile.dat
subjectName/left/classprojects/date
subjectName/right/classprojects/date
We usually segment
both the hemisphere i.e. Left and the Right. So we would have
two folders 'left' and 'right' to save the generated files.
We keep the project file, white matter and gray matter classification
files
inside
this dated directory. Then we keep the results of
unfolding as sub-directories within this tree.
2.
Run mrGray -
Under File menu in mrGray choose New project. Click
on the subjectDir and create a new folder ‘Left’ .
In the prompt for selecting volume anatomy file for the
project go
up one level to find the vAnatomy file. Select the vAnatomy
file and click open. The data will be loaded and you’ll
see a anatomical image. Assign it a name, and it
will be saved as a file called: [projectname].mrp
3. Select
anatomy data. We usually call volume anatomy files vAnatomy.dat
and identify them by the directory name (see above). Once you have
defined your project and selected the anatomy file, the data will
be loaded and you will see an anatomical image.
4. Setting the visuals:
a. Under View menu, adjust Zoom - I usually use 4 or 5 when working
with the occipital lobe.
b. Under View menu, Set Greyscale. This changes the visibility of the brain
to the user, but it does not affect the automatic segmentation process. However,
you will find it extremely useful to have good visibility when judging the
-segmentation, and when editing.
I usually find the contrast on a CRT works well with the following settings
(or thereabouts):
Brightness = 0.35, Contrast = 0.75, Gamma = 1.8
However, it will vary with your monitor type and anatomy data 5. Setting colors for classification types
(NOTE: You will only have to do this the first time you run mrGray). Under the File menu, choose Preferences. Edit color for the white
matter the default color lavender is not terribly visible. I suggest
a dark purple instead. 6. Set the volume of interest (VOI):
a. Go to the Tools window and toggle on the VOI crossbars.
b. Use the right mouse button to drag the dashed lines around the
volume you would like to segment. There are two VOI boundaries
in each of the 3 dimensions; make sure you check all 3. c. TIPS:
i. The smaller the area, the faster the segmentation and editing process. However,
leave plenty of room for gray matter to grow.
ii. Flip between orientations (in the Tools window, or use Ctrl-O) to define
the VOI in 3d.
iii. To define one hemisphere, place the mid-sagittal VOI boundary as close
to the midline as possible, but make sure not to cut off any of the hemisphere
in the VOI.
iv. Flip through all the slices in the VOI in all three orientations to make
sure that all the gray matter will be included. Here is an example of a VOI chosen to contain the right hemisphere:
Sagittal View (Red) |
Axial View (Green) |
Coronal (Blue) |

7. Save project file:
Under the File menu: Save project. This will update the project
file and also save the classification file as [projectname].class
in the same directory as the project file, [projectname].mrp. This
file contains the classification of the data into white, CSF and
unknown. The gray matter has not yet been determined. They will
be determined and saved later. 8. Automatic classification:
a. Place position crossbars (solid red, green and blue lines)
within the VOI using the right mouse button.
b. Under Classification menu, Classify White & CSF.
c. In MR Classify window: Toggle on (click on) Preview and Auto
Update
d. Use the 6 slider bars to segment white matter and CSF to your
liking.
TIPS:
i. CSF Mean < Gray Mean < White
Mean (by definition)
ii. Leave a generous amount of gray matter -- at least 3-4 layers
(pixels) of thickness between the white matter and CSF boundaries.
iii. To help fill in white matter: Set the Noise Stdev higher than
the default. Set the Confidence up high, around 0.9. Reduce the
Smoothness to 3. You can adjust these settings to your liking.

e. Click on Apply and Exit
f. Flip through slices, reposition crossbars, and repeat above process. Note
that it is difficult to find one setting that will be suitable for all parts
of the brain. Therefore, you may have to settle for something part-way suitable,
and then edit.
9. Select connected white matter:
a. Back in the normal window, use Ctrl-left mouse click to select
the white matter that is connected within the VOI. Connected white
matter turns red, while the unconnected white matter remains the
original color.

b. Under Classification menu, Delete Unselected White, then Deselect
White.
 10. Check gray matter:
Under Classification menu:
a. Select Gray layers and make sure that it is set to 4.
b. Grow Gray Matter, and flip through slices in different orientations to check
for areas where gray matter was missed.

c. Delete All Gray.
11. Save project: Under File menu, Save project.
12. Editing
CSF: (NOTE: SAVE your project frequently during the
editing process!)
a. Start in axial (green) orientation, and go to the top (first slice) of the
VOI.
b. To prevent gray matter from intruding from the opposite hemisphere (the
one you DON’T want to segment): Go to Tools window, and select Edit mode:
CSF and Edit size: 4. Use the left mouse button to add a "wall" of
CSF and block off the gray matter in the opposite hemisphere.
If your gray scale is set well, you should be able to guess which gray matter
belongs to which hemisphere. Another method, which is faster but harder to
visualize, is to wall off the other hemisphere in just a few sagittal views:
notice the traveling band of dark gray as you march through the sagittal views
near the midline, and paint the dark band with CSF. Check how you did by looking
through the axial views.
c. To prevent gray matter from growing inside ventricles (where it doesn’t
exist): Start at the first slice, go through each slice and look for/identify
the lateral ventricle. Fill it with CSF using the same Edit size and mode as
in b.
d. In some cases, you may need to build a wall of CSF between the cerebrum
and the cerebellum -- if you delete all selected white matter (step 9, above)
and find that you still get white matter in the cerebellum.
(NOTE: The posterior horn of the lateral ventricle extends back
into the occipital lobes and comes quite close to the fundus of
the calcarine sulcus. Therefore, it can accidentally connect to
and become part of the calcarine, and cause problems in the unfolded
representation. You can see the posterior horn just to the left
of the calcarine sulcus in the two images below on the right.)
13. Editing
White Matter: (NOTE: SAVE your project frequently
during the editing process!)
a. Start in axial (green) orientation, and go to the top (first
slice) of the VOI.
b. Go to Tools window, and select Edit mode: White and Edit size: 1.
c. Use left mouse button to add white matter where needed. Use right mouse
button to remove white matter where it extends too far into the gray matter.
Remember to try and allow 3-4 layers of gray matter between white
and CSF. This may require removing some CSF between sulci. Switch Edit mode
to CSF and use right button to remove CSF.
d. Grow gray matter frequently to check work. Delete all gray before continuing
the editing process; otherwise you can't add white matter or CSF to an area
that’s already classified as gray.
e. Repeat steps a-d in the other two orientations (sagittal and coronal).
14. Check for
handles: (NOTE: If you’ve
done a good job in editing, there should be very few handles
(~10 or less)).
a. Under Classification window, choose Topology and Analysis.
b. In Topology window, click on Update.
c. Fill cavities and Delete satellite volumes, if there are any.
d. Click on Update Method 1 to find handles.
e. Double click on the coordinates for each handle, and the position bars in
the normal window will automatically go to the position of that handle. However,
you must click OK to get out of the topology window and go back into the normal
window.
f. Use Alt-N and Alt-P to flip from one handle to the next or
previous.
g. Flip back and forth through slices and orientations (Ctrl-O) to look for
obvious gaps in the white matter (handles). Ask experienced users for feedback.
h. Periodically run the Topology Analysis and Update to check how many handles
you’ve removed.
i. When you are down to a few, stubborn handles that you can't figure out,
click on the Update Method 2 button in the Topology window. This method takes
longer, but may give a better estimate of the position of the handle.
15. Select connected white matter and save:
When all handles are removed, and all editing is done, in the
normal window, use Ctrl-left mouse click to select the white matter
that is connected within the VOI. Then, under Classification menu,
Delete Unselected White, then Deselect White (just like in step
9b). SAVE project!
16. Select connected gray matter and save:
Under Classification window, Grow gray matter one last time.
Use Ctrl- left mouse click to select the connected GRAY matter
this time. The selected, connected gray matter will now turn blue.
Under the File menu, choose Save selected gray. Name the gray matter
file [projectname].gray, in the same directory as the .class and
.mrp files.
17. You’re
done! Now that you have your gray matter file saved, you can render
it in 3d. Under
the 3d menu, choose Build
Visualization.
The visualization mode has many options for lighting, orientation,
and smoothing. We believe it is important to have a good 3D rendering
card (1999 price ~150-250 dollars) to make this part of the program
fun.
The visualization mode has many options for lighting, orientation,
and smoothing. We believe it is important to have a good 3D
rendering card (1999 price ~150-250 dollars) to make this part
of the program fun.
|
|
18. Final Comment. We use mrGray in conjunction with a suite of
tools for alignment, data analysis, and other computational tools.
To make full use of the program, it is good to know how to incorporate
ROIs and data values on overlays. These files are very simple to
create (and thus inefficient). You can also go on to unfold the
gray matter surface using mrFlatMesh (in Matlab on the Unix system).
To learn more about the algorithms used
in mrGray, and the companion program, mrFlatMesh, please review
the following references: And
we wouldn’t mind an occasional citation of the work. Thanks.
1. Teo, P.C., Sapiro, G. and Wandell, B.A. (1997). Creating connected
representations of cortical gray matter for functional MRI visualization.
IEEE Transactions on Medical Imaging 16: 852-863.
2. Visualization
and Measurement of the Cortical Surface.
B. Wandell, S. Chial and B. Backus (2000). Journal of Cognitive
Neuroscience, vol. 12, no. 5. pp. 739-52
Generated file by the
end of the segmenting: Left/Right folders > 3DMeshes, Movies,
TIFFs, left/right.mrp, left/right.class and left/right.gray
|