Monday, February 18, 2013

The brain is flipped!

So, one of the surprising observations about my brain is that it's highly asymmetric. The gyri are clearly asymmetric, but when holding the model, it's quite clear to me that one side of the brain is noticeably larger than the other. In particular, the right side of the brain in the model is bigger than the left, especially in the occipital lobe.

Based on the common saying that the left side of the brain gives rise to rational thinking, while the right side of the brain gives rise to artistic abilities, I then told my parents over the phone that I must, in fact, be an artist.

They shot me down pretty harshly. My mom told me, "no way, you don't even play an instrument"; and my dad told me as well, "that can't be true. I can't ever imagine you singing on TV. There must be a mistake."

So, when thinking about possible sources of error, it occurred to me that when stacking the 2D sagittal slices into a 3D volume in Matlab, I was not careful at all about the stacking order of the slices! So, there was the possibility that I have mistaken the left-right orientation when building the 3D dataset from the images.

I was able to get to the bottom of this confusion by comparing a screenshot of the data that I took at Siemens, with the correct left-right orientation, with the CAD model that I extracted a few days ago. By comparing the gyri patterns (I highlight them in color in the image below), indeed the model has been reversed and I'm not an artist just like my parents said...

The 1:1 model will be printed with the correct orientation.

Extract the skull!?

I did some preliminary explorations to see if I may be able to extract a model of my skull as well. Here's a screenshot of a rough exploration through my face. It seems that the skull may be salvageable!

Piece of cake!

Well, that turned out to be much easier than expected! Right now, a 1/3-scale printout of my brain is in my hands after less than a day of work. (One caveat: I may have accidentally applied a left-right mirroring of the model. More later.)

Starting this effort, I expected that I may need to wrestle with proprietary image formats. I thought that I might need to contact my old colleagues at Siemens, asking them to preprocess the files on my CD (which had no extensions) into Matlab data files that I could easily work with. Nope. It turns out that the files are DICOM images which can be easily loaded by standard Matlab functions.

So, I began by examining all images that were present on the CD. There are some "mosaics" for diffusion weighted imaging scans:
As well as "standard" anatomical scans. Actually, there seems to be two sets of these latter scans, which may be useful later... (I have proton density and T1 datasets. More background on underlying MRI physics here, i.e. NMR experiments from my undergrad days at MIT.)

Next, I took the one set of the anatomical scans, and loaded it into a 3D volume data in Matlab. Conveniently enough, the pixel pitch is 1 mm in all directions:

(There's significant "fuzz" around the bottom of the image, by the chin. Perhaps a filter such as the bilateral filter may be appropriate to denoise and yield better output surfaces...)

The next step is to extract an isosurface that captures the gyri of the brain. (Learning anatomical terms here!) Prior to the isosurface extraction, I've found it useful to use an averaging filter to reduce speckle. This step thus involves some trial and error to find the appropriate parameter values for the filter width and appropriate isovalue. The isosurface is represented as a "patch" object, which is essentially a triangulated surface. The preferred file format of the 3D printing community is "STL", which also consists of triangulated surfaces. So, it's quite easy to write an export routine from Matlab to the STL format.

The raw output of the Matlab isosurface extraction routine was quite gruesome like a zombified self portrait:

Nevertheless, I could tell that the brain was more-or-less captured by this output, and I moved to "clean" the resulting model using a low-level 3D model editor called Netfabb. This was a bit of a laborious process since it's editing the 3D model at the level of individual triangles. Moreover, there were some "issues" with the isosurface extraction, with bodies that were not completely closed, or nearby surfaces that erroneously fused, etc. Furthermore, I had to make an on-line decision for which parts of the model to keep, and what other parts to throw away. This was relatively straightforward for the top of the skull, but the model was very complicated in the vicinity of the spinal cord.

An amusing side note: The triangles that represent a surface are oriented -- that is, they have an "outside" and an "inside" face. Netfabb by default displays the outside face as light blue, and the inside face as dark red. This meant that, as I was cutting away excess material around my brain, the model became bloody! Here's a screenshot from an early attempt at cleaning the model:

After a few hours of working with Netfabb, I became somewhat adept at cleaning and repairing the brain. Here is the final result:

To begin, I was able to print a 1/3 scale model of the brain in plastic at Stanford (with the help of Joan, my personal mechanical engineering guru!). The full scale model, printed in stainless steel at Shapeways, will cost $10k! I'll need to hollow out the interior mass...

Tuesday, February 12, 2013

The data that I have

Here are some representative examples of the MRI data that I have.

At Siemens, I worked on (mostly) image processing technology for diffusion weighted imaging. (My US patents here and here.)

These are processed diffusion weighted images (the tracts indicate the dominant direction of water flow in the brain):

I also have some standard MRI images:


This story begins four years ago, in 2009... I took advantage of a wonderful work-abroad program at MIT, which took me to Siemens Healthcare in Erlangen, Germany.

One keepsake that I took away from this experience is a CD containing MRI images of my own brain. In this blog, I will document my attempt to turn these bytes into real 3D models of my brain anatomy!