3D Print Your Own Brain

22,838

245

25

Posted in Technology3D-Printing

Introduction: 3D Print Your Own Brain

Always wanted to have your very own 3D printed brain?

With modern technique this is possible and do-able for everyone!

The only costs that you will have are the one of the 3D printing.

What you need:

- The raw data of an MRI scan of your brain (T1 scan, but maybe T2 also works). Files should be in NIFTI (.nii or .nii.gz) or DICOM format (.dcm or no file extension). You can easily get a MRI scan by participating in an (f)MRI study of your local university (check the medical/neuroscience/psychology department). Often they even pay you quite well for participation. It's important that you request the raw data. Sometimes the hospital only gives you PNG files, which can not be processed.

- FreeSurfer: In my case I used the version for Virtualbox for Windows. If you use Mac/Linux you will be able to install FreeSurfer directly to your computer and I assume that you have enough computer knowledge to do so. I'm using version 5.3.0, but probably newer versions will work as well.

- MeshLab: To process and refine the mesh.

- (optional) 3D printer

I have found a couple of tutorials on the internet, but non of them really seemed to work for me. I found this instruction, but it was not very detailed and still took me quite long to figure out how to do the individual steps. My instruction here is basically the one that I linked but in a step-by-step manor, so that everyone can follow.

Step 1: Install VirtualBox and FreeSurfer (and Convert DICOM to NIFTI)

(Update September 2017: There is a newer version of FreeSurfer which is not provided for Windows.The instructions were made using FreeSurfer 5.3.0. I provided a link to the old version at point 2.)

These are instructions for Windows. If you have Linux of Mac you can install FreeSurfer directly using the instructions on the FreeSurfer website

  1. Install VirtualBox for "Windows hosts x86/amd64" from this link (~110MB)
  2. Download and extract the FreeSurfer Virtualbox (Xubuntu) image from here (the last link, ~9GB)
  3. Follow these instructions to install FreeSurfer for VirtualBox. I recommend using more Memory than they use (like 2-4GB).

-----------

If you have your MRI files in DICOM you can convert them using the dcm2nii tool by MRIcron: win.zip

(If they are already in NIFTI format, then you can skip this step.)

  1. Exctract the files and open dcm2niigui.exe
  2. Click "file->DICOM to NIFTI"
  3. Select folder with your DICOM files inside and click "open"
  4. The programm should run for a few seconds
  5. Inside your DICOM folder there should now be one or more .nii.gz files. If in doubt just use the largest one. I renamed it to "brainscan.nii.gz" to make it easier to find and handle.

You can also use DICOM files directly in FreeSurfer, but for simplicity I assume that you use NIFTI files.

(more information to dcm2nii can be found here)

-----------

Step 2: Extract Brain Tissue Using FreeSurfer

Brain tissue reconstruction from MRI image is a science on its own. What seems quite easy is actually a computationally demanding task. There are various programs of various complexity do the job. The advantage of FreeSurfer is, that it runs without setting any parameters. This makes it easy to use for people with no neuroscience background.

Peparation:

This step is necessary to allow easy drag&drop between the host and the guest system

  1. Open the VirtualBox and start the FreeSurfer image
  2. Click on Device -> Insert Guest Addition CD image
  3. Double click "autorun.sh", insert sudo password "freesurfer"
  4. Restart the virtual machine (upper right corner "fsuser" -> restart)

Brain exctraction

  1. Drag your NIFTI file (brainscan.nii.gz in my case) to the Desktop of the Virtual Machine
  2. Open the Terminal
  3. Type recon-all -s mybrain -all -i /home/fsuser/Desktop/brainscan.nii.gz and press enter, where brainscan.nii.gz is the name of your NIFTI file. (see picture)
  4. Wait for the process to finish. After finishing it will say something like "[..] mybrain finished without error [..]"

