Jump to content

Medical 3D Model Creation: From CT Scan to 3D Printable STL File in 20 Minutes Using Free Software Programs 3D Slicer, Blender, and Meshmixer


Dr. Mike

81,208 views

blog-0953574001443589683.jpg

 

UPDATED TUTORIAL: A Ridiculously Easily Way to Convert CT Scans to 3D Printable Bone STL Models for Free in Minutes

Hello, it's Dr. Mike here again with another tutorial on 3D printing. Proprietary software that creates 3D printable models from medical scans typically costs tens of thousands of dollars to license. But, did you know that you can do the same thing using freeware? It's true! In this tutorial I'm going to show you exactly how to do this.

 

We will be using the free, open-source program 3D Slicer to convert a CT scan of a skull into an STL file ready for 3D model printing. We will also use the freeware software programs Blender and Meshmixer to perform some final cleanup of the STL files before sending them to the printer. All three software programs are available on Windows, Macintosh, and Linux, so you can use the methods described here on almost all personal computers.

 

If you master this workflow you can create 3D printable models very quickly, as illustrated in my brief tutorial on Creating a 3D Printable Skull in 5 Minutes. If you are on a Mac and prefer to use Osirix, see my tutorial on Creating 3D Printable Models with Osirix. Once you have completed your 3D printable model, be sure to share it with the community via the File Vault, or if you prefer, you can sell it on this website.

 

Before you began I highly recommend you download the free associated file pack. The file pack contains files that will allow you to follow along with the tutorial, making it easier and faster to learn. This includes the same CT scan used here. The download is free for registered members, and registration is also free and only takes a moment.

 

 

 

 

 

Creating a Skull STL File for Medical 3D Printing using 3D Slicer

 

If you haven't already, download 3D Slicer from slicer.org. Open Slicer.

01 slicer icon


Drag and drop the folder that contains your DICOM images onto the slicer welcome window, Figure 1. If you downloaded the file pack, the DICOM folder is the one that begins with "1.3.6" followed by a whole bunch of numbers.

 

Fig 01 drag dicom Set


Figure 1: Loading your DICOM data set by dragging and dropping the DICOM folder onto 3D Slicer.

 

Slicer will ask you to select a reader to use for your data. Leave the default setting selected, "Load directory into DICOM database" and click OK. Slicer will ask you if you want to copy the DICOM files into the Slicer database or just add links to the DICOM files. Click Copy, Figure 2.

 

Fig 02 copy files


Figure 2: Telling Slicer to copy the DICOM files into the Slicer database.

 

Slicer will now take a minute or two to load your DICOM data. Once the data has loaded you should get a pop-up box telling you that the study imported successfully. Click OK. At this point a window titled "DICOM Browser" should be showing. Select the study with patient ID TCGA-06-5410. Click on the Load button in the lower left-hand corner, Figure 3.

 

Fig 03 select study from DICOM browser


Figure 3: Loading the CT scan into the active seen within Slicer.

 

At this point you should see a matrix with four boxes in the right half of the Slicer window. In three of the boxes you will see the axial (transverse), sagittal, and coronal views of your imaging study. If you don't see this, you can adjust the viewport layout using the viewport button.

6a view button


Select the Four-Up viewport layout as shown in Figure 4.

 

Fig 04 Four Up view


Figure 4: Selecting the Four-up viewport layout.

 

Next, go to the Volume Rendering module. You can access this from the drop-down menu at the top now bar as shown in Figure 5.

 

Fig 05 open volume rendering


Figure 5: Selecting the Volume Rendering module.

 

Once you are in Volume Rendering, turn on volume rendering by clicking the small eyeball to the left of the Volume drop-down menu, as shown in Figure 6. The 3D volume should now be displayed in the fourth square on the right part of the Slicer window. However, the volume is likely not centered. To center the volume click on the small crosshairs at the upper left corner of the volume screen, as shown in Figure 6.

 

Fig 06 turn On volume And center


Figure 6: Turning on volume rendering and centering the volume view.

 

