Making a model of the human skull from DICOM images
3D Printing for biomedical purposes, as I mentioned in one of my earlier posts is a crucial application and it has certainly caught my fancy. One of the most important applications of this technology is development of customised implants for human body. There are several issues associated with the models which have been adopted currently for implants in the human body, especially craniofacial. For example, when an implant is set in a human body, a craniofacial implant is often a generic structure which needs to be literally hammered into a desired shape which has to be fit on a patient. There are several problems associated with this approach:
Bending formed metal implants creates an inherent residual stress in their microstructure. This residual stress can create problems later.
Takes a lot of time. It takes about 40 mins to an hour to get the shape of the implant right (please correct me if this is incorrect).
Doctors won't really mess around with putting implants on you if they feel that the implant might lead to problems due to inaccuracy in shape. For example, most surgeons would avoid putting in implants near the eye sockets. As such, if there is a choice between deformity of the face or saving the life, the doctors will have to be content with the latter than the former.
If only there were a way of making custom craniofacial implants which could be used directly onto a patients skull. This would not only reduce the time required to perform the surgery, but also improve patient comfort and aethetics. For all this you need a model of the patient's skull which is exact in nature and in a format which can be easily 3D printed.
I had been looking into this interesting problem and wondered if there is a way to do this. A quick google search revealed that a number of people in research and medical sciences have already achieved this. However none was clear as to how to do this. This left my mind for sometime until I finally got a freelance project to make a model of a man's cranium from a CT scan on Shapeways. Fortunately, it paid well and I started to work on it. As a further challenge to myself, I decided to try to develop a custom implant for the model that I'd make.
So the first challenge was to understand how to get the 3D model. Now there are a number of medical imaging modalities which are available and each of them are for a different purpose of diagnosis. I am a mechanical engineering graduate and hence had no idea of how to go about the same. Therefore, I decided to take a course on Biomedical Imaging on EdX. This is an amazing course developed by the University of Queensland and gives a brilliant first hand understanding of the different imaging modalities and how they work. Based on this, I came to the conclusion that I will need to isolate the hard cranial bones from the remaining tissue and muscle from the structure. You can get this data in your CT scans. (Just ask your doctor to give you the CT scan data in the form of DICOM files. DICOM is a file format prevalent in the medical industry and is, simply put, an equivalent of the PDF format for documents in everyday life.) However, it was almost impossible for me to do so without:
Understanding how to parse DICOM images and isolate the cranial bones. OR
Identifying a suitable software solution to do the same for me.
Fortunately, the second option existed for me in the form of a free, open-source software called Invesalius (about which I have blogged here.) In fact, I liked the software so much, I actually spent time and developed an english manual for the same, which had been lacking for some time. The same has been downloaded at least 50 times as yet :)
The software is fairly easy to use. Once you have identified the part of the anatomy you want to use, you can select that (e.g. compact bones in my case) and simply perform a 3D reconstruction on the same. It is advisable to select a context based smoothening operation available in Invesalius to give the best results. Once you have the appropriate parameters for the parts you want to isolate, just hit File>Export and save it as a .stl file. <Mind you isolate the exact part takes a fair bit of trial and error with the software. What you are essentially doing is setting a threshold for the X-ray attentuation that have taken place in the body. Since every human body is slightly different, so is the X-ray attenuation). This is what the exported model looks like:
One problem I faced initially was that I was unable to get the exact body parts I needed. For example, in the case of this cranium, I was often facing issues with a lot of artifacts which came in as a part of the stl output or some amount of brain matter. These are common problems which have more to do with your skill of manual thresholding rather than the problem with the software. Before we go further, I will need to explain a bit about the design requirements for 3D printing. Unlike what you might have thought, 3D printing cannot print EVERY design under the sun. There are certain limitations to that. Some of the most essential requirements of making a design appropriate for 3D printing are as below (Some of these have been taken from http://www.admproductdesign.com/workshop/3d-printing/definition-of-stl-errors.html which succinctly provide the major problems that come up in STL files) :
Ensure design is waterproof (Every triangle in the STL is connected to atleast one other triangle on a minimum of 2 of its edges)
No inverted normals: This is required to ensure the printer head doesn't get confused while printing. Simply put the normals give a sense of direction to the 3D printer.
No bad edges: Essentially this means you have 2 triangles on your mesh which are not connected via edges completely. You need triangles which completely touch each others' edges.
No holes: Absence of any triangle in a region.
No noise shells: It is essentially a mesh part which is fragmented/has zero or negative surface area. Noise shells have no physical meaning and have to be deleted.
No overlapping or intersecting triangles (optional, but important check)
Ensuring that the number of triangles in the STL is less than a million. You won't need more than this for your printing exercise. Secondly, you will have a tough time to get it printed via any commercial 3D printing services.
Ensure that you assign a thickness of a minimum of 1 mm to your mesh. Remember the STL output is a mesh, which means it is a zero thickness surface.
Now, in order to achieve all this, you need access to one of the many STL manipulation software available in the market. For free software, you may opt for Meshlab and Blender. On closed source, Magics and Netfabb Pro will be best. I prefer Magics as it is easy to use and learn.
As you can see, the yellow line marks a bad edge. A red indicates inverted normals in a region. Apart from this, if you look closely, you can observe some red colored lines in the region between the eyes and some suspended artifacts. These suspended articles are your noise shells. Here is the workflow I recommend to tackle these issues quickly:
Run the Auto Fix wizard in Magics. It will immediately solve a lot of your problems. It is perfect for your inverted normals and automatic fixing of most of the bad edges.
Be very careful of what features you want to fix. For example, the hole on the left side of the skull will also get filled by the Auto Fix wizard, which you don't want fixed. Remember it is an original part of the cranium you want to preserve. I recommend you fix the triangles in that particular region first and then run an auto fix.
A brilliant hack I discovered is to use the "Convert Shell to parts" feature in Magics. So what happens is a lot of the times with scanned data, a number of unwanted artifacts come into play. As such, it is a pain to select individual noise shells to delete. A quicker work around is to convert all the shells to parts. As a result, you will get a numbered list of ALL the parts. Now you can select all the unwanted parts and simply unload them.
Once you are done with removing all the errors, this is what the model looks like (or looked like in my case):
Figure: Front view of repaired STL file. Note no more red lines.
Figure: Side view with the hole preserved. The red in this image is the interior surface of the lower plate of the skull which has its normals facing inwards. Rest assured it is not a problem since our concern is majorly with the outer skull plate.
Intermediate conclusion: The skull was finally modeled according to the requirements!
Now, onto the more difficult part: How to build a custom implant for these holes. This will be tackled in the second part of this post.
PS: In a manner similar to this approach, I was able to reconstruct a human heart's 3D printable model from the MRI scans' DICOM images as shown below:
Figure: Front view of the human heart
Figure: Side view of the human heart
In the next post, I shall expand on the method to make the implant for the cranium model we developed.