Now it’s not easy to do but if you have high quality medical images of your anatomy, you can use open source tools to create 3D-printable .STL files. Have a brain MRI? You can 3D print your brain. Have a CT scan? You can isolate some hard tissue structure and 3D print it. There’s no shortage of walkthroughs out there on this topic, this one is my favourite, but having recently segmented a brain for a client and seeing a vendor at MD&M recently offering software with this functionality for $600 whose examples were pretty terrible, I thought I would add some colour to the conversation.

Here’s my attempt at a step by step guide on how to segment hard tissue from a CT scan. I’m intentionally excluding MRI segmentation because it’s hard to do, time consuming, and I don’t have visuals to share that don’t expose patient information the internet isn’t allowed to see. If you have an MRI of your brain and want a 3D printable file, please contact me and we can discuss some options.

For this tutorial, I’m going to use the same file offered by my favourite guide mentioned above, generously posted to the web by Larry Witmer, available here. To begin, download the data and unzip them in the directory of your choice. I left mine in the downloads folder and unzipped it to a folder of the same name because I’m a file organization heathen. If you’re using your own data, navigate through it until you find a folder that resembles the image below.

Capture1

This folder is full of .dcm, or DICOM files. DICOM is the standard format for medical images, particularly volumetric data like CT scans. But there’s 327 files in here, and I certainly don’t want to deal with 327 of anything, so let’s deal with that first.

MRIConvert is a wonderful free program that converts the individual DICOM files into a stacked image that we can use for segmentation. Download the program and follow the instructions for installing – Basically just unpack the folder somewhere useful.

MRIConvert

 

Under the heading “DICOM series to convert”, click the Add Folder button and navigate to the folder containing the individual DICOM files. Hit OK and MRIConvert should load the files into the window, as illustrated above. We’re going to select the NIfTI filetype from the dropdown menu options because it plays nicely with the next piece of free software we’re going to use. Then, navigate to the output folder you want the converted series to be placed, shown in the second window. Click “Convert all” and let the program do it’s thing. This may take a bit of time depending on your computer, and you might think the program hung. It didn’t. Look for the small “Finished” text to appear in the bottom left corner of the program.

MRIConvert2

 

Navigate to the output folder you specified, and you should be able to find the three files that MRIConvert spit out. Three files is much easier than 327.

Next up, we’re going to use a delightful piece of free software called ITKSnap. ITKSnap provides semi-automated segmentation for 3D medical images, similar to functionality provided by 3D Slicer but of a much higher quality in my opinion. Download and install ITKSnap.

ITKSnap

 

Go File->Open Image and navigate to the folder with the MRIConvert output files. Select the middle one, which contains all 168Mb of image data, rather than the other two 1kb text files. Select the image file format to be NiFTi and hit Next. You’ll be greeted with a warning about a loss of precision converting from 32-bit to 16-bit precision for the image intensity values. This shouldn’t impact the quality of the segmented model, provided your image quality is high enough. If it isn’t, in many cases it’s going to be easier to take another scan than it is to fight with the image noise for hours on end (speaking from painful experience). Click finish and you should now be staring at the bone structure of this badass dinosaur. Take a moment and think about how cool this is. I love living in the future.

ITKSnap3

 

Under the Main Toolbar, click the far right icon for Active Contour (Snake) Segmentation Mode. You’re then prompted to set the ROI (region of interest) for the segmentation. Depending on what you’re segmenting, you might use this to crop out parts of the image you’re not interested in segmenting. In our case, we’re going to crop the boundaries a little bit. I like to do this by adjusting the red dotted lines, then scrolling through the image using the sliders to the right of the images to make sure I’m not accidentally cropping out parts of the skull.

ITKSnap4

Here you can see I’ve adjusted the segmentation ROI and checked to make sure I’m not clipping off parts of the dinosaur’s skull. Click the Segment 3D button and let’s get started!

On the left of the program, you’ll see we’re on Step 1/3, Preprocessing, with three steps: a) select the active contour behaviour, b) generate a speed image, and c) proceed to the next step. For step a, I suggest leaving the behaviour as region completion – I’ve had better success with it than edge attraction but feel free to experiment. For step b, select Preprocess to be taken to a contrast adjustment screen.

ITKSnap5

 

There are two tabs to play with at the top – Thresholding and Clustering. Depending on the noise in your scan, you might want to try Clustering. Here we can see two distinct peaks in the image intensity, so I think we can get away with using the simpler Thresholding option. Since we have two peaks, select the “Lower Only” option on the right and adjust the lower threshold slider until the skull pops out on the live preview. I’m a sucker for surface details and have found that one way of doing this is to put the Smoothness slider to 10.0 – You can see the effects on the margins of the bone, and in areas of lower density. Once you’re happy with the thresholds you’ve set, click OK to exit, and hit the Next button for step C.

ITKSnap6

Step 2/3 is called Initialization, where we’ll strategically place bubbles around the model which will expand and contract to fill the white areas of the image. This is done by clicking on the image where you would like the bubble to appear and adjusting the radius to take up as much space as possible without overlapping the blue too much. I like to start on the extremities and work inward, to make sure that I don’t miss any external features. Remember that the bubbles are 3D, so they’ll show up on the other views of the scan.

ITKSnap7

 

I might have added a lot of bubbles… This makes the process faster but more computationally demanding. Once you’re happy with the bubble coverage, click Next.

Step 3/3, Evolution, is where the bubbles will actively seek to completely fill the white regions. You can adjust the region completion parameters, but when your contrast is this good it’s not necessary. Click the play button and watch the evolution. You can pause the iterations, and scroll through to check on the progress of your segmentation. I let mine run for about 250 cycles. When you’re done, hit Finish, and then click the update button in the bottom left of the program screen to view your segmentation.

ITKSnap8

 

DINOSAUR SKULL. AWESOME. 5 year old Jeremy is losing his mind right now.

You’ll notice some discs near the snout and back of the head where the bubbles didn’t disappear. These can be edited out using free programs like Meshlab. In order to do this, and the point of this entire tutorial, click the Segmentation menu and select Export as Surface Mesh. Since we only segmented one thing, select Export a Mesh for a Single Label, select browse to choose your file destination, enter a filename, and choose the mesh file format to be .STL

Hit Finish, let the program think for a while (this is a BIG file. Mine was 355Mb), and you’re done!

Now a lot of people interested in this tutorial will want to 3D print their segmentations. I can’t give perfect advice for this since different printers will struggle with different things. I would recommend using Meshlab or a similar program to adjust certain characteristics of the mesh like density and roughness to reduce the filesize to make it easier to print. Some programs offer the option of a global remesh to ensure watertightness (essential for some 3D prints), and I would definitely explore those options. If you go the MeshLab route, perform a Poisson Reconstruction to redistribute the polygons and ensure watertightness. This drops the filzesize to a couple kB and is easily handled by most consumer printers. Chances are, if you own your own printer, you know all of this. Happy printing!