![]() The pixel value is displayed according to the mean attenuation of the tissue that it corresponds to on a scale from –1024 to over 3000 on the Hounsfield scale. Pixels in an image obtained by CT scanning are displayed in terms of relative radiodensity. The Hounsfiled scale is a quantitative measure of radiodensity. In a nutshell, this process allows us to go from the grayish blur that are medical image datasets, to a label-field where each tissue or anatomical structure is characterized by an index, and eventually to a nifty 3D model of the anatomical body that underwent imaging.Īs I will be using a computed tomography (CT) dataset, I thought I’d explain a few core-concepts so that you can understand the rationale behind the approach and see that its actually scientifically viable (and not just a meaningless example). ![]() The example I will be showing today is a very common procedure in biomedical engineering, and falls under the category of medical image segmentation. What you would do is simply load the DICOM data into a NumPy array as I showed last time using pydicom, and then use the _cubes function mentioned above. And in any case, its really easy to adapt the aforementioned tutorial to your needs, and I assume you don’t need a post on that (if you do then feel free to let me know and I’ll be happy to oblige). However, having tested both approaches extensively, I’ve found that the VTK implementation is more robust, way faster, and results in better mesh quality. You can find the docs here, while a very nice tutorial on it can be found here. If for some reason you don’t have vtk installed in your python distro, then once more I suggest you use the Anaconda distro, of which I wrote in this previous post, and install it via conda install vtk.īefore I continue, I should note that there is an implementation of marching cubes in the scikit-image package under the measure module. Upon generating that surface, I’ll show you how to visualize that directly into the IPython Notebook, as well as how to save that surface as an STL file for external post-processing and visualization. ![]() I’ll be using a DICOM dataset of a CT examination which we will load with VTK, exactly as was shown in the last post, threshold it to isolate the bone-structures based on the Hounsfield scale, and then create a single mesh-surface of all the bones. What’s more is that even if you do find it, chances are it will be rather limited and most certainly computationally slow for real-world applications (still love Python more though, don’t get me wrong).Ĭase in point, in this post I will show you how to use the VTK Python bindings to extract a mesh-surface from a 3D volume, a process commonly termed as surface extraction, using the marching cubes algorithm implemented in the vtkDiscreteMarchingCubes class. ![]() Pain in the a** as it is to learn, VTK offers some fantastic image-processing functionality which you just can’t find in pure python libraries. I will then show you how to visualize the mesh with VTK and save it, the mesh that is, into an STL file.Īfter the last post on importing DICOM data with pydicom or VTK, you should’ve realized that VTK isn’t just about visualization as the name would suggest. In this post I will demonstrate how to use VTK to read in a series of DICOM files from a CT examination and extract a mesh surface of the bone structures. ![]()
0 Comments
Leave a Reply. |