Calculate maximum diameter in 3D binary mask

I want to calculate maximum diameter of a 3D binary mask of a nodule (irregular shape). I have implemented a function that calculates the distance of all boundary points between each other. This method is very computational expensive while dealing with tumors or larger volume.

So my Question is what can be the possible methods to calculate maximum diameter of a 3d binary mask which is less computationally expensive.


Something similar to a Gradient Descent could be implemented.

  1. Start with 2 points (A and B), located randomly around the 3D mask
  2. For point A, calculate the direction to travel on the 3D mask that will most increase the distance between him and point B.
  3. Make point A take a small step in that direction.
  4. For point B, calculate the direction to travel on the 3D mask that will most increase the distance between him and point A.
  5. Make point B take a small step in that direction.
  6. Repeat until it converges.

This will very likely find local maxima, so you would probably have to repeat the experiment several times to find the real global maxima.