To determine the orientation of a volume segment in space, you can calculate the second central moments of its density distribution and derive the corresponding eigenvectors. Here is a short script to compute central moments and volume orientation.
Define a function that calculates the moments of an array.
Convert the volume into a data array with its indices aligned to the graphics coordinates.
Compute the first- and second-order moments of the tooth density.
Compute the principal axes of the central moments matrix.