Calculate maximum diameter in 3D binary mask
Something similar to a Gradient Descent could be implemented.

Start with 2 points (A and B), located randomly around the 3D mask
For point A, calculate the direction to travel on the 3D mask that will most increase the distance between him and point B.
Make point A take a small step in that direction.
For point B, calculate the direction to travel on the 3D mask that will most increase the distance between him and point A.
Make point B take a small step in that direction.
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.
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.