Brain
Beta 1.0
Boris Magocsi
bmagocsi@macalester.edu
http://www.macalester.edu/~bmagocsi/
This is the documentation for the Brain application.
The Brain application is an application meant for viewing MRI data of the human brain. MRI stands for Magnetic Resonance Imaging, an imaging technique that allows the proton density of a structure to be determined without destroying the structure. In other words, MRI lets us "see" inside the human body (and other objects) without harming it.
Brain takes in a stack of images of an object and allows the user to define a plane through the stack. This plane is used as the viewing plane, effectively allowing the user to "slice" through the dataset in the manner that he or she chooses. Since the MRI data is a set of two-dimensional slices, this is a useful tool for examining features in the dataset that are not apparent when viewing the "raw" data.
Brain features three dimensional cubic interpolation to produce a nice, smooth slice image for you! Taking a straight linear shot though the data results in a very choppy image.
The data that Brain makes use of comes from the Whole Brain Atlas at Harvard University. Of course, Brain is not limited to slicing only brains! If you have a stack of images that you would like to slice through, go ahead. Be warned that Brain is currently in beta and therefore has not been thoroughly tested for different datasets.
If this is enough for you, go for it!
There are two main windows that Brain presents to the user: the Cross Section Selector and the Image Window.
Rotation (View Selection)
The Cross Section Selector will first appear after launching Brain. This is the window that allows the user to select a plane to view. Click in the window that shows the view of the box to adjust the plane. Use the left (primary) mouse button to change the orientation of the plane by holding down the button and dragging. Hold down the shift key to adjust its height. Hit Alt+r (lowercase "r") to reset the plane to its default position. Use the right mouse button to adjust your view of the bounding cube, which represents the dataset. Hit Alt+R (uppercase "R") to reset the view (this does not affect the orientation of the plane, just your view).
Rotation may be restricted by clicking on either "x-axis" or "y-axis" (clicking on both disallows all rotation). This may be done to restrict rotation of the plane or your viewpoint.
The intersection of the plane and the cube is displayed in white. In addition to this, a larger bounding box is displayed. This represents the viewport that will be rendered. A small set of three lines represent the center of the cube.
Loading a Dataset
Load a dataset by clicking on the "Load" button. A dataset is a set of images, all in one directory. Select a directory to load (the program comes with "normal"). A status bar will appear to indicate progress. The program loads only image files, so make sure that the Tracker recognizes all of the files in the directory as image files (a little image icon should appear, or "image/*" should appear under the kind of file). If the Tracker doesn't show the images as images, select them and choose "Identify" from within the Tracker.
Once you have selected a viewpoint and a dataset, click on "Render" and wait a while. The image should appear in a new window, the Image Window. Rendering can be slow.
You can get more datasets online at the Whole Brain Atlas. It takes a little work, since they do not come neatly packaged up. I used wget on a Linux box to script the download of the few datasets that I have. A dataset should be stored as a directory with a bunch of images in it. The order of the images is taken to be ASCII order when reading them in, so labelling them "000.gif, 001.gif" like the dataset that came with Brain is a good idea.
Notice also that most datasets are something like 256x256x50, i.e. there is a lot more data in the x and y directions than in the z direction. This means that the image loses quality if the slice is taken in the z direction (it gets fuzzy). The interpolation used helps this out a little.
Also, I will try to post a few interesting datasets on my web site, space permitting, at http://www.macalester.edu/~bmagocsi/.
Image Window
Once the rendered image appears, you may click on it. A blue spot will appear in the cube in the Cross Section Selector to mark the spot that you have clicked on in three space. This allows you to mark a spot in one view and then find it using a different orientation. (For instance, you can mark an eyeball in one view, then go look at it at a different angle. Or a tumor, if you have the appropriate dataset).
In the Cross Section Selector
- Left (or primary) mouse button + drag: change orientation of plane
- Shift + left (or primary) mouse button + drag: change displacement of plane
- Right mouse button + drag: change your view of the cube
- Use the "restrict rotation" check boxes to restrict rotation about a particular axis.
In the Image Window
- Click in window: marks a blue point in cross section selector corresponding to clicked-on point.
Also, each of the text items in the Cross Section Selection window (Help, About, and Visit the Whole Brain Atlas) can be clicked on. The last one takes you to the site where I got the MRI images of the brain.
This program was inspired by the program submitted along with a winning paper in the 1998 COMAP mathematical modelling contest (it won two of four first prizes). The program and paper were written by Paul Cantrell, Nick Weininger, and Tamas Nemeth.
Interpolation
In order to achieve a nice slice through the dataset, it was necessary to use cubic interpolation in three dimensions. This makes for a smooth cut through the data with no rough edges. It also makes for a fairly long rendering time.
Improvements
The program is currently in beta, meaning it is the first basic working copy. I tried to get rid of all of the bugs, but there may be some strange behaviour. There needs to be some more error checking.
Future additions
- Clicking on a point in a rendered image should give an interpolated zoom about that point
- Faster rendering. Rendering is as slow as it is because I developed this on my Dual-66 BeBox, the slowest computer that runs the BeOS (I think). Ahem. I also only have 16 MB of RAM, so I need to conserve memory rather than go for speed.
- Multiple images at once. Not too hard.
- Scripting support.
- Smarter memory management scheme for more awkward datasets.
- Could be threaded better. Currently, no rendering threading is done aside from the standard "one thread per window".
- I only have the limited linker, so improvements really are limited. Ahem.
More abstraction will be done!