Here's the general approach I would take:
- For every pore, identify the end-points. We'll get to how to do this later.
- Once you have the end-points, select one, take the geodesic distance transform with this point selected and then calculate the maximum value in that pore (which I believe should always be the other end point).
- Divide the geodesic distance by the hypotenuse between the two end points to calculate tortuosity.
The second module of this webinar should help you get an understanding of the general idea as it is exactly the same thing in two dimensions:
Now, how to calculate endpoints in three dimensions? This is non-trivial. There are no prebuilt 3d skeletonization or thinning routines ( bwmorph for 2d) to my knowledge. If this was my task, I would probably try something like the following as a starter.
- Use bwperim to get just the perimeter voxels of the pores (they will contain endpoints).
- Then loop over the voxels in the perimeter taking the geodesic distance transform with respect to each voxel.
- Calculate the maximum value and store it only if the max is greater than the previous max. This is a brute force approach to finding the endpoints (i.e. the two points that maximize distance along the pore. I can't think of a cheap way around this though because a weird shape could throw off anything general.
- Once you have the endpoints, the geodesic distance between them, calculate the distance between them using the distance formula. Divide these two and then relax.
Maybe Image Analyst will have some additional thoughts as well.