You now need to adjust the appearance of your 3D volume. Under the Display section, select a Preset. For this model, select the third icon from the left on the top row, which should be CT-Bone. Slide the Shift slider to the right until the 3D volume looks good. These actions are shown in Figure 7.

 

Fig 07 bone preset


Figure 7: Selecting and adjusting a 3D display Preset.

 

Now we are going to start actually constructing our 3D surface model. From the module drop-down menu, Editor, as shown in Figure 8. When asked to create a merge label map, use the default selection GenericAnatomyColors, and click Apply, as shown in Figure 9.

 

Fig 08 open editor


Figure 8: Selecting the Editor module.

 

Fig 09 select label Map


Figure 9: Choose the default merge label map.

 

First, we're going to create a label map that denotes the skull. Click on the Threshold Effect Tool button. It looks like this.

12 threshold effect button


The threshold effect tool will then open as shown in Figure 10. We want to select bone, so click on the green rectangle to bring up a choice of label maps. Select 2 – bone. The blinking area should turn a yellow-orange color. Next, define the minimum Threshold Range. If you are using the DICOM data set from the file pack, set this to 1250. If you are using your own scan, this will be a different number, probably closer to 300. Experiment with the values until the blinking region seems to encompass the structures you want to 3D print. Leave the default maximum Threshold Range at 4095. The settings that you need to modify are shown in Figure 11. When you are satisfied with your selection, click Apply.

 

Fig 10 threshold effect tool


Figure 10: The Threshold Effect Tool.

 

Fig 11 threshold effect settings


Figure 11: The Threshold Effect parameters to set.

 

Now you have created a "label map" that encompasses the bony skull we wish to 3D print. We need to generate a surface model. Click on the Make Model Effect button, which looks like this.

12 make model effect button


Make sure that the target label is still set to 2 (bone). Click Apply, as shown in Figure 12. 3D Slicer will take about 10 seconds to generate the surface model. When it is completed, you will notice a slight change in the appearance of the 3D rendered image in the upper right view box.

 

Fig 12 make model effect tool


Figure 12: The Make Model Effect tool.

 

You now have a 3D surface model, and need to save it in STL file format. Click on the save button on the left portion of the upper toolbar. 3D Slicer asks you what you want to save. The only thing we are interested in is the bone surface model, so uncheck everything except "bone.vtk." Choose STL for file format and specify the directory you want the file to be saved, as shown in Figure 13.

 

Fig 13 save Stl file


Figure 13: Saving your 3D surface model as an STL file.

 

You should now have a file called bone.STL. Although tempting to send your new STL file directly to a 3D printer, don't do it. Your file is not yet ready for 3D printing. Fortunately, we can fix most problems with our next software program, Blender.

 

Performing Additional Skull STL File Cleanup in Blender

 

If you haven't already, download the free Blender software program from blender.org. Install it and open Blender.

02 blender icon


Delete the default cube that is shown in Blender by hitting the X key followed by the D key. Import the STL file by going to the File menu -> Import -> STL, as shown in Figure 14. Blender may take 10 to 15 seconds to import the file as it is fairly large.

 

Fig 14 import STL into blender


Figure 14: Importing the STL file into Blender.

 

Next, you need to center the skull object in the field of view. Select the Object menu in the lower left-hand corner, then click Transform -> Geometry to Origin, as shown in Figure 15.

 

Fig 15 center model


Figure 15: Centering the object in the field of view using the Geometry to Origin function.

 

You will notice that the imported skull appears quite large. Don't worry about this. Simply use your scroll wheel on the mouse to scroll out. If you have a middle mouse button, you can use it to rotate the skull. Next, we are going to delete the innumerable disconnected mesh islands in our skull object. Go to Edit Mode, as shown in Figure 16.

 

Fig 16 Edit mode


Figure 16: Entering Edit Mode.

 

