How to find distribution of thickness??

 Accepted Answer

This is how:
1. Use bwdist() to calculate the Euclidean Distance Transform.
2. Use bwmorph() to calculate the skeleton.
3. Get the ridgelines by taking the EDT image at the skeleton locations. The values along the ridgelines of the EDT will be the distance from the ridgeline (backbone, skeleton) to the background. You may want to double these values to get the width all the way across instead of only half way across.
4. Take the histogram of those values.
It should only be 4-6 lines of code (not including comments, calls to display and plot things etc.). Give it a shot.

4 Comments

I tried this in Matlab 2014b with a 3D data set, but bwmorph() gives me an error saying that the first input needs to be 2D:
SKL = bwmorph(BW, 'skel', Inf); Error using bwmorph Expected input number 1, BW, to be two-dimensional.
Error in bwmorph (line 91) validateattributes(bwin,{'numeric' 'logical'},{'real' 'nonsparse' '2d'}, ...
---
Is there a 3D form of bwmorph? I don't see one. Is it appropriate to loop through each slice of the 3D data set and apply the 2D bwmorph?
Thanks,
What does this say:
whos BW
Chances are you're passing a color RGB image instead of a binary image for some reason.
It says:
K>> whos BW
Name Size Bytes Class Attributes
BW 354x209x196 14501256 logical
which suggests that the previously reported error message (Error using bwmorph Expected input number 1, BW, to be two-dimensional) indicating BW needs to be 2D might actually mean that BW needs to be 2D. Or is there some other implied meaning to that?
You have a volumetric binary image (not a color image like I thought). Of course that is not allowed either. Skeletonization reduces the dimension by one, so the skeleton of a 3D object is a bunch of curvilinear sheets, though I think there are routines that can take a skeleton of thick branches and dissolve them down to one pixel wide lines. I've not personally used any of them and don't know the details. I've only used the "sheets" skeletonization (provided to me by Steve Eddins of the Mathworks)

Sign in to comment.

More Answers (1)

Euclidean Distance Transform [bwdist()]can be used only to calculate the thickness of 2D image not 3D images.
Anybody can suggest the 3D thickness measurement methods?

3 Comments

I don't have experience with this particular function but if it is a 3D image you are interested in you could just run the 2D function for each 2D slice of the image and then compile the results together. Just a thought.
Why do you say that? That's not true. Just look at the help:
D = bwdist(BW) computes the Euclidean distance transform of the binary image BW. For each pixel in BW, the distance transform assigns a number that is the distance between that pixel and the nearest nonzero pixel of BW. bwdist uses the Euclidean distance metric by default. BW can have any dimension. D is the same size as BW.
The key phrase being "BW can have any dimension." In other words, it can handle 3-D volumetric binary images.
Thanks for the right acknowledgement.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!