I’m doing a project in which I need to automatically segment the femur. It seemed like an easy job (great difference between bone and soft tissue) but I’ve been stuck for a while. I’ve already written a basic algorith to segment it which gives some results but they’re not perfect. The biggest problem is that there are some holes in it. I can’t close the wholes by lowering the threshold because than the kneecap and hip get segmented as well. I need to fix this since it should be a mesh on which I can do a Finite element analysis.
I’ll summarize what I’ve done so far:
- Threshold untill hip is no longer segmented.
- Threshold femur at a lower threshold (hip will be selected now)
- Dilate the hip that we got from thresholding in 1.
- Distract the hip from thresholding operation in 2.
- Same process is done to remove the kneecap.
The result is quite good, but there are some holes near the femur neck and certainly at the distal condyles. I was thinking about selecting the edge pixels (still need to figure out how to do that) and to plot a spline through them and then the spline would represent the edge and all the rest I would fill up with fill hole. Is there some way to do something similar? Do you think I could do this in Matlab, or will it take ages to process due to longer computing times in Matlab than in the efficient C implementation of SimpleITK? Below you can see an example slice and the 3D model I’ve managed to achieve so far.
It’s a long post but I hope someone can give me some guidelines on how to continue
You could take a look at this and this filter. An example how to use the latter in ITK.
Thanks! I can’t get the latter to work though. It needs an unsigned int for maximumNumberOfIterations but even if I give him that he keeps showing me this error:
In : sitk.VotingBinaryIterativeHoleFilling?
Signature: sitk.VotingBinaryIterativeHoleFilling(*args, **kwargs)
VotingBinaryIterativeHoleFilling(Image image1, VectorUInt32 radius, unsigned int maximumNumberOfIterations=10, unsigned int majorityThreshold=1, double foregroundValue=1.0, double backgroundValue=0.0) -> Image
Fills in holes and cavities by iteratively applying a voting
The error message is referring to argument 2, which is
radius. The error message says the that SimpleITK will use an std::vector of unsigned ints. You could pass something like
Damn, sorry I got confused with indexing. Thanks!
So i made some progress. I found a wrap function (for the 3D model), that works quite nicely. However inorder to decrease the holes untill they were wrapable I had to lower the threshold. Now I accidently start segmenting veins. Any idea’s on how to get these out?
The eternal conundrum. Lower the threshold to avoid holes in the organ of interest, and as side-effect inadvertently segment some unwanted structure.
What you could to for your case is get vesselness feature, which can help you remove it. But this filter isn’t wrapped for Python, so you might follow @blowekamp’s recommendation here.
Thanks for the advice but if it’s no part of Simpleitk than it will
probably take me ages to figure out how to write such a json file. I spent
a couple of days just trying to build Simpleitk (as a matter of fact I
still didn’t succeed one day I’ll get back to it). I’ll try to mess around
with the existing filters.