Thinning 3d object borders to pixel thickness

1 view (last 30 days)
I am attempting to perform an operation in 3d similar to skeletonization, but instead of producing pixel-width lines I want to produce pixel-thick curved 'shells' of the entire border. Basic demo attached: i basically want to make spheres from the middle of the much thicker border. The middle is important: a convex hull or perimiter operation isn't going to work.
I initially thought that bwskel would work, but it only produces complete shells when there is a very specific curvature. I actually don't know HOW it does this, as the documentation says it uses 26-conn when these weird shell results look like 8-conn skeletonizations.
Any ideas how to get this done?

Accepted Answer

Carson Purnell
Carson Purnell on 7 Dec 2022
I couldn't find any existing implementation of a 3d ridge detector using hessian matrices, but I found a much simpler solution that works for my case. using bwdist and imgradient 3 can find the inflection point of the border, which should be the center.
bw = bwdist(~vol); %calculate distances inside the shape
mask = rescale(imgradient3(bw))>0.5; %generate an inverse mask that approximates the border, minus the mid
skel = (bw.*~mask)>max(bw,[],'all')/2-1; %apply the mask to the distance map and threshold edge noise
skel = bwareaopen(skel,8); %clean any remaining outlier points
probably more efficient/general/precise methods but hopefully this implementation is useful if you come across it.

More Answers (0)

Categories

Find more on Biological Physics in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!