Depending on your computer speed this can take up to 2 days. On my 4x3Ghz it took 12 hours. You can pause and resume the Virtualbox at any time using “Machine->Pause”. This way you can resume the process after turning off your host computer.-

  • If you want to speed up this process, you might want to consider giving the virtual machine more RAM and the usage of more CPUs (you can do so in the machine settings). You need to restart the virtual machine after that.
  • If the Freesurfer process gets cancelled or crashes you need to use a different subject name (mybrain2) or delete the subject folder to try again.
  • What is happening in the background: FreeSurfer will try various things to determine the best brain extraction parameters. It will iterate through thousands of different parameters and see if the results are good or not. This is necessary because every brain is different and requires different parameters.

(If you want any further information on FreeSurfer, please read here)

Step 3: Convert Your Brain to .stl

The computed brain is in .pial format, but what we need is .stl

Luckily FreeSurfer includes a tool to convert the files.

Open a terminal window and type

  • mris_convert /usr/local/freesurfer/subjects/mybrain/surf/rh.pial rh.stl
  • mris_convert /usr/local/freesurfer/subjects/mybrain/surf/lh.pial lh.stl
  • and last: xdg-open /usr/local/freesurfer/subjects/mybrain/surf/ (or alternatively navigate there yourself with the file manager)

Now try to find the two files rh.stl and lh.stl and drag them to you Windows system

One of them is the right hemisphere (rh.stl) left hemisphere (lh.stl).

FreeSurfer can also extract the cerebellum and other parts of the brain, but in this tutorial we'll focus on the hemispheres only. This has one advantages: Your brain will nicely stand on it's own. As the cerebellum is round and at the bottom of your brain, it might not do so with it. I've found a nice tutorial here: https://github.com/miykael/3dprintyourbrain that shows you how to extract it.

Step 4: Install MeshLab and Refine the Mesh

Now you just need to combine the two hemisphere meshes that we obtained from FreeSurfer.

To do so you can use any modeling software, I chose MeshLab as it's free. But be aware: MeshLab does not have an "undo"-Button. So every change you make on the mesh can't be undone, you can only reload your mesh.

  1. Download and install MeshLab from sourceforge (~35MB)
  2. Start MeshLab and import lh.stl and rh.stl (left and right hemisphere) via "File" -> "import mesh". Whatever message comes up, just click ok.
  3. Click on "Filters" -> "Mesh Layer" -> "Flatten Visible Layers" and apply

Now your brain mesh is technically ready to go! Your mesh might only have too vertices (=it is too complex) for most current 3D printers. So we can simplify it.

  1. "Filters" -> "Remeshing, Simplification, Reconstruction" -> "Quadratic Edge Collapse Decimation"
  2. Enter your number of vertices, I took 150.000, which seemed to be simple enough. Click apply.
  3. To make it look nicer, now use "Filters" -> "Smoothing, Fairing and Deformation'" -> "Laplacian Smooth" and just click apply once.

Now you just need to export the brain in whatever format you prefer (File -> Export as).

Step 5: 3D Print Your Brain

Voilà you're done! :)

So either you owning a 3D printer and know what to do with the mesh

OR

You can send your mesh now to a 3D printing service. I printed mine with 3dhubs.com, this is a service where private people provide their printer for you.

If you want, you can also create a chocolate mould and make chocolate brains like these guys.

If you have any questions or feedback, please leave a comment.

If you want to print subcortical parts like the cerebellum, look at these instructions.

3 People Made This Project!

Recommendations

  • Spotless Contest

    Spotless Contest
  • Microcontroller Contest

    Microcontroller Contest
  • Space Challenge

    Space Challenge
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

25 Comments

What materials have people used to print brains? I was told by a operator on 3D Hubs that PLA isn't possible due to the supports being difficult to remove, so he suggested SLS, but SLS is very expensive.

1 reply

I've used PLA for all brains I've printed so far. You just need to make sure to place the brain in the right orientation so that the supports will disturb be less visible in the end (placing the supports at the back/bottom). I have, however, found substantial differences in quality from different printers.

Just use a different hub!

brain_new2.jpg

