Search This Blog

Saturday, July 8, 2017

Converting CT scans into 3D printable models

In this post, I will show you how to convert CT scans into 3D printable models.  With this technique, you can extract different structures in a person's body and then print them out to use in experiments or to just keep as decor.  Many scientists use this technique to study individual patients and try to develop a specialized solution for their patients; for example, one UCSD professor 3D printed a patient's brain aneurysm to study his blood flow and determine the best course of action.  I had to perform these tasks at a recent bioengineering internship.


1. Download a DICOM file:  You can find many DICOM files that are for public use on online databases (these files are also quite large).  However, the DICOM file you download must be from a CT scan and when you extract the zipped DICOM, it must end up as a folder with many subdirectories filled with dcm files (some websites provide a you with a single dcm file and that will not work in this method).

2. Install Invesalius 3.0.  This software was designed by the Brazilian government for research purposes but is now only hosted on Github.  Go to the releases section on their Github page ( and download the correct installer for your operating system.  Once your download finishes, just install it; there is no bundled malware and adware.  You can also compile it with the Github source code, but this process is very complicated and convoluted (don't even try this process if you run Windows).  However, if you are a Linux user (especially Ubuntu users) and would like to attempt this, you need to first follow their repo's instructions, but DO NOT install Python-vtk6 and USE PIP to install Cython.   If you followed the repo's instructions completely, many of your Python based programs will break because python-vtk6 breaks the dependencies for the commonly used python-vtk and your compilation progress will fail because apt-get does not provide the newest version of Cython.

3. Open up your DICOM file with Invesalius by navigating to File - import DICOM.  Next, without clicking on any of the image groups, press the import button.  This action will load the Dicom images on three different planes.  Windows users may need to move the scroll icon a little on each of the four boxes that appear afterward in order to visualize the CT scan.

4. Scroll around on each plane until you find your region of interest.  Then, on the Create New Mask tab, you can use a predefined preset (Ex. muscle, bone, fat) or play around with the mask settings until your region of interest is selected. Remember, the area in green is the selected area.
The predefined presets give users a faster way to select an area of interest; however, it does not work everytime.

5. Now, check Overwrite last surface and press Create surface.  This process generates the 3D model and will take a while.

6.  You can play around with Configure 3D surface, but that step is not necessary.  You can get the stl file now by clicking Export 3D surface.

7. Now download and install MeshMixer here.

8. Open up the exported stl file with MeshMixer. With this tool, you can isolate a specific section of your region of interest (Invesalius's masking tool leaves a lot of extra unnecessary regions.  For example, when I was isolating an abdominal aorta, Invesalius left the spine in the exported stl).

9. You rotate the 3D object by holding the right click button and you pan the view by holding down the middle click button.

10. Press select and use the brush tool to select regions you do not need.  You can either draw shapes around or paint certain regions; the program will highlight those regions orange.  Then, press the del key (not the backspace one) on your keyboard to delete that region.  Repeat this procedure until you have isolated your region of interest; this procedure will take a while.

Highlighted regionn for deletion
The abdominal aorta I isolated from the torsa region of a CT scan

11. Now, you can smooth your model.  Use the brush tool, paint the entire object, and press Ctrl F.  A window will pop out and you need to click accept in order to finalize the smoothing procedure (you can play around with the smoothing settings in that window).
The abdominal aorta after smoothing
12. Now export the model as a stl file.  In order to 3D print, you will need to run it through a program that will convert the stl file into a GCODE file (Ex. Slic3r).  However, you will need to also generate support for the model and the printed model's resolution may not be as great as the one you see on MeshMixer.  You can also 3D bioprint the model with printers like the BioBot, but that procedure is much more complicated and is different for each printer and each type of material.

No comments:

Post a Comment