Averaging rotations and calculating the variability

This topic has been discussed on this forum:

An algorithm is provided for computing axis of rotation for a single pair of transforms and a perfect rotation around a single axis. Nobody volunteered to develop a more robust algorithm that could approximate the rotation axis from many imperfect measurements, so you would need to figure it out.

It may not be very hard, as there are not too many unknowns (you only have to determine position and orientation of the rotation axis and for each pair of transforms a rotation angle, so if you have 4 pair of transforms then in total you have 10 unknowns) and you may be able to get an approximate initial guess based on anatomical knowledge. You need to specify some error metric (such as residual position error of some anatomical landmark points) and then you can compute the uknowns using any non-linear optimizer.