Could someone print me a large (like 10-12" long) brain? What would you charge? Thanks.

Hey! Looks super-cool.

I get to the point where the instruction is to drag the NIFTI file to the desktop of the VM, but when I do that, nothing happens. I just re-installed the VM and everything and still nothing. Bidirectional Drag&Drop is checked, I did the Guest Additions, restart, and still nothing. No error, the mouse-cursor just turns to the "Unavailable" circle-with-bisecting-line.

My main machine is Windows 7 64bit.

Any advice?

1 reply

If drag&drop don't work send it to yourself via mail and receive if inside the VM via the web interface of your email client. Cumber-sum but the quickest solution.

Hey,

Sorry this is probably going to sound woefully unspecific, but I've now tried to run my NIFTI files on three separate occasions and each time it has "exited with ERRORS" and has failed to produce a PIAL file. I'm running the virtual machine with 4 Gigs of RAM and each time the cycle has run for about 12 hours. I am using the largest file size file from the DICOM to NIFTI conversion. Any thoughts/recommendations?

Marc Chmielewski

1 reply

what error exactly? You probably have to look into the FreeSurfer support to ask for help (it's open source, so don't expect too much help). Have you tried using the the DICOM as input (look in the FreeSurfer documentation for help)?

Sorry, but... Why don't you use a 3D scanner instead of the MRI? You only need to remove the brain from the cranium, but just remember to put it back like it was before and you should be ok...

do you need to use you mri scans, or can you use a picture of one from google?

1 reply

you can certainly use any MRI scan that you want. But it needs to be a whole scan, not just an image from Google images.

would this work on annoying people? To the best of my knowledge they don't have brains

8 hours of computing later I'm ready to heat up the 3D printer!!!

Hello,

This is a nice a detailed tutorial. I am trying to extract the brain from a friend's MRI. I first converted DICOM files to Nifti format.

Everything went well. After that I launched the extract on FreeSurfer and let it run all night long and the following day (=today).

Since this morning it looks stuck on errors like the following lines :

after 200 iterations, nbhd size=2, neg = 2
starting rms=0.008, neg=2, removing folds in lattice....
iter 1, dt=0.000188: new neg 2, old_neg 2, delta 0, rms=0.006 (24.677%)
iter 2, dt=0.000573: new neg 1, old_neg 2, delta 1, rms=0.005 (12.005%)
iter 3, dt=0.000573: new neg 0, old_neg 1, delta 1, rms=0.005 (11.936%)
0376: dt=3.869210, rms=0.621 (0.379%), neg=0, invalid=96777

I am using FreeSurfer on the virtual machine provided in this tutorial, running on VirtualBox for Mac. Should I wait a little more ?

My macbook has 16GB RAM, 128GB SSD and an Intel Core i7 proc.

Thanks for your time

3 replies

I forgot to mention that I set the virtual machine with 10GB RAM.

Mhh to be honest, I have no idea. If there are no results after 24h, I'd say something is wrong. I'm not an expert on FreeSurfer or MRI-images, so I'm afraid I can't help you.

I ran it on 3x3.2 Ghz and 8GB of RAM + SSD and it took less than 8h to finish in a VirtualBox.

You are right, after almost two days the process finally exited with errors :(

I retried on another computer and dedicated 4 of 6 cores + 10GB RAM for the VM. And I had a pleasant result after less than 20 hours :)

Also, I was wondering what exact configuration you were using, thanks for the info and reply.

user

I can't find those other brain files yet, do you know how you can get other parts like the brain stem etc.? I would love to print more parts..

By the way, I volunteered for new 7T MRI and this tutorial works for that too. I got a dcm and NIFTI file after the scan. Thanks again for this nice tutorial.

1 reply

It is definitely possible with FreeSurfer, but to be honest, I haven't tried it yet.

If found two pages: http://neuroimage.usc.edu/forums/showthread.php?840-Cerebellum-mesh&s=421b4f97a385613fecdce9a9aed39e0d

and

http://brainder.org/2012/05/08/importing-freesurfer-subcortical-structures-into-blender/

Maybe you can follow their advice?
Otherwise you can have a look at the FreeSurfer wiki.

user

Very nice instructions, thanks a lot! I am now in the process of waiting until the Virtual machine hopefullt produces a file of my grey matter. I do wonder how do you get the other parts of the brain? I saw amygdala, brain stem and many more come by in the calculations. It would be nice to maybe make a puzzle/anatomy collection of the brain parts. How could I do that?