When you are in Edit Mode, you can directly edit the mesh of your object. Initially, the entire mesh is selected, thus the skull appears orange. Right click somewhere on the skull. It does not matter where as long as it is not one of the disconnected mesh islands. By right clicking, you will select a single vertex. Expand the selection to include all connected vertices by clicking Control-L on your keyboard. You will notice that the skull has turned orange, but the disconnected mesh islands are still black. Next, we want to invert the selection by hitting Control-I on your keyboard. The selection is now inverted, and only the disconnected mesh islands should be shown highlighted in orange, as shown in Figure 17.

 

Fig 17 free islands selected


Figure 17: Selecting the disconnected mesh islands.

 

With the disconnected mesh islands selected, delete them by hitting the X key on the keyboard. A menu of deletion choices is presented. Type "V" for Vertices. This is shown in Figure 18. The disconnected mesh islands are now deleted.

 

Fig 18 delete vertices


Figure 18: Deleting the vertices of the disconnected mesh islands.

 

Go back to Object Mode by selecting it from the mode button on the lower left as shown in Figure 19.

 

Fig 19 object mode


Figure 19: Returning to Object Mode.

 

From Object Mode select the Modifiers toolbar. It has a button that looks like a small wrench and is located in the right tool column. Modifiers are functions that you can apply to your mesh to change its appearance. In this case, we are going to smooth out our mesh. Click on the Add Modifier menu and select Smooth from the Deform column. DO NOT select Laplacian Smooth. That is a different modifier. The correct selection is shown in Figure 20.

 

Fig 20 smooth modifier


Figure 20: Opening the Smooth Modifier.

 

Set the Repeat field to 30. Blender may take a few seconds to perform the smoothing function. Then, click Apply, as shown in Figure 21.

 

Fig 21 smooth modifier applied


Figure 21: Settings for the Smooth Modifier.

 

You are now ready to save your smoothed and cleaned-up STL file. From the File menu, select Export -> STL, as shown in Figure 22. Navigate to the folder you want the file to be saved in and type a file name. In this case, we are going to call the file "bone smoothed.stl." Close Blender.

 

Fig 22 save STL


Figure 22: Saving your cleaned-up STL file.
Performing a Final File Check in Meshmixer Before 3D Bioprinting

 

If you haven't already, download Meshmixer from Meshmixer.com. Open Meshmixer.

03 meshmixer icon


Click on the Import button as shown in Figure 23. Select your smoothed STL file that you just created in Blender.

 

Fig 23 meshmixer import


Figure 23: Meshmixer's Import button.

 

Meshmixer will take 10 to 15 seconds to import the file. Once imported, you can rotate the orientation of your skull object by using the right mouse button. Click on the Analysis button and choose Inspector as shown in Figure 24. The Inspector tool will check your mesh for the defects that could cause problems during 3D printing. Any problem areas will be highlighted by red, blue, or pink lines. In this case, our mesh looks great, without any errors as shown in Figure 25.

 

Fig 24 meshmixer inspector


Figure 24: Opening the Inspector tool.

 

Fig 25 meshmixer inspector done


Figure 25: A clean mesh ready to 3D print!

 

That's it! You have now created a defect-free high quality STL file of the skull from a CT scan using free software. You can take the money you saved by not buying proprietary software to do the same thing, and by yourself a new car or something.

 

Fig 26 final model


Figure 26: The Final 3D printed product.

 

I hope you found this tutorial helpful, and you will begin designing 3D printable medical models from medical scans yourself. Embodi3D is here to help you. If you have questions, post them in the comments below or in the Forums. Share 3D printable models you have designed in the File Vault, or download models that others have shared. You can even sell your 3D printable creations! If you want to learn more about how to create 3D printable medical models, there are many more helpful and free tutorials.

10 Comments


Recommended Comments

Thanks for this! I haven't used Blender in a while so the tutorial will help me to try it out again.

 

Do you ever use the Grayscale Model Maker module in 3D Slicer to make 3D models?

Link to comment

I'm glad you found it helpful! I haven't tried the Grayscale Model Maker, but if you recommend it I will do so. I Love using open-source software for medical 3D printing!

Link to comment

thank you for the tutorial... I have a tibia bone ct scan data ...would you please tell me what changes should i make to create a high quality stl file with the most details on it?

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...