Giter VIP home page Giter VIP logo

build-a-brain's Introduction

brain_printer

Do you have an MRI of your Brain?

Do you want to get an .stl file of your brain so that you can make 3D print of it?

All you need is Docker.

This project describes the creation of a docker image that can take an MRI scan and output an .stl file suitable for 3d printing.

It also generates a rotating .gif of that .stl file so that you can see if it's worth printing.

For this to work, you need a high-quality, high-resolution T1-weighted image - sometimes called an MPRAGE.

The docker image itself is pretty large (>8GB) and may take a while to build. The processing itself can take more than a full day to run.

HOW TO USE THIS REPOSITORY

  1. install docker

https://www.docker.com/

  1. clone this repository

git clone https://github.com/danjonpeterson/brain_printer.git

  1. build the image from the Dockerfile, call it brain_printer

cd brain_printer
docker build -t brain_printer .

  1. put your brain image (in nifti or nifti_gz format) in an empty directory, say print_my_brain/.

If your image is is DICOM format, take a look at https://www.nitrc.org/projects/dcm2nii/

mkdir print_my_brain/
cp my_brain.nii.gz print_my_brain/

  1. run the docker image, mounting your newly created directory in /data

docker run -ti --rm -v /full/path/to/print_my_brain/:/data brain_printer

  1. from the docker image, run the script: run.sh

/brain_printer/run.sh

OUTPUTS GENERATED

If everything works well, in your new directory you should see these files:

rh.stl - file for 3d printing the right hemisphere
lh.stl - likewise, for the left

rh.gif - an animated gif showing you the model for the right hemisphere
lh.gif - likewise, for the left

001/ - a freesurfer processing directory that has lots of information about the brain

The .gifs look like this:

LEFT HEMISPHERE:

RIGHT HEMISPHERE:

MORE ABOUT THIS REPOSITORY / DOCKER IMAGE

This was created as part of neurohackweek2016. It uses freesurfer (https://surfer.nmr.mgh.harvard.edu/) to extract the cortical surface. You really should get your own license file https://surfer.nmr.mgh.harvard.edu/fswiki/DownloadAndInstall#License and put it in your copy of the docker image.

Also loaded in the docker image is:
stl2pov https://github.com/timschmidt/stl2pov
povray http://povray.org/
imagemagick www.imagemagick.org

Thanks to Valentia Staneva, Matteo Visconti, Chris Madan and everyone else at #NHW16

Writeup here:

https://doi.org/10.3897/rio.3.e13394

STILL TODO

  • fully test freesurfer the whole way through (not done for this ~4 day project - it was faked by copying files over from a completed freesurfer run)
  • dicom support
  • smooth/decimate mesh
  • make standalone html file to contain the .gifs

KNOWN ISSUES

Freesurfer can be tempermental, depending on the quality of the input image. There is an active and searchable listerv/forum on the Freesurfer website (http://www.mail-archive.com/[email protected]/).

One user had some conneciton issues installing some of the packages during the container build. This was resolved by editing the docker config as described here: https://stackoverflow.com/questions/24991136/docker-build-could-not-resolve-archive-ubuntu-com-apt-get-fails-to-install-a?rq=1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.